-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathbobo.php
52 lines (42 loc) · 1.05 KB
/
bobo.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
<?php
$db = "botIPs.txt";
$addr = $_SERVER["REMOTE_ADDR"];
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
if(isset($_GET['getaddr'])){
header('Content-type: text/json; charset=utf-8');
if (isset($_COOKIE['bobo'])){
echo 'var returnCitySN = {"cip": "'.$addr.'", "bobo":"111111"};';
}
else{
echo 'var returnCitySN = {"cip": "'.$addr.'", "bobo": "000000"};';
}
}
if(isset($_GET['bobo'])){
setcookie("bobo","bobo", time()+3600*240);
}
if(isset($_GET['ip'])){
$botIP = @$_GET['ip'];
$line = file_get_contents($db);
$botIPs = explode("\n", $line);
if (@in_array(base64_encode($botIP), $botIPs)) {
echo "ip exist";
}else {
$bots = fopen($db, "a") or die("Unable to open bots file!");
fwrite($bots, base64_encode($botIP) . "\n");
fclose($bots);
}
}
if(isset($_GET['search'])){
$ip = @$_GET['search'];
if (file_exists($db)) {
$line = file_get_contents($db);
$botIPs = explode("\n", $line);
if (@in_array(base64_encode($ip), $botIPs)) {
echo "in";
}else {
echo "bobo";
}
}
}
?>