Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. $sql = "SELECT * FROM classposts where branch='$branch' and joindate='$year' and class='$class' order by".$orderby." desc";
  2. $result = $connection->query($sql);
  3. if(isset($_SESSION['username'])){
  4. $username=$_SESSION['username'];
  5. }
  6.  
  7. while($row = $result->fetch_assoc()) {
  8. echo "<span id='postspan".$row['id']."' name='postspan".$row['id']."' >";
  9. echo "<span id='editspan".$row['id']."' name='editspan".$row['id']."' >";
  10. echo "-----------------------------------</br>";
  11. echo "-----------------------------------</br>";
  12.  
  13. echo "Posted By: ".$row['user']."&nbsp&nbsp&nbsp&nbsp";
  14. if($username==$row['user']){
  15. echo "<a href='classwall.php' onclick='deletepost(".$row['id'].")' >DELETE POST</a>&nbsp&nbsp&nbsp";
  16.  
  17. }
  18.  
  19. function deletepost(postid){
  20. var r=confirm("Are you sure you want to delete the post?");
  21. if(r==true){
  22. var xmlhttp=new XMLHttpRequest();
  23. xmlhttp.onreadystatechange=function() {
  24. if (xmlhttp.readyState==4 && xmlhttp.status==200) {
  25.  
  26. document.getElementById("postspan"+postid).innerHTML=xmlhttp.responseText;
  27.  
  28. }
  29. };
  30. xmlhttp.open("GET","deletepost.php?pid="+postid,true);
  31. xmlhttp.send();
  32. }else{}
  33. }
  34.  
  35. $pid=$_GET['pid'];
  36. $query="delete from dubiousposts where id='$pid'";
  37. $sql=mysqli_query($connection,$query);
  38. $query="delete from genuineposts where id='$pid'";
  39. $sql=mysqli_query($connection,$query);
  40.  
  41. $query="delete from posts where id='$pid'";
  42. $sql=mysqli_query($connection,$query);
  43.  
  44. if($result=mysqli_fetch_array($sql)){
  45. echo "";
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement