| 16 | //*************************************************************************** | = | 16 | //*************************************************************************** |
| 17 | 17 | |||
| 18 | $subtitle="Admin Email Functions"; | 18 | $subtitle="Admin Email Functions"; | |
| 19 | require("protect.php"); | 19 | require("protect.php"); | |
| 20 | require("header.php"); | 20 | require("header.php"); | |
| 21 | $mail=$_GET['mail']; | 21 | $mail=$_GET['mail']; | |
| 22 | $message = Trim(stripslashes($_POST['mess'])); | +- | ||
| 23 | ?> | = | 22 | ?> |
| 24 | <html> | 23 | <html> | |
| 25 | <head> | 24 | <head> | |
| 26 | <title>Email Member Script</title> | 25 | <title>Email Member Script</title> | |
| 27 | </head> | 26 | </head> | |
| 28 | <body> | 27 | <body> | |
| 29 | <?php | 28 | <?php | |
| <> | 29 | |||
| 30 | if ($mail == 3 or $mail == 4 or $mail == 5) { | |||
| 31 | $message = Trim(stripslashes($_POST['mess'])); | |||
| 30 | // set variables for email | 32 | // query and variables for email | |
| 33 | $query = "SELECT * FROM ".$football->prefix."users WHERE maillist = 1"; | |||
| 34 | $result = (mysql_query($query)); | |||
| 35 | $no_entries = mysql_num_rows($result); | |||
| 31 | $subject = $football->sitetitle; | 36 | $subject = $football->sitetitle; | |
| 32 | if ($mailtype == 3) { | 37 | if ($mail == 3) { | |
| 33 | $subject .= " Custom Message"; | 38 | $subject .= " Custom Message"; | |
| 34 | $contents = "\nThis is a message from $football->sitetitle Admin!<br><br>"; | 39 | $contents = "\nThis is a message from $football->sitetitle Admin!<br><br>"; | |
| 35 | } elseif ($mailtype == 4) { | 40 | } elseif ($mail == 4) { | |
| 36 | $subject .= " Weekly Results"; | 41 | $subject .= " Weekly Results"; | |
| 37 | } else { $subject .= " Picks Reminder"; } | = | 42 | } else { $subject .= " Picks Reminder"; } |
| 38 | $contents .= $message; | <> | 43 | $contents .= $message; |
| 39 | // footer | |||
| 40 | $footer = "If you wish to not receive this letter, please click the following link:<br>"; | |||
| 41 | $y = "<br><br><br><br><br>------------------------------------------------------------------------<br>"; | |||
| 42 | $y .= $footer."<a href=\"$football->copyrightweb/unsubscribe.php\">Unsubscribe</a><br>"; | |||
| 43 | $y .= "\n"; | |||
| 44 | $y .= "<br>------------------------------------------------------------------------"; | |||
| 45 | = | 44 | ||
| 46 | // message and footer joined | <> | ||
| 47 | $email = $contents.$y; | |||
| 48 | ||||
| 49 | // finish mail header | |||
| 50 | $headers .= "From: $football->admin_email\n"; | |||
| 51 | $headers .= "Reply-To: $football->admin_email\n"; | |||
| 52 | $headers .= "Return-Path: $football->admin_email\n"; | |||
| 53 | // $headers .= "MIME-Version: 1.0\r\n"; | |||
| 54 | $headers .= "Content-Type: text/html\r\n"; | |||
| 55 | // $headers .= "Content-Transfer-Encoding: 7bit\r\n"; | |||
| 56 | ||||
| 57 | ||||
| 58 | // send to myself | = | 45 | // send to myself |
| 59 | $to = "$football->admin_email"; | 46 | $to = "$football->admin_email"; | |
| 60 | 47 | |||
| 61 | // BCC to subscribed members | 48 | // BCC to subscribed members | |
| 62 | $headers = "BCC: "; | 49 | $headers = "BCC: "; | |
| 63 | $x=0; | 50 | $x=0; | |
| 64 | // get users to email | +- | ||
| 65 | $query = "SELECT email, name FROM ".$football->prefix."users WHERE maillist = 1"; | |||
| 66 | $result = (mysql_query($query)); | |||
| 67 | $no_entries = mysql_num_rows($result); | |||
| 68 | while ($row=mysql_fetch_assoc($result)) { | = | 51 | while ($row=mysql_fetch_assoc($result)) { |
| -+ | 52 | if ($x==1) { | ||
| 69 | $headers .= $row["email"].","; | = | 53 | $headers .= $row["email"].","; |
| 70 | $x++; | 54 | $x++; | |
| -+ | 55 | } else if ($x==1) { | ||
| 56 | $headers .= $row["email"].","; | |||
| 57 | $x++; | |||
| 58 | } | |||
| 59 | $headers .= $row["email"].","; | |||
| 71 | } | = | 60 | } |
| 72 | $headers .= "\r\n"; | 61 | $headers .= "\r\n"; | |
| 73 | 62 | |||
| 74 | 63 | |||
| 75 | // footer | 64 | // footer | |
| 76 | $footer = "If you wish to not receive this letter, please click the following link:<br>"; | 65 | $footer = "If you wish to not receive this letter, please click the following link:<br>"; | |
| 108 | echo "<b>A total of $no_entries Weekly Results Email To Members Has Been Sent!</b>\n"; | = | 97 | echo "<b>A total of $no_entries Weekly Results Email To Members Has Been Sent!</b>\n"; |
| 109 | } else { | 98 | } else { | |
| 110 | echo "<b>A total of $no_entries Picks Reminder Email To Members Has Been Sent!</b>\n"; | 99 | echo "<b>A total of $no_entries Picks Reminder Email To Members Has Been Sent!</b>\n"; | |
| 111 | } | 100 | } | |
| 112 | echo "</p>"; | 101 | echo "</p>"; | |
| 113 | echo "</td></tr>\n</body></html>\n"; | 102 | echo "</td></tr>\n</body></html>\n"; | |
| 114 | <> | 103 | } | |
| 115 | = | 104 | ||
| 116 | 105 | |||
| 117 | ?> | 106 | ?> | |
| 118 | 107 | |||
| 119 | <?php | 108 | <?php | |
| 120 | require("footer.php"); | 109 | require("footer.php"); | |
| 121 | ?> | 110 | ?> | |