View file lets_friends/user/lets_friends/cron.php

File size: 1.27Kb
<?
/*

 * Автор скрипта Ak47res1
 * Все права только у Ak47res1
 * Скрипт платный
 * ICQ 646099815
	
*/

include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';


$lets_Q = mysql_query("SELECT * FROM `lets_friends_user` WHERE `point` > '0' AND `bucks` > '0' ORDER BY `point` DESC LIMIT 1");

while ($lets_X = mysql_fetch_array($lets_Q))
{
$lets_p = $lets_X['point'] / 4;
mysql_query("UPDATE `lets_friends_user` SET `point` = '".($lets_X['point']-$lets_p)."', `bucks` = '".($lets_X['bucks']+10000)."' WHERE `id_user` = '$lets_X[id_user]' LIMIT 1");

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `lets_friends_list` WHERE `id_user` = '$lets_X[id_user]'"), 0)==0)
{
mysql_query("INSERT INTO `lets_friends_list` (`id_user`, `time`, `ptime`) values('$lets_X[id_user]', '$time', '".($time+14400)."')");
}else{
mysql_query("UPDATE `lets_friends_list` SET `time` = '$time', `ptime` = '".($time+14400)."' WHERE `id_user` = '$lets_X[id_user]'");
}
}
?>