Attachment 'ate-de09-mail.php.txt'
Download 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("ate-de09-email.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
31 // $locid = intval($_REQUEST['location']);
32 // $maxdist = intval($_REQUEST['maxdist']);
33 $maxdist = 200;
34
35
36 // location location.ID
37 // verified: 29.4.09 u.schroeter
38 // $locid = 7902857; // Paris
39 // $locid = 238568; // Bielefeld
40 // $locid = 715191; // Hamburg
41 // $locid = 1102495; // London
42 // $locid = 520340; // Duesseldorf
43 // $locid = 1260319; // Muenchen
44 // $locid = 606058; // Frankfurt
45 // $locid = 1775784; // Stuttgart
46 // $locid = 228950; // Berlin
47 // $locid = 606058; // Frankfurt
48
49 $locid = 599389; // Flensburg
50
51 $city = "Flensburg, 12.+13.6.2009";
52
53 $query = "select * from `locations` where `id`='$locid'";
54 $loc = mysql_fetch_assoc(mysql_query($query));
55
56 $query = "SELECT ROUND(6378.137 * ACOS(0.9999999*((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) +
57 (COS(PI() * $loc[lat] / 180 ) * COS(PI() * `locations`.`lat` / 180) *
58 COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180)))), -1) AS `distance`, sum(`points`) as pts, `users`.*
59 FROM `locations`
60 inner join `users` on `users`.`locid` = `locations`.`id`
61 inner join `alerts` on `users`.`id`=`alerts`.`memid`
62 inner join `notary` on `users`.`id`=`notary`.`to`
63 WHERE (`alerts`.`general`=1 OR `alerts`.`country`=1 OR `alerts`.`regional`=1 OR `alerts`.`radius`=1)
64 GROUP BY `users`.`id`
65 HAVING `distance` <= '$maxdist'
66 ORDER BY `distance` ";
67 echo $query;
68
69 // comment next line when starting to send mail not only to me
70 // $query = "select * from `users` where `email` like 'cacerttest%'";
71
72 $res = mysql_query($query);
73 $xrows = mysql_num_rows($res);
74
75 while($row = mysql_fetch_assoc($res))
76 {
77 // uncomment next line to send mails ...
78 sendmail($row['email'], "[CAcert.org] ATE-$city", $lines, "events@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
79 }
80 // 1x cc to events.cacert.org
81 sendmail("events@cacert.org", "[CAcert.org] ATE-$city", $lines, "events@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
82 // 1x mailing report to events.cacert.org
83 sendmail("events@cacert.org", "[CAcert.org] ATE-$city Report", "invitation sent to $xrows recipients.", "support@cacert.org", "", "", "CAcert Events Organisation", "returns@cacert.org", 1);
84
85 ?>
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.