diff options
author | dirk <beliebige_email_adresse@fidocon.de> | 2011-11-22 22:38:58 +0100 |
---|---|---|
committer | dirk <beliebige_email_adresse@fidocon.de> | 2011-11-22 22:38:58 +0100 |
commit | e55a7160b06df554ca2c7ccd783474b916635ff0 (patch) | |
tree | 947cfbb770ca59ac09402970339a64abc5f49815 /scripts/send_thawte.php.txt | |
parent | 954f554feccb856f840680709812f43f5a0d83c9 (diff) | |
download | cacert-devel-e55a7160b06df554ca2c7ccd783474b916635ff0.tar.gz cacert-devel-e55a7160b06df554ca2c7ccd783474b916635ff0.tar.xz cacert-devel-e55a7160b06df554ca2c7ccd783474b916635ff0.zip |
bug827 script to send mails ... needs to be modified before start
Diffstat (limited to 'scripts/send_thawte.php.txt')
-rw-r--r-- | scripts/send_thawte.php.txt | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/scripts/send_thawte.php.txt b/scripts/send_thawte.php.txt new file mode 100644 index 0000000..f8042ac --- /dev/null +++ b/scripts/send_thawte.php.txt @@ -0,0 +1,85 @@ +#!/usr/bin/php -q +<? /* + LibreSSL - CAcert web application + Copyright (C) 2004-2009 CAcert Inc. + + 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. + + 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. + + 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 +*/ + include_once("../includes/mysql.php"); + +// english (use the same for foreign language, too) + + $lines_EN = ""; + if (file_exists("thawte_EN.txt")) + { + $fp = fopen("thawte_EN.txt", "r"); + while(!feof($fp)) + { + $line = trim(fgets($fp, 4096)); + $lines_EN .= wordwrap($line, 75, "\n")."\n"; + } + fclose($fp); + } + + $lines_DE = ""; + if (file_exists("thawte_DE.txt")) + { + $fp = fopen("thawte_DE.txt", "r"); + while(!feof($fp)) + { + $line = trim(fgets($fp, 4096)); + $lines_DE .= wordwrap($line, 75, "\n")."\n"; + } + fclose($fp); + } + +// read last used id + $lastid = 0; + if (file_exists("lastid.txt")) + { + $fp = fopen("lastid.txt", "r"); + $line = fgets($fp, 4096); + $lastid = wordwrap($line, 75, "\n")."\n"; + fclose($fp); + } + $subject = "Change in points calculation"; + + echo "ID now: $lastid"; + + $query = "select id,fromname,lastname,email* from users where deleted = 0 and id > $lastid order by id"; + + $res = mysql_query($query); + $xrows = mysql_num_rows($res); + + while($row = mysql_fetch_assoc($res)) + { + $mailtxt = "Hello ".$row["fromname"]." ".$row["lastname"]."\n".$lines_EN."\n\n"; + switch ($row[$language]) + { + case "de_DE": $mailtxt .= $lines_DE; break; + case "ade_DE": $mailtxt .= $lines_DE; break; + case "bde_DE": $mailtxt .= $lines_DE; break; + case "cde_DE": $mailtxt .= $lines_DE; break; + case "dde_DE": $mailtxt .= $lines_DE; break; + case "ede_DE": $mailtxt .= $lines_DE; break; + } + // uncomment next line to send mails ... +// sendmail($row['email'], "[CAcert.org] $subject", $mailtxt, "mailing@cacert.org", "", "", "CAcert", "returns@cacert.org", 1); + $fp = fopen("lastid.txt", "w"); + fputs($fp, $row["id"]."\n"); + fclose($fp); + sleep (1); + echo "Sent mail to: ".$row["id"]; + } +?> |