newsletter';
if(!isuseradmin($userID) OR substr(basename($_SERVER[REQUEST_URI]),0,15) != "admincenter.php") die('Access denied.');
if($_POST['send'] || $_POST['testen']) {
$message = $_POST['message'];
$title = $_POST['title'];
$testmail = $_POST['testmail'];
$date=date("d.m.Y", time());
$message=nl2br($message);
$emailbody = '
'.$title.'
'.$message.'
You can remove yourself from the mailing-list
at your Profile
|
|
|
';
$emailbody=stripslashes($emailbody);
if($_POST['testen']) $bcc[] = $testmail;
else {
//clanmember
if($_POST['sendto_clanmembers']) {
$ergebnis=safe_query("SELECT userID FROM ".PREFIX."squads_members GROUP BY userID");
$anz=mysql_num_rows($ergebnis);
if($anz) {
while($ds=mysql_fetch_array($ergebnis)) {
$emails[] = getemail($ds[userID]);
}
}
}
if($_POST['sendto_registered']) {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."user WHERE newsletter='1'");
$anz=mysql_num_rows($ergebnis);
if($anz) {
while($ds=mysql_fetch_array($ergebnis)) {
$emails[] = $ds[email];
}
}
}
if($_POST['sendto_newsletter']) {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."newsletter");
$anz=mysql_num_rows($ergebnis);
if($anz) {
while($ds=mysql_fetch_array($ergebnis)) {
$emails[] = $ds[email];
}
}
}
$bcc=$emails;
}
$header = "From:$admin_name<$admin_email>\n";
$header .= "Reply-To: $admin_email\n";
$header .= "Content-Type: text/html";
$success = true;
$bcc=array_unique($bcc);
foreach($bcc as $mailto) {
if(!mail($mailto,PAGETITLE." Newsletter",$emailbody,$header)) $succces = false;
}
if($success) echo'newsletter was sent
Receptionist(s):
'.implode(", ",$bcc);
else echo'ERROR: Newsletter could not be sent (mailserver available?).';
}
else {
?>