-
Notifications
You must be signed in to change notification settings - Fork 0
/
products_disprove.php
101 lines (78 loc) · 3.41 KB
/
products_disprove.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
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
<?php
session_start();
include "db_conn.php";
if (isset($_POST['productid']) && isset($_POST['action']) && isset($_POST['reason'])) {
$id = $_POST["productid"];
$action = $_POST["action"];
$reason = $_POST["reason"];
if ($action == "accept") {
$sql1 = "SELECT * FROM `product_report` WHERE `id` = '$id'";
$result1 = mysqli_query($conn, $sql1);
if ($result1 && mysqli_num_rows($result1) > 0) {
$row1 = mysqli_fetch_array($result1);
$productid = $row1["productid"];
$product = $row1["product"];
$user = $row1["user"];
$seller = $row1["seller"];
$issue = $row1["issue"];
$statement = $row1["statement"];
// Get the current time in the Philippines
date_default_timezone_set('Asia/Manila');
$currentDateTime = date('Y-m-d H:i:s');
$date = date('Y-m-d', strtotime($currentDateTime));
$time = date('H:i:s', strtotime($currentDateTime));
$sql2 = "INSERT INTO `product_log`(`productid`, `event`, `reason`, `product`, `user`, `seller`, `issue`, `statement`, `date`, `time`)
VALUES ('$productid','accepted','$reason','$product','$user','$seller','$issue','$statement','$date','$time')";
$result2 = mysqli_query($conn, $sql2);
if ($result2) {
$sql3 = "DELETE FROM `product_report` WHERE `id` = '$id'";
$result3 = mysqli_query($conn, $sql3);
if ($result3) {
echo "Success_Accepted";
} else{
echo "Failed";
}
} else {
echo "Failed";
}
} else {
echo "ProductId";
}
} else if ($action == "reject") {
$sql1 = "SELECT * FROM `product_report` WHERE `id` = '$id'";
$result1 = mysqli_query($conn, $sql1);
if ($result1 && mysqli_num_rows($result1) > 0) {
$row1 = mysqli_fetch_array($result1);
$productid = $row1["productid"];
$product = $row1["product"];
$user = $row1["user"];
$seller = $row1["seller"];
$issue = $row1["issue"];
$statement = $row1["statement"];
// Get the current time in the Philippines
date_default_timezone_set('Asia/Manila');
$currentDateTime = date('Y-m-d H:i:s');
$date = date('Y-m-d', strtotime($currentDateTime));
$time = date('H:i:s', strtotime($currentDateTime));
$sql2 = "INSERT INTO `product_log`(`productid`, `event`, `reason`, `product`, `user`, `seller`, `issue`, `statement`, `date`, `time`)
VALUES ('$productid','rejected','$reason','$product','$user','$seller','$issue','$statement','$date','$time')";
$result2 = mysqli_query($conn, $sql2);
if ($result2) {
$sql3 = "DELETE FROM `product_report` WHERE `id` = '$id'";
$result3 = mysqli_query($conn, $sql3);
if ($result3) {
echo "Success_Accepted";
} else{
echo "Failed";
}
} else {
echo "Failed";
}
} else {
echo "ProductId";
}
} else {
}
} else {
}
?>