cacert-webdb/scripts/notify.php

43 lines
2 KiB
PHP
Raw Normal View History

2007-02-07 15:46:49 +00:00
#!/usr/bin/php -q
<? /*
2008-04-06 19:45:09 +00:00
LibreSSL - CAcert web application
Copyright (C) 2004-2008 CAcert Inc.
2007-02-07 15:46:49 +00:00
2008-04-06 19:45:09 +00:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
2007-02-07 15:46:49 +00:00
2008-04-06 19:45:09 +00:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2007-02-07 15:46:49 +00:00
2008-04-06 19:45:09 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2007-02-07 15:46:49 +00:00
*/
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");
}
?>