-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcall_log.php
More file actions
executable file
·86 lines (81 loc) · 2.68 KB
/
call_log.php
File metadata and controls
executable file
·86 lines (81 loc) · 2.68 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
<?php
require "conn.php";
$user_name = $_POST["user_name"];
$time=time();
$date=date("Y/m/d",$time);
$time=date("h:i:s",$time);
$choice= $_POST["choice"];
switch($choice){
case 1:
$from_user=$_POST["from_user"];
$from_user_name=$_POST["from_user_name"];
$mysqli_insert_qry="INSERT INTO call_log VALUES ('$user_name','$from_user','$from_user_name','$date','$time','false','false')";
$result=mysqli_query($conn,$mysqli_insert_qry);
if($result){
echo "Review Submitted";
}else{
echo "Review Submitted Failed";
}
mysqli_close($conn);
break;
case 2:
$status=$_POST['status'];
$from_user_name=$_POST['from_user_name'];
$date=$_POST['date'];
$time=$_POST['time'];
$mysqli_update_qry="UPDATE call_log SET status='true' WHERE user_name='$user_name' AND from_user_name='$from_user_name' AND date='$date' AND time='$time'";
$result=mysqli_query($conn,$mysqli_update_qry);
if($result){
echo "Review Submitted";
}else{
echo "Review Submitted Failed";
}
mysqli_close($conn);
break;
case 3:
$status=$_POST['status'];
$from_user_name=$_POST['from_user_name'];
$date=$_POST['date'];
$time=$_POST['time'];
$mysqli_update_qry="UPDATE call_log SET status='true',block_inc='true' WHERE user_name='$user_name' AND from_user_name='$from_user_name' AND date='$date' AND time='$time'";
$result1=mysqli_query($conn,$mysqli_update_qry);
$mysqli_update_qry="UPDATE user_auth SET block_count=block_count+1 WHERE user_name='$from_user_name'";
$result2=mysqli_query($conn,$mysqli_update_qry);
$mysqli_select_qry="SELECT * FROM user_auth WHERE user_name='$from_user_name'";
$result3=mysqli_query($conn,$mysqli_select_qry);
if($row=mysqli_fetch_assoc($result3)){
if($row['block_count']>2){
$mysqli_update_qry="UPDATE user_auth SET block_status='true' WHERE user_name='$from_user_name'";
$result4=mysqli_query($conn,$mysqli_update_qry);
}
}
if($result1 && $result2){
echo "Review Submitted";
}else{
echo "Review Submitted Failed";
}
mysqli_close($conn);
break;
case 4:
$mysqli_select_qry="SELECT * FROM call_log WHERE user_name='$user_name' AND status='false'";
$result=mysqli_query($conn,$mysqli_select_qry);
$output=null;
$count=0;
while($row=mysqli_fetch_assoc($result)){
$output[$count]=array(
'user_name'=>$row['user_name'],
'from_user'=>$row['from_user'],
'from_user_name'=>$row['from_user_name'],
'date'=>$row['date'],
'time'=>$row['time'],
'status'=>$row['status']
);
$count++;
}
echo json_encode($output);
mysqli_close($conn);
break;
default:
echo "ERROR, Default case occured in call_log.php";
}
?>