cacert-webdb/scripts/notify.php

40 lines
1.8 KiB
PHP
Raw Normal View History

2007-02-07 15:46:49 +00:00
#!/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");
$query = "select `users`.`fname` as `fname`, `email`.`id` as `id`, `email`.`email` as `email` from `users`,`email`
where `users`.`verified`=0 and
(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`users`.`created`)) >= 300 and
`users`.`id`=`email`.`memid` and `users`.`email`=`email`.`email`";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
$rnd = fopen("/dev/urandom", "r");
$hash = md5(fgets($rnd, 64));
fclose($rnd);
mysql_query("update `email` set `hash`='$hash' where `id`='".$row['id']."'");
$body = "Hi ".$row['fname']."\n\n";
$body .= "Due to some bugs with the new website we initially had issues with emails being sent out. This email is being sent to those effected so they can be re-sent their email probe to over come earlier issues. We apologise for any inconvenience this may have cause. To verify your account, simply click on the link below.\n\n";
$body .= "http://www.cacert.org/verify.php?type=email&emailid=".$row['id']."&hash=$hash\n\n";
$body .= "Best Regards\nCAcert Support Team";
echo $row['email']."\n";
sendmail($row['email'], "[CAcert.org] Email Probe", $body, "support@cacert.org", "", "", "CAcert Support");
}
?>