forked from dichter/pp-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pp.php
49 lines (35 loc) · 1.4 KB
/
pp.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
<?php
$sql = mysql_pconnect("localhost", "ahufler", "kxka29");
mysql_select_db("ahufler_cms3025",$sql);
function IPtoCountry($IP) {
global $sql;
$IP = IP2Long($IP);
$result = mysql_query("SELECT ip_short FROM ip2country WHERE ip_from <= ".$IP." AND ip_to >= ".$IP." LIMIT 0,1",$sql);
if(mysql_num_rows($result) == 0) {
$land = "PP";
}
else {
$row = mysql_fetch_object($result);
$land = $row->ip_short;
}
return $land;
}
if(!$_REQUEST['tp']) {
$_REQUEST['tp'] = "pp";
}
include("list.php");
$country = IPtoCountry($_SERVER['REMOTE_ADDR']);
$orig = $country;
if(!file_exists($_REQUEST['tp']."/".$country.".gif") || !$PP[$country]) {
$country = "PP";
}
if($_REQUEST['mod'] == 'uri') {
#mysql_query("INSERT INTO counter (country,refer,time,origin) VALUES('".$country."','".$_SERVER['HTTP_REFERER']."','".time()."','".$orig."')",$sql);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><title> PP </title></head><body onload='window.location=\"".$PP[$country]."\";'>you are being redirected: <a href='".$PP[$country]."'>".$PP[$country]."</a></body></html>";
}
if($_REQUEST['mod'] == 'img') {
#mysql_query("INSERT INTO views (country,refer,time,origin) VALUES('".$country."','".$_SERVER['HTTP_REFERER']."','".time()."','".$orig."')",$sql);
header("Content-type: image/gif");
echo file_get_contents($_REQUEST['tp']."/".$country.".gif");
}
?>