-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadmin-work.php
67 lines (47 loc) · 2.16 KB
/
admin-work.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
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
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$exception_post = $_POST["exception"];
$exception[] = explode(",",$exception_post);
require_once("password.php");
$conn = new mysqli($servername , $username, $password);
if ($conn -> connect_error) {
die("ERROR CONNECTING" . $conn -> connect_error);
}
mysqli_select_db($conn , "yiyandingzhen");
$dbsql = 'SELECT * FROM yiyandingzhen';
$retvar = $conn -> query($dbsql);
$data = mysqli_fetch_all($retvar);
$result = mysqli_fetch_all($conn -> query("SELECT * FROM yiyandingzhen WHERE verified = 0 " ));
if($exception[0][0]==""){
$sql_request = "UPDATE yiyandingzhen SET verified = 1 WHERE verified = 0";
$mode = 1;
$conn -> query($sql_request);
}else if($exception[0][0]==114514){
for($i=1;$i<count($exception[0]);$i++){
$exception_for = $exception[0][$i];
$picPath = mysqli_fetch_array($conn -> query("SELECT pic_path FROM yiyandingzhen WHERE pic_id = {$exception_for} " ));
$sql_request = "DELETE FROM yiyandingzhen WHERE pic_id = $exception_for";
$conn -> query($sql_request);
unlink($picPath[0]);
}
$mode = 3;
}
else{
$sql_request = "UPDATE yiyandingzhen SET verified = 1 WHERE verified = 0";
$conn -> query($sql_request);
for($i=0;$i<count($exception[0]);$i++){
$exception_for = $exception[0][$i];
$sql_request = "UPDATE yiyandingzhen SET verified = 0 WHERE pic_id = '$exception_for' ";
$conn -> query($sql_request);
}
$mode = 2;
}
$retarr[] = array(
'request' => $sql_request,
'?' => $mode,
'result' => $result,
'exception' => count($exception[0]),
'status' => $status
);
echo json_encode($retarr);