-
Notifications
You must be signed in to change notification settings - Fork 0
/
postdelete.php
35 lines (28 loc) · 1.08 KB
/
postdelete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
session_start();
if(isset($_SESSION['id'])){
$usrid=$_SESSION['id'];
$pid=$_GET['post_id'];
$spid=$_GET['share_post_id'];
$conn = mysqli_connect('localhost', 'root', '', 'askme');
if(isset($pid)){
mysqli_query($conn, "DELETE FROM post WHERE id='$pid'");
echo "<script>alert('Successful Delete Your Post');</script>";
echo "<script>location= 'profile.php'</script>";
}
if(isset($spid)){
mysqli_query($conn, "DELETE FROM share WHERE postid='$spid' AND userid='$usrid'");
echo "<script>alert('Successful Delete Your Share Post');</script>";
echo "<script>location= 'profile.php'</script>";
}
}else if(isset($_SESSION['a_email'])){
$pid=$_GET['post_id'];
$conn = mysqli_connect('localhost', 'root', '', 'askme');
if(isset($pid)){
mysqli_query($conn, "DELETE FROM post WHERE id='$pid'");
echo "<script>alert('Successful Delete Post');</script>";
echo "<script>location= 'manage_report.php'</script>";
}
}
echo "<script>alert('You need to login first');</script>";
?>