//Here's a portion of the ProjectClass... class ProjectAdmin { public function project_insert(){ global $mysqli; $user_name=$mysqli->real_escape_string(trim($_POST['user_name'])); $email=trim($_POST['email']); $priority=trim($_POST['priority']); $type=trim($_POST['type']); $department=$mysqli->real_escape_string(trim($_POST['department'])); $description=$mysqli->real_escape_string(trim($_POST['description'])); $name=$mysqli->real_escape_string(trim($_POST['short_name'])); $go_live_date = date('Y-m-d',strtotime($_POST['month'].' '.$_POST['day'].' '.$_POST['year'])); $today=date("Y-m-d"); $attachment_count=0; $pref_count=0; $sql="insert into projects (name, email, department, priority, description, requested_by, app_type, date, go_live_date) values ('$name', '$email', '$department', '$priority', '$description', '$user_name', '$type', '$today', '$go_live_date')"; //echo $sql; if(!$query=$mysqli->query($sql)) { $err = 'your page_insert query didn\'t work becasue:' .' ERRNO: ' .$mysqli->errno .' ERROR: ' .$mysqli->error .' for this query: ' .$sql .PHP_EOL; trigger_error($err, E_USER_WARNING); } $novie_id = $mysqli->insert_id; //check to see if this user is already listed in preferences $sql_1 = "select id from preferences where email = '$email'"; if(!$query_1=$mysqli->query($sql_1)) { $err_1 = 'your insert into preferences query didn\'t work because:' .'ERRNO: ' .$msyqli->errno .' ERROR: ' .$mysqli->error .' for this query: ' .$sql_1 .PHP_EOL; trigger_error($err_1, E_USER_WARNING); } $pref_count = $query_1->num_rows; if($pref_count==0) { //add user to preferences table $sql_3 = "insert into preferences (email) VALUES ('$email')"; if(!$query_3=$mysqli->query($sql_3)) { $err_3 = 'your insert preferences query didn\'t work because: ' .'ERRNO: ' .$mysqli->errno .' ERROR: ' .$mysqli->error .' for this query: ' .$sql_3 .PHP_EOL; trigger_error($err_3, E_USER_WARNING); } } $msgText=""; $msgText .= "<table style=\"width:650px; height:800px; border: 1px solid #cccccc;\"> <tr> <td style=\"height:38px; background-color:#8f9293;\"></td> </tr> <tr> <td style=\"background-color:#000000; height:86px;\"> <table style=\"border-spacing: 0; border-collapse: collapse;\"> <tr> <td style=\"font-family:Impact; font-size:32px; color:#ffffff;\"> South Area Network</td> <td style=\"font-family:Helvetica; font-size:12px; color:#ffffff; text-align:right; vertical-align:middle; font-weight:bold; width:370px;\">Project Request Form <br>"; $msgText .=date("l - F jS, Y"); $msgText .="</td> </tr> </table> </td> </tr> <tr> <td style=\"background-color:#000000;\"></td> </tr> <tr> <td style=\"background-color:#ffffff; height:674px; font-family:Helvetica; font-size:12px; color:#000000; height:674px; vertical-align:top; padding:10px;\"><br><br> A project request has been submitted. Below are some of the details. To view the entire Project Request, login to the South Arean Network Admin Page.<br><br> <b>Project Name: </b>"; $msgText .=$_POST['short_name']; $msgText.="<br><hr><br> <b>Requested By: </b>"; $msgText .=$_POST['user_name']; $msgText.="<br><hr><br>"; if($_POST['priority']==1) { $priority="urgent"; } elseif($_POST['priority']==2) { $priority=="high"; } elseif($_POST['priority']==3) { $priority="medium"; } elseif($_POST['priority']==4) { $priority="low"; } elseif($_POST['priority']==5) { $priority="very low"; } $msgText.="<b>Priority: </b>"; $msgText .=$priority; $msgText.="<br><hr><br>"; $msgText .="<b>go live date: </b>"; $msgText .=date("m/d/Y", strtotime($go_live_date)); $msgText .="<br><hr><br>"; $msgText .=nl2br($_POST['description']); $msgText .="</td> </tr> </table> <table style=\"width:650px;\"> <tr> <td style=\"font-family:Helvetica; font-size:9px; color:#000000; text-align:center;\">©Verizon Wireless | South Area | All Rights Reserved | <a href=\"http://southareanetwork.nss.vzwnet.com/page.php?page_id=8\" style=\"font-family:Helvetica; font-size:9px; color:#000000;\">Contact</a></td> </tr> </table> "; $toText="Donald.Meador@VerizonWireless.com"; //$toText="bruce.gust@VerizonWireless.com"; $ccText="bruce.gust@VerizonWireless.com"; $fromText = $_POST['email']; $subjectText="new project request from "; $subjectText .=$fromText; $header = "From: ".$fromText."\r\n"; $header .= "Cc: ".$ccText."\n"; $header .= "Reply-To : ".$fromText."\r\n"; $header .= "Return-Path : ".$fromText."\r\n"; $header .= "X-Mailer: PHP\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; // ini_set(sendmail_from,$fromText); $postoffice=mail($toText, $subjectText, $msgText, $header, '-f'.$fromText); return($novie_id); }