forked from AyatsujiTsukasa/Ant-Planner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
refuse.php
28 lines (23 loc) · 873 Bytes
/
refuse.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
<?php
$servername = "localhost";
$name = "antinc";
$password = "AntInc_AntInc123";
$dbname = "Ant_Planner";
$conn = mysqli_connect($servername, $name, $password, $dbname);
if (!$conn) {
die("Connection failed: ".mysqli_connect_error());
}
if(!$_GET) {
die("This file cannot be accessed directly!");
}
$id = $_GET["id"];
$password = $_GET["password"];
$friendName = $_GET["friendName"];
$verificationPW = "select password from Users where id='".$id."'";
$pw = mysqli_fetch_array($conn->query($verificationPW))["password"];
if($pw === $password){
$friendId = mysqli_fetch_array($conn->query("select id from Users where username='".$friendName."'"))['id'];
$conn->query("delete from Requests where Requests.from='".$friendId."' and Requests.to='".$id."'");
$conn->query("delete from Requests where Requests.from='".$id."' and Requests.to='".$friendId."'");
}
?>