-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanaging_report_confirm.php
118 lines (72 loc) · 3.28 KB
/
managing_report_confirm.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
session_start();
if (isset($_GET['uid'])) {
$uid = $_GET['uid'];
$rid = $_GET['rid'];
$dbhost = "localhost";
$dbuser = "root";
$dbpassword = "";
$dbname = "ewed";
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
//user data
// $query = "SELECT report from status where cid = $rid";
// $result = mysqli_query($con, $query);
// if (mysqli_num_rows($result) > 0) {
// echo mysqli_num_rows($result);
// echo "set";
// $data = mysqli_fetch_array($result);
// echo $data['report'];
// }else{
// echo mysqli_num_rows($result);
// }
$query = "SELECT * from tbl_report where cid = $uid and r_id = $rid and status = 1";
$result = mysqli_query($con, $query);
// does user exist
if (mysqli_num_rows($result) > 0) {
echo mysqli_num_rows($result);
echo "user exist";
header("Location: managing_reports.php");
} else {
echo mysqli_num_rows($result);
echo "\ user not exist /";
echo " uid : " . $uid;
echo "\ rid : " . $rid;
$query_first_time_user = "SELECT * from tbl_report where cid = $uid and r_id = $rid and status = 0";
$result_first_time_user = mysqli_query($con, $query_first_time_user);
if (mysqli_num_rows($result_first_time_user) > 0) {
echo " / data /";
// get status value
$query_status_value = "SELECT report from status where cid = $rid";
$result_query_status_value = mysqli_query($con, $query_status_value);
$data_result_query_status_value = mysqli_fetch_array($result_query_status_value);
echo $data_result_query_status_value['report'];
$data1 = $data_result_query_status_value['report'];
$data1 = $data1 + 1;
echo " = " . $data1;
// update
$query1 = "UPDATE status SET report = $data1 WHERE cid = $rid ";
$query2 = "UPDATE tbl_report SET status = 1 WHERE cid = $uid and r_id = $rid ";
$result2 = mysqli_query($con, $query2);
if ($result2) {
$result1 = mysqli_query($con, $query1);
if ($result1) {
$query_status_value = "SELECT report from status where cid = $rid";
$result_query_status_value = mysqli_query($con, $query_status_value);
$data_result_query_status_value = mysqli_fetch_array($result_query_status_value);
echo $data_result_query_status_value['report'];
$data1 = $data_result_query_status_value['report'];
echo " = " . $data1;
if ($data1 >= 10) {
$query = "UPDATE status SET profilestatus = 4 WHERE cid = $rid ";
$result = mysqli_query($con, $query);
if ($result) {
}
}
echo "data updated";
header("Location: managing_reports.php");
}
}
}
}
}
// header("Location: managing_reports.php");