-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_comment.php
41 lines (32 loc) · 952 Bytes
/
delete_comment.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
36
37
38
39
40
41
<?php
session_start();
include("includes/connection.php");
include("functions.php");
$user_id = $_SESSION['USER_ID'];
$sql = "SELECT user_type FROM user WHERE user_id ='$user_id' ";
$result_set = mysqli_query($conn,$sql);
while($row=mysqli_fetch_array($result_set)){
if($row['user_type'] == "Admin") {
$comment_id = $_GET['id'];
$sql = "DELETE FROM comment WHERE comment_id = '$comment_id'";
if(mysqli_query($conn,$sql)){
redirect_to("admin_comment.php");
}
else{
echo 'error';
}
}
else if ($row['user_type'] == "Artist" || $row['user_type'] == 'Customer' )
{
$comment_id = $_GET['comment_id'];
$art_id = $_GET['art_id'];
$sql = "DELETE FROM comment WHERE comment_id = '$comment_id'";
if(mysqli_query($conn,$sql)){
redirect_to("info_art.php?id=$art_id");
}
else{
echo 'error';
}
}
}
?>