function display_menu() { echo "\r\n <div id = 'top_menu'>\r\n <a href = 'index.php'>Home</a> | \r\n <a href = 'about.php'>About</a> | \r\n <a href = 'officers.php'>Officers</a> | \r\n\t\t\t<a href = 'contact.php'>Contact</a> "; if (logged_in()) { if (check_admin_user()) { echo " <a href = 'admin.php'>(Admin)</a> "; } echo " <a href = 'nightcrews.php'>Night Crews</a> "; echo " <a href = 'events.php'>Games & Events</a> "; echo " |<a id='top_menu' href = 'profile.php'>Profile</a> | \r\n\t\t<a href = 'logout.php'>Log Out</a>"; } else { echo "| <a href = 'login.php'>Login</a> "; } echo "</div><br /><br />"; }
<?php require_once 'book_sc_fns.php'; session_start(); do_html_header('Changing password'); check_admin_user(); if (!filled_out($HTTP_POST_VARS)) { echo 'You have not filled out the form completely. Please try again.'; do_html_url('admin.php', 'Back to administration menu'); do_html_footer(); exit; } else { $new_passwd = $HTTP_POST_VARS['new_passwd']; $new_passwd2 = $HTTP_POST_VARS['new_passwd2']; $old_passwd = $HTTP_POST_VARS['old_passwd']; if ($new_passwd != $new_passwd2) { echo 'Passwords entered were not the same. Not changed.'; } else { if (strlen($new_passwd) > 16 || strlen($new_passwd) < 6) { echo 'New password must be between 6 and 16 characters. Try again.'; } else { // attempt update if (change_password($HTTP_SESSION_VARS['admin_user'], $old_passwd, $new_passwd)) { echo 'Password changed.'; } else { echo 'Password could not be changed.'; } } } }
<?php // include function files for this application require_once 'book_sc_fns.php'; session_start(); do_html_header("Add a book"); if (check_admin_user()) { display_book_form(); do_html_url("admin.php", "Back to administration menu"); } else { echo "<p>You are not authorized to enter the administration area.</p>"; } do_html_footer();
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ include_once 'user.php'; include_once 'cred.php'; include_once 'config.php'; if (!isset($_SESSION)) { session_start(); } $op = ""; if (isset($_POST['op'])) { $op = $_POST['op']; } elseif (isset($_GET['op'])) { $op = $_GET['op']; } if ($op != "register" && (!check_session_user() || !check_admin_user())) { header('Location: index.php?error=Invalid User' . $op); } else { if (strlen($op) > 0) { if ($op == "delete") { if (isset($_GET['id'])) { $username = $_GET['id']; $err = delete_user($username); if (strlen($err) > 0) { header('Location: error.php?msg=' . urlencode($err)); } else { header('Location: user_list.php'); } } else { header('Location: error.php?msg=No id'); }
function send($mailid, $admin_user) { if (!check_admin_user($admin_user)) { return false; } if (!($info = load_mail_info($mailid))) { echo "Cannot load list information for message {$mailid}"; return false; } $subject = $info[0]; $listid = $info[1]; $status = $info[2]; $sent = $info[3]; $from_name = 'Pyramid MLM'; $from_address = 'return@address'; $query = "select email from sub_lists where listid = {$listid}"; $result = mysql_query($query); if (!$result) { echo $query; return false; } else { if (mysql_num_rows($result) == 0) { echo "There is nobody subscribed to list number {$listid}"; return false; } else { // include PEAR mail classes include 'Mail.php'; include 'Mail/mime.php'; // instantiate MIME class and pass it the carriage return/line feed // character used on this system $message = new Mail_mime("\r\n"); // read in the text version of the newsletter $textfilename = "archive/{$listid}/{$mailid}/text.txt"; $tfp = fopen($textfilename, "r"); $text = fread($tfp, filesize($textfilename)); fclose($tfp); // read in the HTML version of the newsletter $htmlfilename = "archive/{$listid}/{$mailid}/index.html"; $hfp = fopen($htmlfilename, "r"); $html = fread($hfp, filesize($htmlfilename)); fclose($hfp); // add HTML and text to the mimemail object $message->setTXTBody($text); $message->setHTMLBody($html); // get the list of images that relate to this message $query = "select path, mimetype from images where mailid = {$mailid}"; if (db_connect()) { $result = mysql_query($query); if (!$result) { echo '<p>Unable to get image list from database.'; return false; } $num = mysql_numrows($result); for ($i = 0; $i < $num; $i++) { //load each image from disk $imgfilename = "archive/{$listid}/{$mailid}/" . mysql_result($result, $i, 0); $imgtype = mysql_result($result, $i, 1); // add each image to the object $message->addHTMLImage($imgfilename, $imgtype, $imgfilename, true); } } // create message body $body = $message->get(); // create message headers $from = '"' . get_real_name($admin_user) . '" <' . $admin_user . '>'; $hdrarray = array('From' => $from, 'Subject' => $subject); $hdrs = $message->headers($hdrarray); // create the actual sending object $sender =& Mail::factory('mail'); if ($status == 'STORED') { // send the HTML message to the administrator $sender->send($admin_user, $hdrs, $body); // send the plain text version of the message to administrator mail($admin_user, $subject, $text, 'From: "' . get_real_name($admin_user) . '" <' . $admin_user . ">"); echo "Mail sent to {$admin_user}"; // mark newsletter as tested $query = "update mail set status = 'TESTED' where mailid = {$mailid}"; if (db_connect()) { $result = mysql_query($query); } echo '<p>Press send again to send mail to whole list.<center>'; display_button('send', "&id={$mailid}"); echo '</center>'; } else { if ($status == 'TESTED') { //send to whole list $query = "select subscribers.realname, sub_lists.email, \r\n subscribers.mimetype \r\n from sub_lists, subscribers \r\n where listid = {$listid} and \r\n sub_lists.email = subscribers.email"; if (!db_connect()) { return false; } $result = mysql_query($query); if (!$result) { echo '<p>Error getting subscriber list'; } $count = 0; // for each subscriber while ($subscriber = mysql_fetch_row($result)) { if ($subscriber[2] == 'H') { //send HTML version to people who want it $sender->send($subscriber[1], $hdrs, $body); } else { //send text version to people who don't want HTML mail mail($subscriber[1], $subject, $text, 'From: "' . get_real_name($admin_user) . '" <' . $admin_user . ">"); } $count++; } $query = "update mail set status = 'SENT', sent = now() \r\n where mailid = {$mailid}"; if (db_connect()) { $result = mysql_query($query); } echo "<p>A total of {$count} messages were sent."; } else { if ($status == 'SENT') { echo '<p>This mail has already been sent.'; } } } } } }
the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ if (!isset($_SESSION)) { session_start(); } include_once 'user.php'; if (!check_session_user() || !check_admin_user()) { header('Location: index.php?error=Invalid User'); } else { $users = get_users(); ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" > <title>Infrastructure Manager | GRyCAP | UPV</title> <link rel="shortcut icon" href="images/favicon.ico"> <link href="css/style.css" rel="stylesheet" type="text/css" media="all"/> <link href="css/datatable.css" rel="stylesheet" type="text/css" media="all"/> <link rel="stylesheet" href="css/style_login2.css"> <link rel="stylesheet" href="css/style_intro2.css"> <link rel="stylesheet" href="css/style_menu2.css">
<?php // this functionality is in a separate file to allow us to be // more paranoid with it // if anything goes wrong, we will exit $max_size = 50000; include 'include_fns.php'; session_start(); // only admin users can upload files if (!check_admin_user()) { echo 'You do not seem to be authorized to use this page.'; exit; } // set up the admin toolbar buttons $buttons = array(); $buttons[0] = 'change-password'; $buttons[1] = 'create-list'; $buttons[2] = 'create-mail'; $buttons[3] = 'view-mail'; $buttons[4] = 'log-out'; $buttons[5] = 'show-all-lists'; $buttons[6] = 'show-my-lists'; $buttons[7] = 'show-other-lists'; do_html_header('Pyramid-MLM - Upload Files'); display_toolbar($buttons); // check that the page is being called with the required data if (!$HTTP_POST_FILES['userfile']['name'][0] || !$HTTP_POST_FILES['userfile']['name'][1] || !$HTTP_POST_VARS['subject'] || !$HTTP_POST_VARS['list']) { echo 'Problem: You did not fill out the form fully. The images are the only optional fields. Each message needs a subject, text version and an HTML version.'; do_html_footer();
function check_logged_in() { return check_normal_user() || check_admin_user(); }
function send($mailid, $admin_user, $emailAddr) { if (!check_admin_user($admin_user)) { return false; } if (!($info = load_mail_info($mailid))) { echo "Cannot load list information for message {$mailid}"; return false; } $subject = $info['subject']; //$CI->email->subject($subject); $listid = $info['listid']; $status = $info['status']; $sent = $info['sent']; $from_name = 'Trimart'; $from_address = '*****@*****.**'; //$CI->email->from($from_address,$from_name); $query = "select email from sub_lists where listid =" . $listid; $conn = db_connect(); $result = $conn->query($query); if (!$result) { echo "No result"; return false; } else { if ($result->num_rows == 0) { echo "There is nobody subscribed to list number {$listid}"; return false; } } $mail = new PHPMailer(); $mail->IsSMTP(); // we are going to use SMTP $mail->SMTPAuth = true; // enabled SMTP authentication $mail->SMTPSecure = "ssl"; // prefix for secure protocol to connect to the server $mail->Host = "smtp.gmail.com"; //"";192.168.20.202 // setting GMail as our SMTP server $mail->Port = 465; //;8089 // SMTP port to connect to GMail $mail->Username = "******"; //"andre.campbell#mcalbds"; // user email address $mail->Password = "******"; //"AC#220991"; // password in GMail // read in the text version of the newsletter $textfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\text.txt"; if (file_exists($textfilename)) { $tfp = fopen($textfilename, "r"); $text = fread($tfp, filesize($textfilename)); fclose($tfp); } // read in the HTML version of the newsletter $htmlfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\index.html"; if (file_exists($htmlfilename)) { $hfp = fopen($htmlfilename, "r"); $html = fread($hfp, filesize($htmlfilename)); fclose($hfp); } // get the list of images that relate to this message $query = "select path, mimetype from images where mailid = {$mailid}"; $result = $conn->query($query); if (!$result) { echo '<p>Unable to get image list from database.</p>'; return false; } $num = $result->num_rows; for ($i = 0; $i < $num; $i++) { //load each image from disk $row = $result->fetch_array(); $imgfilename = APPPATH . "archive\\{$listid}\\{$mailid}\\" . $row[0]; $imgtype = $row[1]; // add each image to the object //$message->addHTMLImage($imgfilename, $imgtype, $imgfilename, true); $mail->AddEmbeddedImage($imgfilename); // some attached files //$mail->AddAttachment("images/phpmailer_mini.gif"); // as many as you want } // create message body //$body = $message->get(); // create message headers $from = '"' . get_real_name($admin_user) . '" <' . $admin_user . '>'; $hdrarray = array('From' => $from, 'Subject' => $subject); //$hdrs = $message->headers($hdrarray); if ($status == 'STORED') { $mail->isHTML(true); $mail->Subject = $subjectf; $mail->AddAddress($_POST['emailAddr'], $admin_user); $sent = FALSE; // send the HTML message to the administrator //$sender->send($admin_user, $hdrs, $body); if ($html) { $mail->Body = $html; if (!$mail->Send()) { echo "Error sending html version: " . $mail->ErrorInfo; } } else { $sent = TRUE; } if ($sent) { echo "Mail sent to {$admin_user} with email address " . $_POST['emailAddr']; // mark newsletter as tested $query = "update mail set status = 'TESTED' where mailid = {$mailid}"; $result = $conn->query($query); echo '<p>Press send again to send mail to whole list.<center>'; display_button('send', "&id={$mailid}"); echo '</center></p>'; } //$mail->ClearAddresses(); } else { if ($status == 'TESTED') { $count = 0; $subscribers = get_subscribers($_GET['id']); $CI =& get_instance(); $row = $CI->trimart->get_login_credentials($user, $password); // for each subscriber /*for($i = 0; $i < count($subscribers); $i++) { $mail->AddAddress(subscriber[$i][0],$CI->trimart->get_real_name(subscriber[$i][0])); }*/ $mail->AddAddress('jamalbutcher2@gmail', 'YOU'); $mail->send(); $query = "update mail set status = 'SENT', sent = now() \n where mailid = {$mailid}"; $result = $conn->query($query); echo "<p>A total of {$count} messages were sent.</p>"; } else { if ($status == 'SENT') { echo '<p>This mail has already been sent.</p>'; } } } }
function send($mailid, $admin_user, $emailAddr) { $CI =& get_instance(); $CI->load->library('email'); /*$config['protocol'] = "smtp"; $config['smtp_host'] = "ssl://smtp.gmail.com"; //$config['smpt_timeout'] = '5'; //$config['smtp_user'] = "******"; //$config['smtp_pass'] = "******"; $config['smtp_port'] = 465;//"8089"; $config['charset'] = 'iso-8859-1'; $config['mailtype'] = "text"; $config['newline'] = "\r\n"; //$config['validation'] = TRUE;*/ //$config['protocol'] = 'smtp'; //$config['smtp_host'] = 'aspmx.l.google.com'; //change this //$config['smtp_port'] = '25'; //$config['smtp_user'] = '******'; //change this //$config['smtp_pass'] = '******'; //change this //$config['mailtype'] = 'text'; //$config['charset'] = 'iso-8859-1'; //$config['wordwrap'] = TRUE; //$config['newline'] = "\r\n"; //$CI->email->initialize($config); /*$CI->email->from('jamalbutcher@gmail', 'sender name'); $CI->email->to('jamalbutcher@gmail'); //$CI->email->cc('*****@*****.**'); $CI->email->subject('Your Subject'); $CI->email->message('Your Message'); //$CI->email->attach('/path/to/file1.png'); // attach file //$CI->email->attach('/path/to/file2.pdf'); if ($CI->email->send()) echo "Mail Sent!"; else echo "There is error in sending mail!";*/ ini_set('SMTP', 'smtp.gmail.com'); //192.168.20.202 ini_set('smtp_port', 25); //25 ini_set('sendmail_from', 'jamalbutcher@gmail'); //ini_set('smtp_user','jamalbutcher@gmail'); //ini_set('smptp_pass','P4m266a-mlx'); //ini_set('SMTP', '192.168.20.202'); // //ini_set('smtp_port', 8089); //25 if (!check_admin_user($admin_user)) { return false; } if (!($info = load_mail_info($mailid))) { echo "Cannot load list information for message {$mailid}"; return false; } $subject = $info['subject']; $CI->email->subject($subject); $listid = $info['listid']; $status = $info['status']; $sent = $info['sent']; $from_name = 'Trimart'; $from_address = '*****@*****.**'; $CI->email->from($from_address, $from_name); $query = "select email from sub_lists where listid =" . $listid; $conn = db_connect(); $result = $conn->query($query); if (!$result) { echo "No result"; return false; } else { if ($result->num_rows == 0) { echo "There is nobody subscribed to list number {$listid}"; return false; } } // include PEAR mail classes //include('Mail.php'); //include('Mail/Mime.php'); // instantiate MIME class and pass it the carriage return/line feed // character used on this system //$message = new Mail_mime("\r\n"); // read in the text version of the newsletter $textfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\text.txt"; //$tfp = fopen($textfilename, "r"); //$text = fread($tfp, filesize($textfilename)); //fclose($tfp); // read in the HTML version of the newsletter $htmlfilename = APPPATH . "archive\\" . $listid . "\\" . $mailid . "\\index.html"; //$hfp = fopen($htmlfilename, "r"); //$html = fread($hfp, filesize($htmlfilename)); //fclose($hfp); // add HTML and text to the mimuser object //$message->setTXTBody($text); //$message->setHTMLBody($html); // get the list of images that relate to this message $query = "select path, mimetype from images where mailid = {$mailid}"; $result = $conn->query($query); if (!$result) { echo '<p>Unable to get image list from database.</p>'; return false; } $num = $result->num_rows; for ($i = 0; $i < $num; $i++) { //load each image from disk $row = $result->fetch_array(); $imgfilename = APPPATH . "archive\\{$listid}\\{$mailid}\\" . $row[0]; //var_dump($imgfilename); $imgtype = $row[1]; // add each image to the object //$message->addHTMLImage($imgfilename, $imgtype, $imgfilename, true); $CI->email->attach($imgfilename); } // create message body //$body = $message->get(); // create message headers $from = '"' . get_real_name($admin_user) . '" <' . $admin_user . '>'; $hdrarray = array('From' => $from, 'Subject' => $subject); //$hdrs = $message->headers($hdrarray); // create the actual sending object //$sender =& Mail::factory('mail'); if ($status == 'STORED') { // send the HTML message to the administrator //$sender->send($admin_user, $hdrs, $body); // send the plain text version of the message to administrator //mail($_POST['emailAddr'], $subject, $text, 'From: "'.$admin_user.'" <'.$admin_user.">"); //var_dump($_POST['emailAddr']); if (mail($_POST['emailAddr'], $subject, 'Hello')) { echo "<p>Success you genius</p>"; } $CI->email->to($_POST['emailAddr']); //var_dump($_POST['emailAddr']); if (mail($_POST['emailAddr'], $subject, 'Hello', $from_address)) { echo "Mail sent to {$admin_user} with email address " . $_POST['emailAddr']; // mark newsletter as tested $query = "update mail set status = 'TESTED' where mailid = {$mailid}"; $result = $conn->query($query); echo '<p>Press send again to send mail to whole list.<center>'; display_button('send', "&id={$mailid}"); echo '</center></p>'; } /*else { echo $CI->email->print_debugger(); }*/ } else { if ($status == 'TESTED') { //send to whole list $query = "select subscribers.realname, sub_lists.email, \n subscribers.mimetype \n from sub_lists, subscribers \n where listid = {$listid} and \n sub_lists.email = subscribers.email"; $result = $conn->query($query); if (!$result) { echo '<p>Error getting subscriber list</p>'; } $count = 0; // for each subscriber while ($subscriber = $result->fetch_row()) { if ($subscriber[2] == 'H') { //send HTML version to people who want it //$sender->send($subscriber[1], $hdrs, $body); $CI->email->send(); } else { //send text version to people who don't want HTML mail /*mail($subscriber[1], $subject, $text, 'From: "'.get_real_name($admin_user).'" <'.$admin_user.">");*/ $CI->email->to($subscriber[1]); $CI->email->send(); } $count++; } $query = "update mail set status = 'SENT', sent = now() \n where mailid = {$mailid}"; $result = $conn->query($query); echo "<p>A total of {$count} messages were sent.</p>"; } else { if ($status == 'SENT') { echo '<p>This mail has already been sent.</p>'; } } } }