2006-08-15 23:42:59 +00:00
|
|
|
#!/usr/bin/php -q
|
|
|
|
<?
|
2006-11-23 22:22:31 +00:00
|
|
|
include_once("/home/cacert/www/includes/mysql.php");
|
2006-08-15 23:42:59 +00:00
|
|
|
|
2006-08-17 22:11:00 +00:00
|
|
|
mysql_query("update `locations` set `acount`=0");
|
|
|
|
|
2006-08-15 23:42:59 +00:00
|
|
|
$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']}'";
|
2006-08-17 22:11:00 +00:00
|
|
|
// echo $query."\n";
|
2006-08-15 23:42:59 +00:00
|
|
|
mysql_query($query);
|
|
|
|
}
|
|
|
|
?>
|