3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php include_once("popup.php"); if(!xml2php("workorder")) { $smarty->assign('error_msg',"Error in language file"); } $login_id = $_SESSION['login_id']; $smarty->assign('login_id', $login_id); $wo_id = $VAR['wo_id']; $smarty->assign('wo_id', $wo_id); $company = $VAR['company']; $smarty->assign('company', $company); $customer_id = $VAR['customer_id']; $smarty->assign('customer_id', $customer_id); $rep_date=date('D, d M Y - h:i A'); /* Get Work Order and customer Info*/ $q = "SELECT ".PRFX."TABLE_WORK_ORDER.*, ".PRFX."TABLE_CUSTOMER.* FROM ".PRFX."TABLE_WORK_ORDER LEFT JOIN ".PRFX."TABLE_CUSTOMER ON ".PRFX."TABLE_WORK_ORDER.CUSTOMER_ID = ".PRFX."TABLE_CUSTOMER.CUSTOMER_ID WHERE WORK_ORDER_ID=".$db->qstr($wo_id); if(!$rs = $db->execute($q)){ force_page('core', 'error&error_msg=MySQL Error: '.$db->ErrorMsg().'&menu=1&type=database'); exit; } else { $email_info = $rs->GetArray(); } $smarty->assign('email_info', $email_info); /* Get Company Email Address*/ $q = "SELECT COMPANY_EMAIL FROM ".PRFX."TABLE_COMPANY"; if(!$rs = $db->execute($q)) { force_page('core', 'error&error_msg=MySQL Error: '.$db->ErrorMsg().'&menu=1&type=database'); exit; } $company_email = $rs->fields['COMPANY_EMAIL']; $smarty->assign('company_email', $company_email); /*Update The Work order*/ if(isset($_POST['Submit'])) { //Remove Extra Slashes caused by Magic Quotes $description_string = $VAR['description']; $description_string = preg_replace("</p>", "br /", $description_string); $description_string2=("<br/><hr><u>Replied On $rep_date by $login </u><br/>$description_string"); $q = "UPDATE ".PRFX."TABLE_WORK_ORDER SET WORK_ORDER_DESCRIPTION = CONCAT('$description_string2',WORK_ORDER_DESCRIPTION), LAST_ACTIVE =".$db->qstr( time() )." WHERE WORK_ORDER_ID=".$db->qstr( $wo_id); if(!$rs = $db->execute($q)) { force_page('core', 'error&error_msg=MySQL Error: '.$db->ErrorMsg().'&menu=1&type=database'); exit; } /*Get Full Description to send to Email*/ $q = mysql_query("SELECT * FROM ".PRFX."TABLE_WORK_ORDER WHERE WORK_ORDER_ID='$wo_id' LIMIT 1"); $q=mysql_fetch_array($q); $wo_description=$q['WORK_ORDER_DESCRIPTION']; /*Strip Tags*/ $wo_description=str_replace("Â","",$wo_description); /*Send the email*/ require_once('../../include/phpmailer/class.phpmailer.php') or die("error class"); /* OLD CODE $emailto=$VAR["email_to"]; $email_from=$VAR["email_from"]; $email_subject=$VAR["email_subject"]; $html="<br/></section>--reply above this line to respond--<br><br/>$wo_description</section><br/>--end email content--"; $email_priority=$VAR["email_priority"]; $email_cc=$VAR["email_cc"]; $subject = "$email_subject"; $mailer = "$email_from"; $headers = "From: $mailer \r\n"; $headers .= "Reply-To: $mailer\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Importance: $email_priority\r\n"; $message = '<html><body style="background:#ffffff">'; $message .= $html; $message .= "</body></html>"; $headers .= "Cc: $email_cc \r\n"; mail($emailto, $subject, $message, $headers); OLD CODE */ $email = new PHPMailer(); $email->From = $email_from; $email->FromName = $mailer; $email->addReplyTo($email_from); $email->addCC($email_cc); $email->Subject = $subject; $email->Body = $message; $email->AddAddress( $emailto ); $email->isHTML(true); if($email_priority=="Medium") $email->Priority = 3; if($email_priority=="High") $email->Priority = 1; if($email_priority=="Low") $email->Priority = 5; $email->AddCustomHeader("X-MSMail-Priority: $email_priority"); $email->AddCustomHeader("Importance: $email_priority"); if(count($VAR['add_attachments'])>0){ //select all attachments $q = "SELECT ".PRFX."TABLE_WORK_ORDER.WORK_ORDER_ID, ".PRFX."TABLE_WORK_ORDER_ATTACHMENTS.*, ".PRFX."TABLE_EMPLOYEE.EMPLOYEE_ID, ".PRFX."TABLE_EMPLOYEE.EMPLOYEE_DISPLAY_NAME FROM ".PRFX."TABLE_WORK_ORDER INNER JOIN ".PRFX."TABLE_WORK_ORDER_ATTACHMENTS ON ".PRFX."TABLE_WORK_ORDER.WORK_ORDER_ID=".PRFX."TABLE_WORK_ORDER_ATTACHMENTS.WO_ID LEFT JOIN ".PRFX."TABLE_EMPLOYEE ON ".PRFX."TABLE_WORK_ORDER_ATTACHMENTS.ATTACHMENT_UPLOADED_BY=".PRFX."TABLE_EMPLOYEE.EMPLOYEE_ID WHERE WORK_ORDER_ID=".$db->qstr($wo_id)." ORDER BY ATTACHMENT_ID DESC"; if(!$rs = $db->execute($q)) { force_page('core', 'error&error_msg=MySQL Error: '.$db->ErrorMsg().'&menu=1&type=database'); exit; } $attachments = $rs->GetArray(); echo "debug\n\n"; print_r($attachments); die(); $email->addAttachment('/tmp/image.jpg', 'new.jpg'); } if(!$email->send()) { force_page('core', 'error&error_msg=Mail error: '.$email->ErrorInfo.'&menu=1'); exit(); } else { force_page('workorder', 'view&wo_id='.$wo_id.'&customer_id='.$customer_id.'&company_id='.$company_id.'&page_title=Ticket# '.$wo_id.''); exit(); } } $smarty->display('workorder'.SEP.'send_email.tpl'); ?>
Output for 7.0.0 - 7.1.0
Warning: include_once(popup.php): failed to open stream: No such file or directory in /in/C91gd on line 3 Warning: include_once(): Failed opening 'popup.php' for inclusion (include_path='.:') in /in/C91gd on line 3 Fatal error: Uncaught Error: Call to undefined function xml2php() in /in/C91gd:4 Stack trace: #0 {main} thrown in /in/C91gd on line 4
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Warning: File not found: popup.php in /in/C91gd on line 3 Fatal error: Call to undefined function xml2php() in /in/C91gd on line 4
Process exited with code 255.
Output for 5.1.0 - 5.6.28
Warning: include_once(popup.php): failed to open stream: No such file or directory in /in/C91gd on line 3 Warning: include_once(): Failed opening 'popup.php' for inclusion (include_path='.:') in /in/C91gd on line 3 Fatal error: Call to undefined function xml2php() in /in/C91gd on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: main(popup.php): failed to open stream: No such file or directory in /in/C91gd on line 3 Warning: main(): Failed opening 'popup.php' for inclusion (include_path='.:') in /in/C91gd on line 3 Fatal error: Call to undefined function xml2php() in /in/C91gd on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: main(popup.php): failed to open stream: No such file or directory in /in/C91gd on line 3 Warning: main(): Failed opening 'popup.php' for inclusion (include_path='.:') in /in/C91gd on line 3 Fatal error: Call to undefined function: xml2php() in /in/C91gd on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: main(popup.php): failed to open stream: No such file or directory in /in/C91gd on line 3 Warning: main(): Failed opening 'popup.php' for inclusion (include_path='.:') in /in/C91gd on line 3 Fatal error: Call to undefined function: xml2php() in /in/C91gd on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(popup.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/C91gd on line 3 Warning: main() [http://www.php.net/function.main]: Failed opening 'popup.php' for inclusion (include_path='.:') in /in/C91gd on line 3 Fatal error: Call to undefined function: xml2php() in /in/C91gd on line 4