-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.test.php
59 lines (56 loc) · 1.63 KB
/
request.test.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
<?php
/************************************/
/* File Created By eSport Team */
/************************************/
$mysqli_ = new mysqli("localhost", "root", "XPApkV8w", "TS3-1");
$mysqli_->query("SET NAMES 'utf-8'");
$mysqli_->select_db("TS3-1");
$mysqli_->query("SET CHARACTER SET utf8");
function getRequests(){
global $mysqli_;
$files = array();
$result=$mysqli_->query("SELECT * FROM `Requests`");
while($request = mysqli_fetch_assoc($result)){
if($request["Result"] == ""){
array_push($files,$request["id"]);
}
}
return $files;
}
function readRequest($request){
global $mysqli_;
$result=$mysqli_->query("SELECT * FROM `Requests` WHERE id=$request");
$res = mysqli_fetch_row($result);
return $res[1];
}
function readResult($request){
global $mysqli_;
$result=$mysqli_->query("SELECT * FROM `Requests` WHERE id=$request");
$res = mysqli_fetch_row($result);
$result_ = $res[2];
mysqli_query($mysqli_,"DELETE FROM Requests WHERE id=" . $res[0] . "");
return $result_;
}
function createRequest($code){
global $mysqli_;
mysqli_query($mysqli_,'INSERT INTO `Requests`(`Request`, `Result`) VALUES ("'.$code.'","")');
return mysqli_insert_id($mysqli_);
}
function createResult($request,$code){
global $mysqli_;
return mysqli_query($mysqli_,"UPDATE Requests SET Result='$code' WHERE id=$request");
}
function clearRequest(){
global $mysqli_;
return mysqli_query($mysqli_,"DELETE FROM Requests");
}
function waitForResult($id){
global $mysqli_;
$result=$mysqli_->query("SELECT * FROM `Requests` WHERE id=$id");
$res = mysqli_fetch_row($result);
if($res[2] == ""){
return false;
}
return true;
}
?>