Просмотр файла click.php

Размер файла: 5.57Kb
<?php
$id = str_replace('.', '', $id);
$id = str_replace('/', '', $id);
$id = stripslashes($id);
include ("func/oper.php");
include ("func/ini.php");
ignore_user_abort();

if (!ctype_digit($id)) { // Secur. Check
$sayt="http://anwap.net/clicks/go.php?id=11";
include ("sas.php");
exit();
}

//logs
$ref=getenv("HTTP_REFERER");
if(!empty($ref))
{
$agent = htmlspecialchars(trim(stripslashes($HTTP_USER_AGENT)),ENT_QUOTES);
$fp = fopen ("logs/".$id.".log", "a+");
if ($oper==0) $oper_name="НЕ МОБИЛА!";
fwrite ($fp, $date." || ".$agent." || ".$ip." || ".$oper_name." || ".$ref."\n");
fclose ($fp);
}
else
{
$sayt="http://anwap.net/clicks/go.php?id=11";
include "sas.php";
exit;
}
///////antinakrut/////////
$b = file("autoban.dat");
$ba = $b[0];
$ba = trim($ba);
$ba = str_replace("\r\n", "", $ba);
$d = @opendir("tmp/$id");
$f = mkdir("tmp/$id", 0777);
if(!$d)
{
if($f)
{
if(file_exists("tmp/$id/lastip.txt"))
{
}
else
{
$fopen = fopen("tmp/$id/lastip.txt", "w+");
fputs($fopen, "$ip\r\n");
fclose($fopen);
chmod("tmp/$id/lastip.txt", 0777);
}
} 
}
else
{
if(file_exists("tmp/$id/lastip.txt"))
{
$file = file("tmp/$id/lastip.txt");
$cnt = count($file);
if($cnt==3)
{
$fopen = fopen("tmp/$id/lastip.txt", "w+");
fputs($fopen, "$file[1]$file[2]$ip\r\n");
fclose($fopen);
chmod("tmp/$id/lastip.txt", 0777);
}
else
{
if($cnt<3)
{
$fopen = fopen("tmp/$id/lastip.txt", "a+");
fputs($fopen, "$ip\r\n");
fclose($fopen);
chmod("tmp/$id/lastip.txt", 0777);
}
}
}
}
if(file_exists("tmp/$id/lastip.txt"))
{
$array = array();
$file = file("tmp/$id/lastip.txt");
$cnt = count($file);
if(trim($file[0])==$ip && trim($file[1])==$ip && trim($file[2])==$ip)
{
$banned=1;
if($ba==1)
{
}
else
{
include "sas.php";
exit;
}}}
if($banned==1)
{
@mysql_query("UPDATE `uzvers` SET `ban`='1' where `id`='$id'");
include "banned.php";
exit;
}

// End
$qi = mysql_query("select * from `uzvers` order by id desc;");
$row=mysql_fetch_array($qi);


