cacert-webdb/scripts/areacheck.php
2008-03-14 14:07:22 +00:00

61 lines
2.2 KiB
PHP
Executable file

#!/usr/bin/php -q
<? /*
Copyright (C) 2004 by Duane Groth <duane_at_CAcert_dot_org>
This file is part of CAcert.
CAcert has been released under a CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address:
http://www.cacert.org/src-lic.php
CAcert is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the License for more details.
*/
include_once("../includes/mysql.php");
$sendmail = 0;
$locid = 2189758;
$fp = fopen("email.txt", "r");
while(!feof($fp))
{
$line = trim(fgets($fp, 4096));
$lines .= wordwrap($line, 75, "\n")."\n";
}
fclose($fp);
$query = "select * from `locations` where `id`='$locid'";
$loc = mysql_fetch_assoc(mysql_query($query));
$query = "select * from `locations` where (`lat` > ".$loc['lat']."-10 and `lat`<".$loc['lat']."+10 and
`long`>".$loc['long']."-10 and `long`<".$loc['long']."+10) or `regid`=4576";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
$query = "select * from `users` where `id`='1'";
$query = "select * from `users`,`alerts` where `users`.`locid`='".$row['id']."' and `users`.`id`=`alerts`.`memid` and
(`general`='1' or `country`='1' or `regional`='1' or `radius`='1')";
$dres = mysql_query($query);
if(mysql_num_rows($dres) > 0)
{
$ddres = mysql_query("select * from `regions` where `id`='$row[regid]'");
$ddrow = mysql_fetch_assoc($ddres);
echo "Location: ".$row['name'].", $ddrow[name]\n";
}
while($user = mysql_fetch_assoc($dres))
{
$ddres = mysql_query("select sum(`points`) as `tp` from `notary` where `to`='".$user['id']."'");
$ddrow = mysql_fetch_assoc($ddres);
echo $user['fname']." ".$user['lname']." (".$user['email'].") - ".$user['radius']."/$ddrow[tp]\n";
if($sendmail == 1)
{
echo "Mail sent!\n";
$body = "Hi ".$user['fname'].",\n\n".$lines;
sendmail($user['email'], "[CAcert.org] CAcert Assurers at Ohio Linux Festival", $body, "duane@cacert.org", "", "", "CAcert Team");
}
}
}
?>