-
Notifications
You must be signed in to change notification settings - Fork 0
/
fat.php
67 lines (63 loc) · 1.82 KB
/
fat.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
60
61
62
63
64
65
66
67
<?php
# https://github.com/mrbid/FractalAttackOnline
if(!isset($_GET['u']) || !isset($_GET['r']))
{
//echo "uid (u) or game-id (r) not provided";
header("HTTP/1.1 200 OK");
exit;
}
$_GET['u'] = intval($_GET['u']);
$_GET['r'] = intval($_GET['r']);
if(isset($_GET['p']))
{
if(file_exists($_GET['r'] . "/" . $_GET['u']) == false)
{
//echo "not registered";
header("HTTP/1.1 200 OK");
exit;
}
if(array_sum(count_chars($_GET['p'])) != 12)
{
//echo "wrong size";
header("HTTP/1.1 200 OK");
exit;
}
file_put_contents($_GET['r'] . "/" . $_GET['u'], $_GET['p'], LOCK_EX);
$ar = glob($_GET['r'] . '/*');
foreach($ar as $k)
{
if(basename($k) == $_GET['u']){continue;}
echo file_get_contents($k);
}
exit;
}
else if(isset($_GET['r']))
{
if(time() > $_GET['r'])
{
//echo "registration rejected: time period expired";
header("HTTP/1.1 200 OK");
exit;
}
if(is_dir($_GET['r']) == true)
{
$ar = glob($_GET['r'] . '/*');
if(count($ar) >= 32)
{
//echo "registration rejected: max players reached";
header("HTTP/1.1 200 OK");
exit;
}
}
if(file_exists($_GET['r'] . "/" . $_GET['u']) == true)
{
//echo "registration rejected: already registered";
header("HTTP/1.1 200 OK");
exit;
}
mkdir($_GET['r']);
file_put_contents($_GET['r'] . "/" . $_GET['u'], "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", LOCK_EX);
header("HTTP/1.1 200 OK");
exit;
}
?>