if ($date_db!=$row['data'])
{
$qi = mysql_query("select * from `uzvers`;");
while($row=mysql_fetch_array($qi))
{
$id_db=$row['id'];
$q = mysql_query("select * from `uzvers` where `partid`='$id_db';");
while($r=mysql_fetch_array($q))
{
$part=$r['all']*$partproc/100;
$all=$all+$part;
}
mysql_query("UPDATE `uzvers` SET `d$v4era`=`all` where `id`='$id_db';");
mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`+`all`+'$all' where `id`='$id_db';");
$all=0;
mysql_query("UPDATE `uzvers` SET `1`='0',`2`='0',`3`='0',`4`='0',`5`='0',`6`='0',`7`='0',`8`='0',`9`='0',`10`='0',`11`='0',`12`='0',`13`='0',`14`='0',`15`='0',`16`='0',`17`='0',`18`='0',`19`='0',`20`='0',`21`='0',`22`='0',`23`='0',`24`='0',`25`='0',`26`='0',`27`='0',`28`='0',`29`='0',`30`='0',`31`='0',`32`='0',`all`='0',`data`='$date_db'  where `id`='$id_db';");
}
mysql_query("UPDATE `clients` SET `balans`=`balans`-`today`;");
mysql_query("UPDATE `clients` SET `d$v4era`=`today`;");
mysql_query("UPDATE `clients` SET `1`='0',`2`='0',`3`='0',`4`='0',`5`='0',`6`='0',`7`='0',`8`='0',`9`='0',`10`='0',`11`='0',`12`='0',`13`='0',`14`='0',`15`='0',`16`='0',`17`='0',`18`='0',`19`='0',`20`='0',`21`='0',`22`='0',`23`='0',`24`='0',`25`='0',`26`='0',`27`='0',`28`='0',`29`='0',`30`='0',`31`='0',`32`='0',`today`='0',`data`='$date_db';");
}
$qi = mysql_query("select * from `uzvers` where ((`id`='$id')and(`ban`!='1')) limit 1;");
$row=mysql_fetch_array($qi);
//$ip="127.0.0.".rand(1,255)."";
       if (mysql_affected_rows()!=0)
       {
           if (($row['ip1']!=$ip)&&($row['ip2']!=$ip)&&($row['ip3']!=$ip)&&($row['ip4']!=$ip)&&($row['ip5']!=$ip))
           {

$fp = fopen ("shaiv.dat", "r");
$bytes = 4;
$i = fread($fp, $bytes);
fclose ($fp);
$p=$shaifproc/10;
$i++;
$fp = fopen ("shaiv.dat", "w+");
fwrite ($fp, "$i");
fclose ($fp);
if ($i==10) {
$fp = fopen ("shaiv.dat", "w+");
fwrite ($fp, "0");
fclose ($fp);
}
if ($shaif==1&&$i<=$p)
{
$sayt="http://anwap.net/clicks/go.php?id=11"; include ("sas.php");exit();
}
else
{
include ("func/stat.php");
           if ($otk[$oper]!=0)
{
           $all=$cena[$oper]/$c;
           mysql_query("UPDATE `uzvers` SET `$oper`=`$oper`+'1',`ip1`=`ip2`,`ip2`=`ip3`,`ip3`=`ip4`,`ip4`=`ip5`,`ip5`='$ip',`all`=`all`+'$all' WHERE `id`='$id';");
}
}


if ($oper!=0)
{
$fp = fopen ("count.dat", "r");
$bytes = 4;
$i = fread($fp, $bytes);
fclose ($fp);
$p=$proctrade/10;
$i++;
$fp = fopen ("count.dat", "w+");
fwrite ($fp, "$i");
fclose ($fp);
if ($i==10) {
$fp = fopen ("count.dat", "w+");
fwrite ($fp, "0");
fclose ($fp);
}
if ($oper==33)
  {
$sayt="http://opera-clicks.wt2.ru"; include ("sas.php");exit();
   }
else
{
if ($i<=$p)
{
$sayt="http://anwap.net/clicks/go.php?id=11"; include ("sas.php");exit();
}

else
{
//clients
$qi = mysql_query("select * from `clients` where `balans`>'0' order by rand() limit 1;");
$row=mysql_fetch_array($qi);
$all=ceil($cena[$oper]*15/100)/$c;
mysql_query("UPDATE `clients` SET `$oper`=`$oper`+'1',`today`=`today`+'$all' where `id`='".$row['id']."' limit 1;");
mysql_query("UPDATE `clients` SET `balans`=`balans`-'$all' where `id`='".$row['id']."' limit 1;");
//header("Location: ".$row['site']."");
$sayt="http://anwap.net/clicks/go.php?id=11"; include ("sas.php");exit();
}
}
}
else
{
$sayt="http://anwap.net/clicks/go.php?id=11"; include ("sas.php");exit();
}


           }
           else
           {
           $sayt="http://anwap.net/clicks/go.php?id=11"; include ("sas.php");exit();
           }
       }
       else
       {
       $sayt="http://anwap.net/clicks/go.php?id=11"; include ("sas.php");exit();
       }
?>