1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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"];
}
?>
|