Файл: in.php
Строк: 148
<?
error_reporting (0);
$vse = file('data/id.dat');
$countbase = trim(array_pop($vse));
if(is_numeric($_GET['id']) && $_GET['id']<=$countbase){ $id = $_GET['id']; }else{
header('Location: index.php'); exit;}
$q=file('data/base/'.$id.'.winnt');
if(empty($q)||$q==''){ header('Location: index.php'); exit; }
if(empty($_GET['p']) || $_GET['p']=='')
{
$mob=getenv('HTTP_USER_AGENT');
$mob=strtok($mob, '/');
if(getenv('HTTP_X_FORWARDED_FOR')){$ip=getenv('HTTP_X_FORWARDED_FOR');}else{$ip=getenv('REMOTE_ADDR');}
$mob = trim(htmlspecialchars($mob));
$ip = trim(htmlspecialchars($ip));
if($mob=='Opera'){ $ip='100.100.100.100'; }
if($mob=='Mozilla'){ header('Location: index.php'); exit; }
if($mob=='MSIE'){ header('Location: index.php'); exit; }
session_id(md5(microtime()*rand()));
@session_start();
$_SESSION['pr'] = md5($ip.$mob);
header('Cache-control: no-cache, no-store');
header("Content-type:text/vnd.wap.wml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml>
<card id="c1" title="GO" ontimer="in.php?id='.$id.'&p='.(session_id()).'"><timer value="10"/>
<p align="left"><small><a href="in.php?id='.$id.'&p='.(session_id()).'">Жми сюда</a></small><br/></p>
</card></wml>';
exit; }
else
{
$p = trim(htmlspecialchars($_GET['p']));
session_id($p);
session_start();
$data = date("dmy");
$mob=getenv('HTTP_USER_AGENT');
$mob=strtok($mob, '/');
if(getenv('HTTP_X_FORWARDED_FOR')){$ip=getenv('HTTP_X_FORWARDED_FOR');}else{$ip=getenv('REMOTE_ADDR');}
$mob = trim(htmlspecialchars($mob));
$ip = trim(htmlspecialchars($ip));
if($mob=='Opera'){ $ip='100.100.100.100'; }
if($_SESSION['pr']==(md5($ip.$mob)))
{
list($ipa[0],$ipa[1],$ipa[2])=explode('.', $ip);
$ip=$ipa[0].'.'.$ipa[1].'.'.$ipa[2];
/////// ban /////////
require_once ('apanel/ban');
/////// END ban /////
$mob_ip = file('data/mob/'.$id.'.winnt');
if(empty($mob_ip)){
$new_base = fopen('data/mob/'.$id.'.winnt', 'w');
fputs($new_base, $data."n");
fclose($new_base); chmod('data/mob/'.$id.'.winnt', 0777);
$mob_ip = file('data/mob/'.$id.'.winnt'); }
if(trim($mob_ip[0])!=$data){
$new_base = fopen('data/mob/'.$id.'.winnt', 'w');
fputs($new_base, $data."n");
fclose($new_base); chmod('data/mob/'.$id.'.winnt', 0777);
$mob_ip = file('data/mob/'.$id.'.winnt'); }
for($i=0; $i<(count($mob_ip)); $i++){ $mob_ip[$i] = trim($mob_ip[$i]); }
if(in_array($mob.':win:'.$ip, $mob_ip)){ header('Location: index.php'); exit; }
else{
$new_base = fopen('data/mob/'.$id.'.winnt', 'a');
fputs($new_base, $mob.':win:'.$ip."n");
fclose($new_base);
$stat=file('data/stat/'.$id.'.winnt');
///////////////////////////////////////////////////////////////////////////////////
$wd=date("w"); // день недели
$d_r=date("ymd")-$wd;
if($d_r == (int)$stat[9])
{$inweek=(int)$stat[5]+1;
$outweek=(int)$stat[6];}
else
{$inweek='1';
$outweek='0';}
///////////////////////////////////////////////////////////////////////////////////
if($stat[0][2].$stat[0][3] != $data[2].$data[3])
{$inmonth='1';
$outmonth='0';}
else
{$inmonth=(int)$stat[7]+1;
$outmonth=(int)$stat[8];}
///////////////////////////////////////////////////////////////////////////////////
if(trim($stat[0])!=$data){
$new_base = fopen('data/stat/'.$id.'.winnt', 'w');
fputs($new_base, "$datan1n0n".(trim($stat[3])+1)."n".(trim($stat[4]))."n".$inweek."n".$outweek."n".$inmonth."n".$outmonth."n".$d_r."n");
fclose($new_base); chmod('data/stat/'.$id.'.winnt', 0777); }
else{
$new_base = fopen('data/stat/'.$id.'.winnt', 'w');
fputs($new_base, "$datan".(trim($stat[1])+1)."n".(trim($stat[2]))."n".(trim($stat[3])+1)."n".(trim($stat[4]))."n".$inweek."n".$outweek."n".$inmonth."n".$outmonth."n".$d_r."n");
fclose($new_base); chmod('data/stat/'.$id.'.winnt', 0777);
}
}
}
session_unset();
header('Location: index.php');
}
?>