Jump to content

phpfreakjav

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpfreakjav's Achievements

Member

Member (2/5)

0

Reputation

  1. <?php function http_file_exists($url) { $f=@fopen($url,"r"); if($f) { fclose($f); return true; } return false; } ?>
  2. Like a webservice. Very interesting. I will find out and come back to tell you the issue.
  3. Hello I have a question in regards to design. No need for example code just of how to approach the problem. Issues and things that cannot change because they are part of the situation. 1. Cannot use any database like oracle, MySQL, or SQLite 2. The server does not run PHP5 3. The students do not have a unique field and cant have one because they have not my employers have not decided on one. Here is the problem: I have to make a form with the following fields first name last name comments date I have stored the fields in a text file. However, how can I relate date to the comment without having duplicates records? For example. Lets suppose my boss asked me can you look up the comments that the counselor made in july 10 2010. My answer: One must have duplicate records of each instance of a comment. Am I wrong?
  4. Hi here is a complete userRegistration check class. It allows you to check in any Database whether a user has entered the correct user Name and password. You might have to update the include 'pathofdirectory' lines. I have included all files GOOD LUCK AND THANKS AGAIN [attachment deleted by admin]
  5. I am new to php syntax. My question is: The function checkIdExist returns a string how can I access the string in my client. <?php //this is my client code include "UserRegistration.php"; $user = new UserRegistration(); $user->setName("jose"); $user->checkIdExist("Name","SELECT Name From Users WHERE Name='jose'"); print gettype($user); ?> <?php require_once('../databaseConnection/DbConnector.php');//assume all of this code is correct //class code class UserRegistration { var $name; var $mName; var $lName; var $userId; function getName() { return $this ->name; } function setName($fName) { $this->name=$fName; } function getMName() { $this->mName; } function setMName($mName) { $this->mName = $mName; } function setLname($x) { $this->lName =$x; } function getLName() { $this -> lName; } function getUserId() { return $this->userId; } function setUserId($id) { $this -> userId =$id; } function checkIdExist($columnName,$query) { $connector = new DbConnector(); $id=$this->getName(); $result = $connector->query($query);//change this to meet your needs $num=mysql_numrows($result); $row = $connector->fetchArray($result);// this is a multidimensional array 2x2 [][] if($row[$columnName]== $id){ return "HOW CAN I ACCESS YOU"; } else return "WHERE DID THIS RESULT GO?"; } } ?>
  6. That's all the code there is in test.php no more no less.
  7. 1.I am using xamp to run my server. The default configuration. 2.I have a code by http://code.google.com/p/smt2/ ( a mouse movement tracking script) 3. I have test2.php file.which contained the following code <html> <head> <script type="text/javascript" src="/smt2/core/js/smt-aux.min.js"></script> <!--files from smt project--> <script type="text/javascript" src="/smt2/core/js/smt-record.min.js"></script><!-- files from smt project--> </head> <body> <img src="images/rectangle.php" /><!-- this is the image created by rectangle.php--> </body> </html> 4. I have a rectangle.php script which contains the following code <?php header("Content-type: image/png"); $image = imagecreate( 700, 500); $red = imagecolorallocate($image,0,0, 0); imagepng($image); imagedestroy($image); ob_flush(); ?> I am getting this error when I try to replay the mouse movements through the script from http://code.google.com/p/smt2/ Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test.php:1) in C:\xampp\htdocs\test.php on line 2 PNG (smt) canvas layer. Enable JavaScript and Flash to replay this log! The odd thing is , that even if i get rid of test.php (delete the file) I still get the error mentioned above when I try to use the mouse tracking script. Also, before I sent the header(Content-type:image/png); the script worked just fine. After I sent the headers the script started crashing.
  8. http://www.phpfreaks.com/forums/index.php/topic,255426.0.html
  9. Question is how can I make the header back to default. In other words to return to the state that it was before I sent the header. <?php header("Content-type: image/png"); $image = imagecreate( 700, 500); $red = imagecolorallocate($image,0,0, 0); imagepng($image); imagedestroy($image); ob_flush();// is this is supposed to get rid of the header? ?>
  10. Problem 1 : is not following my css command CHECK THE displayx function Problem 2 : is giving me a comma in the last digit. Thanks for all your help <html> <head> <title>Accuracy Testing System for Parkinson Patients</title> <meta http-equiv="content-Type" content="text/html;charset=gb2312"> <style type="text/css"> .box1{float:left;} .box2{float:left;} </style> </head> <body onmousemover="follow()"> <!--<body></body>--> <center><img src="Images/MainHome72b.gif"></center> <br><script language="JavaScript"> <!-- var mousex=new Array(); var mousey=new Array(); var timecounter=new Array(); var d = new Date(); var getmin=new Array(); var i; var j=0; var k; var recordcount=0; var repeat; var repeat2; var repeat3; var speed=50; var timerate=20; //milliseconds ; //getUTCMilliseconds() timecounter[0]=0; function startthis() { recordcount=1; i=0; mousex=new Array(); mousey=new Array(); recordthis(); } function recordthis() { getmin[0]=d.getUTCSeconds()+d.getUTCMilliseconds()/1000; if (maxnum.value=='' || isNaN(maxnum.value) == true || maxnum.value<0) { if (recordcount==1) { mousex[i]=mousefollow.offsetLeft; mousey[i]=mousefollow.offsetTop; i++; timecounter[i]=timecounter[i-1]+timerate; getmin[i]=getmin[i-1]+timerate/1000; k=i; textfield.value='No Time Limit'; } } else { if (recordcount==1) { if (i<maxnum.value) { mousex[i]=mousefollow.offsetLeft; mousey[i]=mousefollow.offsetTop; i++; timecounter[i]=timecounter[i-1]+timerate; getmin[i]=getmin[i-1]+timerate/1000; k=i; textfield.value='Time Left'+(maxnum.value-i)+'/50seconds'; } else { recordcount=0; textfield.value='Time is Over';} } } repeat=setTimeout("recordthis()",timerate); } function stopthis() { clearTimeout("repeat"); recordcount=0; } function playthis() { clearTimeout("repeat"); clearTimeout("repeat3"); recordcount=0; if (j<i-1) { arrow.style.pixelLeft=mousex[j]; arrow.style.pixelTop=mousey[j]; arrow.style.visibility='visible'; j++; repeat2=setTimeout("playthis()",speed); } else {clearTimeout("repeat2"); arrow.style.visibility='hidden'; j=0; } } function displayx(x) { document.write(' <div class="box1"> '); for(var i =0; i<mousex.length; i++) { if(i==0) { document.write(mousex[i]) ; document.write("<br/>") ; } if(i==mousex.length) { document.write(mousex[i]) ; document.write("<br/>") ; } else { document.write(mousex[i]) ; document.write(",");//a comma document.write("<br/>") ; } }//end for document.write("</div>"); }//end function function showthis(){ displayx(mousex); // document.write("x: " + mousex + "<br>y: " + mousey +"<br><br><br>The time interval (record the mouse position vector) is every"+ timerate + " milliseconds" + "<br>recorded time (millisec): " + //timecounter+"<br>real time: " +getmin); // document.write("\n sss " ; } function rewindthis() { clearTimeout("repeat"); clearTimeout("repeat2"); recordcount=0; if (k>0) { arrow.style.pixelLeft=mousex[k-1]; arrow.style.pixelTop=mousey[k-1]; arrow.style.visibility='visible'; k--; repeat3=setTimeout("rewindthis()",speed); } else {clearTimeout("repeat3"); arrow.style.visibility='hidden'; k=i; } } function follow() { mousefollow.style.pixelLeft=document.body.scrollLeft+event.clientX; mousefollow.style.pixelTop=document.body.scrollTop+event.clientY; /*mousefollow.style.pixelLeft=document.getElementById('scrollLeft')+event.clientX; mousefollow.style.pixelTop=document.getElementById('scrollTop')+event.clientY;*/ } // --> </script> <div id="arrow" style="position:absolute; width:12px; height:21px; z-index:1;visibility:hidden"><img src="Images/Cursor.gif"></div> <div id="mousefollow" style="position:absolute; width:12px; height:21px; z-index:1;visibility:hidden">.</div> <input type="text" name="maxnum" size="4" maxlength="4"> <input type="button" onClick="startthis()" value="Record"> <input type="button" onClick="stopthis()" value="Stop"> <input type="button" onClick="speed=50;playthis()" value="Play"><input type="button" onClick="speed=2;playthis()" value="Fast Play"> <input type="button" onClick="speed=150;playthis()" value="Slow Play"> <input type="button" onClick="speed=50;rewindthis()" value="Reverse Play"> <input type="button" name="textfield" style="width:100px" value="No Time Limit"> <input type="button" onClick="speed=50;showthis()" value="Show Mouse values"> <br><br><br> <center><img src="Images/bg.png"></center> </body> </html>
  11. Notice in the mysql query it says, values, how to I insert variables here. <?php // Get the PHP file containing the DbConnector class require_once('DbConnector.php'); // Create an instance of DbConnector $connector = new DbConnector(); // Use the query function of DbConnector to run a database query // (The arrow -> is used to access a function of an object) in other words to grab the variables in the Methods //$result = $connector->query('SELECT x FROM coordinates where x >0');//MySQL query goes here $result = $connector->query('INSERT INTO coordinates (x,y,t) VALUES(1,2,3)'); //coordinates is the table name, xyt are the //columns, and values are the values recorded by the mouse //script. // Get the result $row = $connector->fetchArray($result); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.