Jump to content

hackerkts

Members
  • Posts

    593
  • Joined

  • Last visited

About hackerkts

  • Birthday January 1

Profile Information

  • Gender
    Male
  • Location
    Singapore
  • Age
    18

hackerkts's Achievements

Member

Member (2/5)

0

Reputation

  1. I read that, but not all the articles. I'm trying out at the script my friend told me, no luck. And yes I did search, I wouldn't ask for help unless I really need to.
  2. Thanks for the reply! But I couldn't get it to work, this is what my friend had come out with <?php function PostRequest($url, $referer, $_data) { // convert variables array to string: $data = array(); while(list($n,$v) = each($_data)){ $data[] = "$n=$v"; } $data = implode('&', $data); // format --> test1=a&test2=b etc. // parse the given URL $url = parse_url($url); if ($url['scheme'] != 'http') { die('Only HTTP request are supported !'); } // extract host and path: $host = $url['host']; $path = $url['path']; // open a socket connection on port 80 $fp = fsockopen($host, 80); // send the request headers: fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Referer: $referer\r\n"); //fputs($fp, "Expires: Mon, 26 Jul 2010 05:00:00 GMT\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ". strlen($data) ."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); $result = ''; while(!feof($fp)) { // receive the results of the request $result .= fgets($fp, 128); } // close the socket connection: fclose($fp); // split the result header from the content $result = explode("\r\n\r\n", $result, 2); $header = isset($result[0]) ? $result[0] : ''; $content = isset($result[1]) ? $result[1] : ''; // return as array: return array($header, $content); } $data = array( 'txtModule' => 'StudentSearch', 'txtSelStudentID' => '0800520I', 'cboSearch' => 'Student', 'txtAction' => 'TTServlet', 'txtAdmNo' => '0800520I'); // send a request to example.com (referer = jonasjohn.de) list($header, $content) = PostRequest("http://epoly.tp.edu.sg/tpapp/isistt/","http://localhost:80",$data); // print the result of the whole request: print $content; // print $header; --> prints the headers //print $header; ?>
  3. Hi, I'm kind of stuck. I'm trying to submit a form to another URL from my own web server, then retrieve the result by getting the page content. But it doesn't seems to work. The page I'm trying to get content is this http://epoly.tp.edu.sg/tpapp/isistt/TTServlet Use my admin for testing, 0800520I It's either you search by admin or the person name. Anyone has any idea?
  4. Sorry to add on, I would like the link to add a?=NUMBER when I check on the checkbox, the number is the value of the check form.
  5. Hi guys, I'm quite new to ajax, so pardon me. I have a html page where user will type in some unique number and it will search through MySQL and show their name. Beside their name there will be a checkbox for them to tick. Here comes the problem, I'm trying to update my MySQL once user tick beside their name, ajax doesn't seems to work. index.html <html> <head> <script src="clienthint.js"></script> </head> <body> <form> Admin No: <input type="text" onKeyUp="showHint(this.value)" /> </form> <p>Suggestions:</p> <p><span id="txtHint"></span></p> </body> </html> clienthint.js var xmlhttp function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="gethint.php"; url=url+"?q="+str; //url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function chkit(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url=url+"?admin="+str; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } gethint.php <?php echo $_SERVER['REQUEST_URI']; $mysql = mysql_connect("localhost", "root", null); mysql_select_db("openhouse", $mysql); $query = mysql_query("SELECT name,admin FROM attendance WHERE training='no' ORDER BY name")or die("MySQL Error: ".mysql_error()); while($r = mysql_fetch_assoc($query)) { $a[] = $r['admin']; $b[] = $r['name']; } //get the q parameter from URL $q=$_GET["q"]; //lookup all hints from array if length of q>0 echo '<table border="1">'; if (strlen($q) > 0) { $hint=""; for($i=0; $i<count($a); $i++) { if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q)))) { if ($hint=="") { //$hint=$b[$i]; echo '<tr>'; echo '<td>'.$b[$i].'</td>'; echo '<td><input name="chk" type="checkbox" value="'.$a[$i].'" onClick="chkit(this.value)" /></td>'; echo '</tr>'; } else { $hint=$hint." <br> ".$b[$i]; } } } } echo '</table>'; // Set output to "no suggestion" if no hint were found // or to the correct values if ($hint == "") { $response="no suggestion"; } else { //$response=$hint; $response = null; } //output the response echo $response; ?>
  6. Those symbol you seeing could be problem with language, maybe you can try find some online emailing script.
  7. add this below <?php echo "Email: ".$email."<br />Message: ".$message; submit the button and see if there's anything pass through.
  8. I would suggest you to check if the values are passed to the page, try echo-ing out your email and message.
  9. What do you mean by groups of 4?
  10. <?php $to = "myemail@gmail.com"; $subject = "Invitation"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your email was sent"; } if( isset($_REQUEST['email']) && isset($_REQUEST['message']) ) { $email = $_REQUEST['email']; $message = $_REQUEST['message']; if($email == "" || $message == "") { echo "<br /><br />You did not fill out the form"; } } ?> You forgotten to close your curly braces and one of your if statement you left out the "i".
  11. It's not insert into database, use this to check if there's any error $sq="INSERT INTO users (serial,id,first_name, last_name, gender,course,year) VALUES('$sr','$receipt','$fname','$lname','$gender','$course','$year')or die(mysql_error())"; Hope this helps.
  12. Thanks! I think I'm on the right track. But I having problem changing the font, it doesn't save. Argh.
  13. Sorry, I'm not sure what to put for the subject. Well, I have a problem with the font whenever I open my php file using Dreamweaver CS3. For example when I open my php file, the font will looks like this. Can I make the display way change to this? Other file didn't give me this problem, only php file ):
  14. Maybe you can try using (.*) instead of (.+), if you say your RewriteRule ^(.+).gif$ wm.php?src=$1.gif isn't working, then try to echo the value of $_GET['src'].
×
×
  • 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.