18 lines
578 B
PHP
Executable file
18 lines
578 B
PHP
Executable file
#!/usr/bin/php -q
|
|
<?
|
|
include_once("/home/cacert/www/includes/mysql.php");
|
|
|
|
mysql_query("update `locations` set `acount`=0");
|
|
|
|
$query = "SELECT `users`.`locid` AS `locid`, count(*) AS `total` FROM `users`, `notary`
|
|
WHERE `users`.`id` = `notary`.`to` AND `users`.`locid` != 0
|
|
GROUP BY `users`.`id`, `users`.`locid`
|
|
HAVING sum(`notary`.`points`) >= 100";
|
|
$res = mysql_query($query);
|
|
while($row = mysql_fetch_assoc($res))
|
|
{
|
|
$query = "update `locations` set `acount`='${row['total']}' where `id`='${row['locid']}'";
|
|
// echo $query."\n";
|
|
mysql_query($query);
|
|
}
|
|
?>
|