-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile_handler.php
More file actions
96 lines (71 loc) · 2.9 KB
/
profile_handler.php
File metadata and controls
96 lines (71 loc) · 2.9 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
<?php
session_start();
require_once("sql_connect.php");
if(!isset($_SESSION["user_id"])){
exit("Error!");
}
$ses1 = $_SESSION["user_id"];
if(isset($_POST["geolocate"])){
$sq3 = "SELECT * FROM linked where person1='{$_POST["geolocate"]}' AND person2='{$_SESSION["user_id"]}' OR person1='{$_SESSION["user_id"]}' AND person2='{$_POST["geolocate"]}'";
$resul3 = $conn->query($sq3);
$u3 = $resul3->fetch_assoc();
if(empty($u3["block_geolocate"])){
$sql2 = "UPDATE linked SET block_geolocate='{$_POST["geolocate"]}' WHERE person1='{$_POST["geolocate"]}' AND person2='{$_SESSION["user_id"]}' OR person1='{$_SESSION["user_id"]}' AND person2='{$_POST["geolocate"]}'";
if(mysqli_query($conn, $sql2)){
echo "ALLOW LOCATION ACCESS";
exit;
}else{
echo "TRY AGAIN!";
exit;
}
}else{
if($u3["block_geolocate"] == $_POST["geolocate"]){
$emty="";
$sql2 = "UPDATE linked SET block_geolocate='{$emty}' WHERE person1='{$_POST["geolocate"]}' AND person2='{$_SESSION["user_id"]}' OR person1='{$_SESSION["user_id"]}' AND person2='{$_POST["geolocate"]}'";
if(mysqli_query($conn, $sql2)){
echo "DISSALLOW LOCATION ACCESS";
exit;
}else{
echo "TRY AGAIN!";
exit;
}
}
}
}
if(isset($_POST["block"])){
$sq3 = "SELECT * FROM linked where person1='{$_POST["block"]}' AND person2='{$_SESSION["user_id"]}' OR person1='{$_SESSION["user_id"]}' AND person2='{$_POST["block"]}'";
$resul3 = $conn->query($sq3);
$u3 = $resul3->fetch_assoc();
if(empty($u3["blocked"])){
$sql2 = "UPDATE linked SET blocked='{$_POST["block"]}' WHERE person1='{$_POST["block"]}' AND person2='{$_SESSION["user_id"]}' OR person1='{$_SESSION["user_id"]}' AND person2='{$_POST["block"]}'";
if(mysqli_query($conn, $sql2)){
echo "UNBLOCK THIS PERSON";
exit;
}else{
echo "TRY AGAIN!";
exit;
}
}else{
if($u3["blocked"] == $_POST["block"]){
$emty="";
$sql2 = "UPDATE linked SET blocked='{$emty}' WHERE person1='{$_POST["block"]}' AND person2='{$_SESSION["user_id"]}' OR person1='{$_SESSION["user_id"]}' AND person2='{$_POST["block"]}'";
if(mysqli_query($conn, $sql2)){
echo "BLOCK THIS PERSON";
exit;
}else{
echo "TRY AGAIN!";
exit;
}
}
}
}
if(isset($_POST["clear"])){
$sql = "DELETE FROM messages WHERE sender='{$ses1}' AND reciever='{$_POST["clear"]}' OR sender='{$_POST["clear"]}' AND reciever='{$ses1}' ORDER BY id";
if ($conn->query($sql)) {
echo "HISTORY CLEARED";
exit;
}else{
echo "TRY AGAIN";
exit;
}
}