} else {
?>
session_start();
include 'config2.php';
include 'opendb.php';
$query4 = "SELECT * from pm_buildings where buildingID='".$_SESSION['buildingID']."'";
$result4 = mysql_query($query4) or die(mysql_error());
$row4=mysql_fetch_array($result4);
include 'config2.php';
?>
Warning: Undefined variable $row4 in /home/pridepro/public_html/wp-content/plugins/php-code-widget/execphp.php(27) : eval()'d code on line 43
Warning: Trying to access array offset on value of type null in /home/pridepro/public_html/wp-content/plugins/php-code-widget/execphp.php(27) : eval()'d code on line 43
if($_GET['msg'] == "workorderadd") {
?>
Your maintenance request has been sent and will be processed as quickly as possible.
} ?>
include 'config2.php';
include 'opendb.php';
if(($_GET['action'] == "add") OR ($_POST['action'] == "add") OR ($_GET['action'] == "") OR ($_POST['action'] == "")) {
if ($_POST['buildingaddress'] == "nochoice") {
$errorBuilding = "Select a building";
$rowerror = 1;
}
if (($_POST['aptno'] == "") && ($_POST['action'] == "add")) {
$errorAptno = "Enter an apartment number";
$rowerror = 1;
}
if (($_POST['firstname'] == "") && ($_POST['action'] == "add")) {
$errorFirst = "Enter a first name";
$rowerror = 1;
}
if (($_POST['lastname'] == "") && ($_POST['action'] == "add")) {
$errorLast = "Enter a last name";
$rowerror = 1;
}
if (($_POST['emailaddress'] == "") && ($_POST['action'] == "add")) {
$errorEmail = "Enter an email address";
$rowerror = 1;
}
if (($_POST['phone'] == "") && ($_POST['action'] == "add")) {
$errorPhone = "Enter an phone number";
$rowerror = 1;
}
if (($_POST['enterok'] == "") && ($_POST['action'] == "add")) {
$errorEnterok = "Is it ok to enter apartment?";
$rowerror = 1;
}
if (($_POST['pets'] == "") && ($_POST['action'] == "add")) {
$errorPets = "Are there pets in apartment?";
$rowerror = 1;
}
if (($_POST['workcat'] == "") && ($_POST['action'] == "add")) {
$errorWorkcat = "Select a category of work";
$rowerror = 1;
}
if (($_POST['workdesc'] == "") && ($_POST['action'] == "add")) {
$errorWorkdesc = "Enter a description of the work";
$rowerror = 1;
}
if (($_POST['workreqdate'] == "") && ($_POST['action'] == "add")) {
$errorWorkreqdate = "Enter a desired work date/time";
$rowerror = 1;
}
if (($rowerror != 1) && ($_POST['action'] == "add")) {
$buildingaddress = str_replace("'","''",$_POST['buildingaddress']);
$aptno = str_replace("'","''",$_POST['aptno']);
$firstname = str_replace("'","''",$_POST['firstname']);
$lastname = str_replace("'","''",$_POST['lastname']);
$phone = str_replace("'","''",$_POST['phone']);
$emailaddress = str_replace("'","''",$_POST['emailaddress']);
$pets = str_replace("'","''",$_POST['pets']);
$enterok = str_replace("'","''",$_POST['enterok']);
$workdesc = str_replace("'","''",$_POST['workdesc']);
$workcat = str_replace("'","''",$_POST['workcat']);
$workreqdate = str_replace("'","''",$_POST['workreqdate']);
$target_path1 = "images/workorders/";
$target_path1 = $target_path1 . basename( $_FILES['uploadedfile1']['name']);
if(move_uploaded_file($_FILES['uploadedfile1']['tmp_name'], $target_path1)) {
$filename1 = $_FILES['uploadedfile1']['name'];
} else{
}
$target_path2 = "images/workorders/";
$target_path2 = $target_path2 . basename( $_FILES['uploadedfile2']['name']);
if(move_uploaded_file($_FILES['uploadedfile2']['tmp_name'], $target_path2)) {
$filename2 = $_FILES['uploadedfile2']['name'];
} else{
}
$target_path3 = "images/workorders/";
$target_path3 = $target_path3 . basename( $_FILES['uploadedfile3']['name']);
if(move_uploaded_file($_FILES['uploadedfile3']['tmp_name'], $target_path3)) {
$filename3 = $_FILES['uploadedfile3']['name'];
} else{
}
$wdi = date("Y-m-d");
$query="insert into pm_workorders (buildingaddress,aptno,firstname,lastname,phone,emailaddress,pets,enterok,workcat,workreqdate,workdesc,workstatus,workdatein,photo1,photo2,photo3) VALUES ('$buildingaddress','$aptno','$firstname','$lastname','$phone','$emailaddress','$pets','$enterok','$workcat','$workreqdate','$workdesc','Pending','$wdi','$filename1','$filename2','$filename3')";
$result=mysql_query($query);
$headers1 .= 'From: ' . "\r\n";
$headers1 .= 'MIME-Version: 1.0' . "\r\n";
$headers1 .= "X-Mailer: php";
$headers1 .= "Content-type: text/html; charset=iso-8859-1\n";
$msg1 .= "Dear ".$firstname." ".$lastname.",\r\n\r\nYour Maintenance Request has been received. Someone will be in touch with you shortly.\r\n
\r\nRegards,\r\n".$buildingaddress."\r\nBuilding Management";
mail($emailaddress,'Maintenance Request',$msg1,$headers1);
$queryba = "SELECT distinct emailaddress from pm_contacts where (buildingaddress='" .$buildingaddress. "' OR buildingaddress2='" .$buildingaddress. "' OR buildingaddress3='" .$buildingaddress. "' OR buildingaddress4='" .$buildingaddress. "' OR buildingaddress5='" .$buildingaddress. "' OR buildingaddress6='" .$buildingaddress. "' OR buildingaddress7='" .$buildingaddress. "' OR buildingaddress8='" .$buildingaddress. "' OR buildingaddress9='" .$buildingaddress. "' OR buildingaddress10='" .$buildingaddress. "' OR buildingaddress11='" .$buildingaddress. "' OR buildingaddress12='" .$buildingaddress. "' OR buildingaddress13='" .$buildingaddress. "' OR buildingaddress14='" .$buildingaddress. "' OR buildingaddress15='" .$buildingaddress. "' OR buildingaddress16='" .$buildingaddress. "' OR buildingaddress17='" .$buildingaddress. "' OR buildingaddress18='" .$buildingaddress. "' OR buildingaddress19='" .$buildingaddress. "' OR buildingaddress20='" .$buildingaddress. "' OR buildingaddress='99999') AND (ctype='Property Manager' OR ctype='Superintendent')";
$resultba = mysql_query($queryba) or die(mysql_error());
$headers2 .= 'From: info@pridepropertymanagement.com' . "\r\n";
$headers2 .= 'MIME-Version: 1.0' . "\r\n";
$headers2 .= "X-Mailer: php";
$headers2 .= "Content-type: text/html; charset=iso-8859-1\n";
$msg2 .= "A Maintenance Request has been submitted by ".$firstname." ".$lastname." from Apartment ".$aptno." of ".$buildingaddress."\r\n\r\nCategory of Work: ".$workcat."\r\nDescription of Problem: ".$workdesc."\r\n\r\nPlease login to Work Order Administration to review and update this work order. \r\n\r\nhttps://www.pridepropertymanagement.com/controlpanel/admin_login.php\r\n\r\nRegards,\r\n".$buildingaddress."\r\nSystem Management\r\n";
while($rowba = mysql_fetch_array($resultba)){
{
mail($rowba['emailaddress'],'Maintenance Request Submitted',$msg2,$headers2);
}
?>
}
}
?>
} ?>