-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstop.php
More file actions
73 lines (57 loc) · 2.32 KB
/
Copy pathstop.php
File metadata and controls
73 lines (57 loc) · 2.32 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
<?php
include 'includes/configuration.php';
$user = $_GET['user'];
$api_key = $_GET['api_key'];
$host = $_GET['stopper'];
$SQLCheck = $odb -> prepare("SELECT COUNT(*) FROM `apiplus` WHERE `apikey` = :key AND `user` = :user");
$SQLCheck -> execute(array(':key' => $api_key, ':user' => $user));
$countClef = $SQLCheck -> fetchColumn(0);
if ($countClef == 0)
{
echo'Your Key or your User ID is invalid .';
exit();
} else {
$SQLGetInfo = $odb -> prepare("SELECT * FROM `users` WHERE `ID` = :id");
$SQLGetInfo -> execute(array(':id' => $user));
$userInf = $SQLGetInfo -> fetch(PDO::FETCH_ASSOC);
$utilisateur = $userInf['username'];
$IDacc = $userInf['ID'];
$concu = $userInf['concu'];
$SQLGetIn = $odb -> prepare('SELECT * FROM `apiplus` WHERE `apikey` = :key');
$SQLGetIn -> execute(array(':key' => $api_key));
$userIn = $SQLGetIn -> fetch(PDO::FETCH_ASSOC);
$userIP = $userIn['ip'];
$usertimeapi = $userIn['timeapi'];
//if ($userIP != $_SERVER["REMOTE_ADDR"]){
//echo'Your iP address is not authorized to use this API.';
//exit();
//} else {
if (empty($user) || empty($api_key) || empty($host))
{
echo 'Please verify all fields. Try: stop?user=IDuser&api_key=key&host=1.1.1.1';
}
else
{
$SQL = $odb -> prepare("SELECT * FROM `logs` WHERE `id` = :id AND `user` = :user AND `time` + `date` < UNIX_TIMESTAMP()");
$SQL -> execute(array(':user' => $utilisateur, ':id' => $id));
$result = $SQL -> fetchColumn(0);
if ($result != 0)
{
echo 'This shipment is already complete.';
} else {
$SQLSelect = $odb -> prepare("SELECT * FROM `serveurs` WHERE `ID` = :id");
$SQLSelect -> execute(array(':id' => $serveur));
while ($show = $SQLSelect -> fetch(PDO::FETCH_ASSOC))
{
$adresse = $show['adresse'];
ini_set('default_socket_timeout', 1);
$adresse = str_replace("%hote%", $IP, $adresse);
$adresse = str_replace("%temps%", "60", $adresse);
$adresse = str_replace("%port%", "80", $adresse);
$adresse = str_replace("%type%", "STOP", $adresse);
$adresse = str_replace("%user%", $utilisateur, $adresse);
APIinit($adresse, $odb);
}
$SQLUpdate = $odb -> prepare("UPDATE `logs` SET `time` = 0 WHERE `user` = :user AND `id` = :id AND `time` + `date` > UNIX_TIMESTAMP()");
$SQLUpdate -> execute(array(':user' => $utilisateur, ':id' => $id));
}}}