<?
include ("func/oper.php");
include ("func/ini.php");
$qi = mysql_query("select * from `uzvers` where `id`='$id' limit 1;");
$row=mysql_fetch_array($qi);
if ($mes!=$row['mes'])
{
mysql_query("UPDATE `uzvers` SET `d1`='',`d2`='',`d3`='',`d4`='',`d5`='',`d6`='',`d7`='',`d8`='',`d9`='',`d10`='',`d11`='',`d12`='',`d13`='',`d14`='',`d15`='',`d16`='',`d17`='',`d18`='',`d19`='',`d20`='',`d21`='',`d22`='',`d23`='',`d24`='',`d25`='',`d26`='',`d27`='',`d28`='',`d29`='',`d30`='',`d31`='',`mes`='$mes';");
}
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['allmonth']*$partproc/100;
$all=$all+$part;
}
mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`+`all`+'$all' where `id`='$id_db';");
mysql_query("UPDATE `uzvers` SET `d$den`=`all` where `id`='$id_db';");
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',`all`='0',`data`='$date_db' where `id`='$id_db';");
}
}
$qi = mysql_query("select * from `uzvers` where `id`='$id' 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))
{
$all=$cena[$oper]/$c;
mysql_query("UPDATE `uzvers` SET `$oper`=`$oper`+'1',`ip1`=`ip2`,`ip2`=`ip3`,`ip3`=`ip4`,`ip4`=`ip5`,`ip5`='$ip' WHERE `id`='$id';");
for ($i=1;$i<32;$i++)
{
$oper=$i;
include ("func/spop.php");
if ($otk[$i]!=0)
{
$host=$row[$i];
if ($shaif==1)
{
$min=$host*$shaifproc/100;
$host=$host-$min;
$host=ceil($host);
}
$cost=$host*($cena[$i]/1000);
}
$allcost=$allcost+$cost;
}
mysql_query("UPDATE `uzvers` SET `all`='$allcost' where `id`='$id' limit 1;");
header("Location: http://wap.sasisa.ru");
}
else
{
header("Location: http://wap.sasisa.ru");
}
}
else
{
header("Location: http://wap.sasisa.ru");
}
?>