-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop_conn.php
45 lines (38 loc) · 1.08 KB
/
stop_conn.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
<?php
// Connect to database
$host = 'localhost';
$user = 'root';
$pass = '';
$conn_error = 'Could Not Connect';
$dbname = "trackme";
// Create connection
$conn = mysqli_connect($host, $user, $pass, $dbname);
$array = array();
// Check connection
if ($conn) {
//On connection
$guid = mysqli_real_escape_string($conn,$_GET["guid"]);
$query = "DELETE FROM users WHERE id='$guid'";
if (mysqli_query($conn, $query))
{
// 1 means successfully conected and the user can continue
$array['connection_status'] = '1';
}
else
{
//something unexpected happen
$array['connection_status'] = '2';
}
mysqli_close($conn);
} else{
//something unexpected happen
$array['connection_status'] = '2';
}
// output the results
if (isset($_GET["callback"])){
echo $_GET["callback"] . '(' . json_encode($array) . ')';
}
else{
echo json_encode($array);
}
?>