function post_message() { // Send email if ($_POST['email'] != 'no') { if ($_POST['email'] == 'yes-captains') { $reply_to = array('*****@*****.**' => 'LHS Math Club Captains'); $m = " and emailed to everyone (reply-to all captains)"; } else { //if($_POST['email'] == 'yes-you') $reply_to = array($_SESSION['email'] => $_SESSION['user_name']); $m = " and emailed to everyone (reply-to you)"; } //Send if (($msg = send_list_email($_POST['subject'], $_POST['body'], $reply_to)) !== true) { alert($msg, -1); return; } // Insert into database DB::insert('messages', array('author' => $_SESSION['user_id'], 'subject' => $_POST['subject'], 'body' => $_POST['body'])); } else { $m = ", but not emailed out"; } alert("Your message has been posted{$m}. <a href='../Messages?View=" . DB::insertId() . "'>View</a>", 1); location('Admin/Post_Message'); }
<?php require_once '../.lib/functions.php'; restrict_access('A'); if (isset($_POST["sendemail"])) { if ($_POST["pass"] !== "tidy_access_count") { throw new Exception("Error."); } if (array_key_exists("defaultto", $_POST)) { send_list_email($_POST['subj'], $_POST['msg'], $_POST['repto']); } else { $to = preg_split("/(\n|,)/", $_POST['to']); foreach ($to as &$tmp) { $tmp = trim($tmp); } send_email($to, $_POST['subj'], $_POST['msg'], $_POST['repto'], "", ""); } echo "<div><b>sent</b></div><br><br>"; } ?> This is just for special use, if you want to send mail to activities fair signups or to LMT registration-is-opening, for example. If you don't know what you're doing, don't touch it. <br>This is extremely security-vulnerable, so yeah. You need a password which is in the PHP code. Or ask the webmaster nicely and (s)he'll give it to you. <br>All fields must be filled. <style> textarea,input{display:block;} </style> <form method="post" action="Send_Email"> Security Code: <input type="text" name="pass" /> Recipients (linebreak-or-comma-separated list): <textarea name="to"></textarea>