Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is the index.php
- "<form action="javascript:read()" method="post">
- <input type="submit" name="Submit" value="read"/>
- <input name="id" type="hidden" id="id" value="<? echo $userid; ?>"/>
- </form>"
- This is ajax
- "function createObject() {
- var request_type;
- var browser = navigator.appName;
- if(browser == "Microsoft Internet Explorer"){
- request_type = new ActiveXObject("Microsoft.XMLHTTP");
- }else{
- request_type = new XMLHttpRequest();
- }
- return request_type;
- }
- var http = createObject();
- var nocache = 0;
- function read() {
- document.getElementById('insert_response').innerHTML = "Just a second..."
- var id = encodeURI(document.getElementById('id').value);
- nocache = Math.random();
- http.open('get', 'read.php?nocache='+nocache+'&id='+id);
- http.onreadystatechange = insertReply;
- http.send(null);
- }
- function insertReply() {
- if(http.readyState == 4){
- var response = http.responseText;
- document.getElementById('insert_response').innerHTML = 'Site added:'+response;
- }
- }"
- And this is the read.php
- "
- $result = mysql_query("SELECT * FROM enemies WHERE id='$id'") or die(mysql_error());
- echo "
- <table border='1' align='center' cellpadding='4' cellspacing='0' class='table'><tr>
- <th align='center'><input type='checkbox' onClick='toggle(this)' /></th>
- <th align='center'>Name Of Friend</th>
- <th align='center'>IP/DNS</th>
- </tr>";
- while($row = mysql_fetch_array($result) or die(mysql_error()) )
- {
- echo "<tr class='alt' align='center'>";
- echo "<td align='center'>" . "<input type='checkbox' id='chkDel[]' value='".$row['unid']."' name='chkDel[]'/>" . "</td>";
- echo "<td align='center'>" . $row['name'] . "</td>";
- echo "<td align='center'>" . $row['ip'] . "</td>";
- echo "</tr align='center'>";
- }
- echo "</table>";
- "
Add Comment
Please, Sign In to add comment