-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-approv.php
More file actions
118 lines (117 loc) · 3.7 KB
/
Copy pathuser-approv.php
File metadata and controls
118 lines (117 loc) · 3.7 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
include("css/css/css.php");
include("include/db.php");
include("include/session.php");
include("include/functions.php");
Confirm_login();
//include("include/sidebar.php");
if(isset($_GET['appr'])){
$msg = "";
$userId = $_GET['appr'];
$stmt = $connect->prepare("select * from users where id = $userId");
$stmt -> execute();
$checkUsers = $stmt->fetchAll();
foreach($checkUsers as $row){
if($row["role"] == '1'){
$_SESSION['message'] = "This account is unchangable. The adminestrator got the mesage.";
header("Location: users.php");
}else{
$update = "UPDATE `users` SET `status`='ON' WHERE id = $userId";
$update = $connect->prepare($update);
$update ->execute();
if($update){
$_SESSION['Message'] = "User Approved Successfully";
header("Location: users.php");
}
}
}
}
if(isset($_GET['unappr'])){
$userId = $_GET['unappr'];
$stmt = $connect->prepare("select * from users where id = $userId");
$stmt -> execute();
$checkUsers = $stmt->fetchAll();
foreach($checkUsers as $row){
if($row["role"] == '1'){
$_SESSION['message'] = "This account is unchangable. The adminestrator got the mesage.";
header("Location: users.php");
}else{
$update = "UPDATE `users` SET `status`='OFF' WHERE id = $userId";
$update = $connect->prepare($update);
$update ->execute();
if($update){
$_SESSION['Message'] = "User UnApproved Successfully";
header("Location: users.php");
}
}
}
}
if(isset($_GET['unappr'])){
$userId = $_GET['unappr'];
$stmt = $connect->prepare("select * from users where id = $userId");
$stmt -> execute();
$checkUsers = $stmt->fetchAll();
foreach($checkUsers as $row){
if($row["role"] == '1'){
$_SESSION['message'] = "This account is unchangable. The adminestrator got the mesage.";
header("Location: users.php");
}else{
$update = "UPDATE `users` SET `status`='OFF' WHERE id = $userId";
$update = $connect->prepare($update);
$update ->execute();
if($update){
$_SESSION['Message'] = "User UnApproved Successfully";
header("Location: users.php");
}
}
}
}
if(isset($_GET['cmtApprove'])){
$userId = $_GET['cmtApprove'];
$postId = $_GET['postId'];
$update = "UPDATE `comment` SET `status`='ON' WHERE id = $userId";
$update = $connect->prepare($update);
$update ->execute();
if($update){
$_SESSION['Message'] = "Comment Approved Successfully";
header("Location: comments.php");
$update = "UPDATE `post` SET cmt= cmt+1 WHERE id = $postId";
$update = $connect->prepare($update);
$update ->execute();
}else{
$_SESSION['message'] = "Something went wrong";
header("Location: comments.php");
}
}
if(isset($_GET['cmtUnApprov'])){
$postId = $_GET['postId'];
$userId = $_GET['cmtUnApprov'];
$update = "UPDATE `comment` SET `status`='OFF' WHERE id = $userId";
$update = $connect->prepare($update);
$update ->execute();
if($update){
$update = "UPDATE `post` SET `cmt`= cmt -1 WHERE id = $postId";
$update = $connect->prepare($update);
$update ->execute();
$_SESSION['Message'] = "Comment UnApproved Successfully";
header("Location: comments.php");
}else{
$_SESSION['message'] = "Something went wrong";
header("Location: comments.php");
}
}
if(isset($_GET['cmtDelete'])){
$userId = $_GET['cmtDelete'];
$postId = $_GET['postId'];
$update = "DELETE FROM `comment` WHERE id = $userId";
$update = $connect->prepare($update);
$update ->execute();
if($update){
$_SESSION['message'] = "Comment Deleted Successfully";
header("Location: comments.php");
}else{
$_SESSION['message'] = "Something went wrong";
header("Location: comments.php");
}
}
?>