Файл: Competitions/CronComp1224.php
Строк: 17
<?
require_once 'inc/start_sess.php';
$time=time();
$q=mysql_query("SELECT * FROM `kolhoz_user` ORDER BY `comp`");
$num=0;
while($post=mysql_fetch_array($q))
{
$num++;
if($num==1)$prize=200;elseif($num==2)$prize=100;elseif($num==3)$prize=50;else $prize=0;
mysql_query("UPDATE `kolhoz_user` SET `euro` = `euro` + '$prize' WHERE `id` = '$post[id]'");
if($num<4)mysql_query("INSERT INTO `kolhoz_mail` SET `id_user` = '$post[id]', `id_kont` = '171', `msg` = 'Вы получили награду за соревнование: $prize евро. Место: $num', `time` = '$time', `type` = 'to'");
}
mysql_query("UPDATE `kolhoz_user` SET `comp` = '0'");
$q=mysql_query("SELECT * FROM `kolhoz_collective` ORDER BY `comp`");
$num=0;
while($post=mysql_fetch_array($q))
{
$num++;
if($num==1)$prize=200000;elseif($num==2)$prize=100000;elseif($num==3)$prize=50000;else $prize=0;
if($num==1)$medal=1;else $prize=0;
mysql_query("UPDATE `kolhoz_collective` SET `rubies` = `rubies` + '$prize' WHERE `id` = '$post[id]'");
mysql_query("UPDATE `kolhoz_collective` SET `medal` = `medal` + '$medal' WHERE `id` = '$post[id]'");
}
mysql_query("UPDATE `kolhoz_collective` SET `comp` = '0'");
?>