Source code taken from cacert-20140419.tar.bz2
[cacert.git] / scripts / newslettercebit.php
1 #!/usr/bin/php -q
2 <? /*
3 LibreSSL - CAcert web application
4 Copyright (C) 2004-2008 CAcert Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 include_once("../includes/mysql.php");
20
21 $lines = "";
22 $fp = fopen("cebitemail.txt", "r");
23 while(!feof($fp))
24 {
25 $line = trim(fgets($fp, 4096));
26 $lines .= wordwrap($line, 75, "\n")."\n";
27 }
28 fclose($fp);
29
30 $query = "select * from `users` where `id`='1'";
31 $query = "select * from `locations` where `id`='718475'";
32 $loc = mysql_fetch_assoc(mysql_query($query));
33 $query = "select `users`.* from `users`,`alerts`,`locations` where
34 ((`lat` > ".$loc['lat']."-5 and `lat`<".$loc['lat']."+5 and `long`>".$loc['long']."-5 and `long`<".$loc['long']."+5) OR
35 `users`.`email` like '%.at' OR `users`.`email` like '%.fr' OR `users`.`email` like '%.de' OR
36 `users`.`email` like '%.nl' OR `users`.`email` like '%.be' OR `users`.`email` like '%.ch'
37 OR `users`.`email` like '%.es' OR `users`.`email` like '%.pt' OR `users`.`email` like '%.ee')and
38 (`alerts`.`general`=1 OR `alerts`.`country`=1 OR `alerts`.`regional`=1 OR `alerts`.`radius`=1) AND
39 `locations`.`id` = `users`.`locid` and `users`.`id`=`alerts`.`memid`";
40 // $query = "select * from `users` where `email`='eg@linuxkun.de'";
41 $res = mysql_query($query);
42 while($row = mysql_fetch_assoc($res))
43 {
44 sendmail($row['email'], "[CAcert.org] CeBIT 2006", $lines, "support@cacert.org", "", "", "CAcert Support", "returns@cacert.org", 1);
45 echo $row['email']."\n";
46 }
47 ?>