Файл: Angel-vs-Demon/Cron.php
Строк: 23
<?
require_once '.../inc/start_sess.php';
mysql_query("UPDATE `Grey_angel-vs-demon` SET `golos` = '0'");
$angel=''.mysql_result(mysql_query("SELECT SUM(golos) FROM `Grey_angel-vs-devil` WHERE `storona` = '1'"), 0).'';
$demon=''.mysql_result(mysql_query("SELECT SUM(golos) FROM `Grey_angel-vs-devil` WHERE `storona` = '2'"), 0).'';
if($demon>$angel)
{
$x=mysql_query("SELECT * FROM `Grey_angel-vs-demon` WHERE `storona` = '2'");
while($ku=mysql_fetch_array($x)){
$time=time();
mysql_query("UPDATE `kolhoz_user` SET `dolars` = `dolars` + '50' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `kolhoz_mail` SET `id_user` = '$ku[id]', `id_kont` = '171', `msg` = 'Вы получили 50 долларов за победу демонов!.', `time` = '$time', `type` = 'to'");
}
}
if($angel>$demon)
{
$x=mysql_query("SELECT * FROM `Grey_angel-vs-demon` WHERE `storona` = '1'");
while($ku=mysql_fetch_array($x)){
$time=time();
mysql_query("UPDATE `kolhoz_user` SET `dolars` = `dolars` + '50' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `kolhoz_mail` SET `id_user` = '$ku[id]', `id_kont` = '171', `msg` = 'Вы получили 50 долларов за победу ангелов!.', `time` = '$time', `type` = 'to'");
}
}
?>