-
Notifications
You must be signed in to change notification settings - Fork 477
/
Copy pathindex.php
30 lines (25 loc) · 886 Bytes
/
index.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
<?php
if (!isset($_GET['mail']))
highlight_file(__FILE__) && exit();
$mail = filter_var($_GET['mail'], FILTER_VALIDATE_EMAIL);
$addr = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);
$country = geoip_country_code_by_name($addr);
if (!$addr || strlen($addr) == 0) die('bad addr');
if (!$mail || strlen($mail) == 0) die('bad mail');
if (!$country || strlen($country) == 0) die('bad country');
$yaml = <<<EOF
- echo # cmd
- $addr # address
- $country # country
- $mail # mail
EOF;
$arr = yaml_parse($yaml);
if (!$arr) die('bad yaml');
for ($i=0; $i < count($arr); $i++) {
if (!$arr[$i]) {
unset($arr[$i]);
continue;
}
$arr[$i] = escapeshellarg($arr[$i]);
}
system(implode(" ", $arr));