-
Notifications
You must be signed in to change notification settings - Fork 1
/
massemail.php
88 lines (65 loc) · 2.68 KB
/
massemail.php
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
86
87
88
<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_ADMINISTRATOR)
stderr("Error", "Permission denied.");
$class = 0 + $_POST["class"];
$or = $_POST["or"];
if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST")
{
$res = mysql_query("SELECT id, username, email FROM users WHERE class $or $class") or sqlerr(__FILE__, __LINE__);
$subject = substr(trim($HTTP_POST_VARS["subject"]), 0, 80);
if ($subject == "") $subject = "(no subject)";
$subject = "$subject";
$message1 = trim($HTTP_POST_VARS["message"]);
if ($message1 == "") stderr("Error", "Empty message!");
while($arr=mysql_fetch_array($res)){
$to = $arr["email"];
$message = "Message received from $SITENAME on " . gmdate("Y-m-d H:i:s") . " GMT.\n" .
"---------------------------------------------------------------------\n\n" .
$message1 . "\n\n" .
"---------------------------------------------------------------------\n$SITENAME\n";
$success = mail($to, $subject, $message, "Od: $SITEEMAIL", "-f$SITEEMAIL");
}
if ($success)
stderr("Success", "Messages sent.");
else
stderr("Error", "Try again.");
}
stdhead("Mass E-mail Gateway");
?>
<table border="0" class="main" cellspacing="0" cellpadding="0"><tr>
<td class="embedded"><img src="pic/email.gif" alt=""/></td>
<td class="embedded" style="padding-left: 10px"><font size="3"><b>Send mass e-mail to all members</b></font></td>
</tr></table><br/>
<?begin_frame("Send mass e-mail",false,5,false);?>
<form method="post" action="massemail.php">
<?begin_table();
if (get_user_class() == UC_MODERATOR && $CURUSER["class"] > UC_POWER_USER)
printf("<input type=hidden name=class value=$CURUSER[class]\n");
else
{
print("<tr><td class=\"rowhead\">Classe</td><td class=\"row2\" colspan=\"2\" align=\"left\"><select name=\"or\"><option value='<'><</option><option value='>'>></option><option value='='>=</option><option value='<='><=</option><option value='>='>>=</option></select> <select name=\"class\">\n");
if (get_user_class() == UC_MODERATOR)
$maxclass = UC_POWER_USER;
else
$maxclass = get_user_class() - 1;
for ($i = 0; $i <= $maxclass; ++$i)
{
$currentclass = get_user_class_name($i);
if ($currentclass)
print("<option value=\"$i\"" . ($CURUSER["class"] == $i ? " selected=\"selected\"" : "") . ">$prefix" . $currentclass . "</option>\n");
}
print("</select></td></tr>\n");
}
?>
<tr><td class="rowhead">Subject</td><td class="row2"><input type="text" name="subject" size="80"/></td></tr>
<tr><td class="rowhead">Body</td><td class="row2"><textarea name="message" cols="80" rows="20"></textarea></td></tr>
<tr><td colspan="2" class="row2" align="center"><input type="submit" value="Send" class="btn"/></td></tr>
<?end_table();?>
</form>
<?end_frame();?>
<?
stdfoot();
?>