Guest User

Untitled

a guest
Jan 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. This is the index.php
  2. "<form action="javascript:read()" method="post">
  3. <input type="submit" name="Submit" value="read"/>
  4. <input name="id" type="hidden" id="id" value="<? echo $userid; ?>"/>
  5. </form>"
  6.  
  7. This is ajax
  8.  
  9. "function createObject() {
  10. var request_type;
  11. var browser = navigator.appName;
  12. if(browser == "Microsoft Internet Explorer"){
  13. request_type = new ActiveXObject("Microsoft.XMLHTTP");
  14. }else{
  15. request_type = new XMLHttpRequest();
  16. }
  17. return request_type;
  18. }
  19.  
  20. var http = createObject();
  21. var nocache = 0;
  22.  
  23. function read() {
  24.  
  25. document.getElementById('insert_response').innerHTML = "Just a second..."
  26.  
  27. var id = encodeURI(document.getElementById('id').value);
  28.  
  29. nocache = Math.random();
  30.  
  31. http.open('get', 'read.php?nocache='+nocache+'&id='+id);
  32. http.onreadystatechange = insertReply;
  33. http.send(null);
  34. }
  35. function insertReply() {
  36. if(http.readyState == 4){
  37. var response = http.responseText;
  38.  
  39. document.getElementById('insert_response').innerHTML = 'Site added:'+response;
  40. }
  41. }"
  42.  
  43. And this is the read.php
  44. "
  45. $result = mysql_query("SELECT * FROM enemies WHERE id='$id'") or die(mysql_error());
  46.  
  47. echo "
  48.  
  49. <table border='1' align='center' cellpadding='4' cellspacing='0' class='table'><tr>
  50. <th align='center'><input type='checkbox' onClick='toggle(this)' /></th>
  51. <th align='center'>Name Of Friend</th>
  52. <th align='center'>IP/DNS</th>
  53. </tr>";
  54.  
  55. while($row = mysql_fetch_array($result) or die(mysql_error()) )
  56. {
  57. echo "<tr class='alt' align='center'>";
  58. echo "<td align='center'>" . "<input type='checkbox' id='chkDel[]' value='".$row['unid']."' name='chkDel[]'/>" . "</td>";
  59. echo "<td align='center'>" . $row['name'] . "</td>";
  60. echo "<td align='center'>" . $row['ip'] . "</td>";
  61. echo "</tr align='center'>";
  62. }
  63. echo "</table>";
  64. "
Add Comment
Please, Sign In to add comment