PHP not working following web host upgrade to 5.5

Hi All,

I started having issues with a PHP script that handles our basic orders form at www.balancepetfoods.com.au. Issues started when the web host upgraded from PHP 5.2 to 5.5 a week or so ago.

Feel free to post a few test orders to see what I mean.

Then ordering product, the basic parameters (item, quantity, etc) are “stored” in browser memory (probably not the right term) and then passed onto the checkout.php script which generates an email that comes to us for processing. None of these parameters including the customer details (entered of the checkout form at the end) seem to be going through to the PHP script any more. As a result, the customer just gets a message indicating that they have not completed all fields on the form) which they probably have!

You can see the general coding for the website by visiting the site itself and inspecting the code. The PHP script itself is posted below. Any help will be much appreciated.

Regards

Jason Pleaner

<? //=====================================================================|| // NOP Design JavaScript Shopping Cart || // PHP SCRIPT Checkout Module || // || // For more information on SmartSystems, or how NOPDesign can help you || // Please visit us on the WWW at http://www.nopdesign.com || // || // Javascript portions of this shopping cart software are available as || // freeware from NOP Design. You must keep this comment unchanged in || // your code. For more information contact [email protected]. || // || // JavaScript Shop Module, V.4.4.0 || //=====================================================================|| // || // Function: Writes available form elements from the NOP || // Free Cart (http://www.nopdesign.com/freecart) || // and other form elements to an email file, and || // send user confirmation || // || //=====================================================================|| //###################################################################### // # // User defined variables: # // $header - string value containing the complete # // path of the HTML page header # // $footer - string value containing the complete # // path of the HTML page footer # // $youremail - string value containing the email address to # // send catalog orders in EMAIL or BOTH modes # // $returnpage - URL to send user when checkout is complete # // $csvfilename - string value containing the complete # // path of the user database. # // $csvquote - string value containing what to use for quotes # // in the csv file (typically "" or \") # // $mode - string value containing 'EMAIL', 'FILE' or # // 'BOTH' to determine if the script should send # // an email to you with the new order, write the # // order to a CSV file, or do both. # //###################################################################### $header = "header.html"; $footer = "footer.html"; $returnpage = "/"; $youremail = "[email protected]"; $csvfilename = "orders.csv"; $csvquote = "\"\""; $mode = "EMAIL"; //############################################################## //#FUNCTION: doFormError # //#RETURNS: # //#PARAMETERS: A error message string. # //#PURPOSE: Generates an HTML page indicating a form # //# submission error occurred. # //############################################################## function doFormError($errString) { include($header); echo ""; echo ".style1 {"; echo "font-size: 12px;"; echo "font-family: Arial, Helvetica, sans-serif;}"; echo ""; echo "

 

"; echo "

The form you submitted was not complete.

"; echo "

$errString



\n"; echo "

"; include($footer); exit; alert( "I'm sorry, before continuing:\n" + strFields ); } //############################################################## //#FUNCTION: doError # //#RETURNS: # //#PARAMETERS: A error message string. # //#PURPOSE: Generates an HTML page indicating an error # //# occurred. # //############################################################## function doError($errString) { include($header); echo "$errString

\n"; include($footer); exit; } //############################################################## //############################################################## //### MAIN ### //############################################################## //############################################################## if ((b_customerid == "") || ($b_first == "") || ($b_last == "") || ($b_addr == "") || ($b_city == "") || ($b_state == "") || ($b_postcode == "") || ($b_phone == "") || ($b_email == "")) { doFormError("It appears that you forgot to fill in a required field.

Please go back and correct the error.

"); exit; } //# checks for valid email address if( !(ereg("^(.+)@(.+)\\.(.+)$",$b_email)) ) { doFormError("You submitted an invalid email address.

Please go back and correct the error.

"); exit; } $today = date ("l, F jS Y"); $strMessageBody = ""; $strMessageBody .= "A new order has been received. A summary of this order appears below.\n"; $strMessageBody .= "\n"; $strMessageBody .= "Order Date: $today \n"; $strMessageBody .= " \n"; $strMessageBody .= "Bill To: \n"; $strMessageBody .= "-------- \n"; $strMessageBody .= " $b_customerid \n"; $strMessageBody .= " $b_first $b_last \n"; $strMessageBody .= " $b_addr \n"; $strMessageBody .= " $b_city, $b_state $b_postcode \n"; $strMessageBody .= " $b_phone \n"; $strMessageBody .= " $b_email \n"; $strMessageBody .= " \n"; $strMessageBody .= " \n"; $strMessageBody .= "Qty Price(\$) Product ID - Product Name\n"; $strMessageBody .= "===================================================================== \n"; $strMessageBody .= "$QUANTITY_1 \$$PRICE_1 $ID_1 - $NAME_1 $ADDTLINFO_1 \n"; if( $NAME_2 ) {$strMessageBody .= "$QUANTITY_2 \$$PRICE_2 $ID_2 - $NAME_2 $ADDTLINFO_2 \n";} if( $NAME_3 ) {$strMessageBody .= "$QUANTITY_3 \$$PRICE_3 $ID_3 - $NAME_3 $ADDTLINFO_3 \n";} if( $NAME_4 ) {$strMessageBody .= "$QUANTITY_4 \$$PRICE_4 $ID_4 - $NAME_4 $ADDTLINFO_4 \n";} if( $NAME_5 ) {$strMessageBody .= "$QUANTITY_5 \$$PRICE_5 $ID_5 - $NAME_5 $ADDTLINFO_5 \n";} if( $NAME_6 ) {$strMessageBody .= "$QUANTITY_6 \$$PRICE_6 $ID_6 - $NAME_6 $ADDTLINFO_6 \n";} if( $NAME_7 ) {$strMessageBody .= "$QUANTITY_7 \$$PRICE_7 $ID_7 - $NAME_7 $ADDTLINFO_7 \n";} if( $NAME_8 ) {$strMessageBody .= "$QUANTITY_8 \$$PRICE_8 $ID_8 - $NAME_8 $ADDTLINFO_8 \n";} if( $NAME_9 ) {$strMessageBody .= "$QUANTITY_9 \$$PRICE_9 $ID_9 - $NAME_9 $ADDTLINFO_9 \n";} if( $NAME_10 ){$strMessageBody .= "$QUANTITY_10 \$$PRICE_10 $ID_10 - $NAME_10 $ADDTLINFO_10 \n";} if( $NAME_11 ){$strMessageBody .= "$QUANTITY_11 \$$PRICE_11 $ID_11 - $NAME_11 $ADDTLINFO_11 \n";} if( $NAME_12 ){$strMessageBody .= "$QUANTITY_12 \$$PRICE_12 $ID_12 - $NAME_12 $ADDTLINFO_12 \n";} if( $NAME_13 ){$strMessageBody .= "$QUANTITY_13 \$$PRICE_13 $ID_13 - $NAME_13 $ADDTLINFO_13 \n";} $strMessageBody .= "===================================================================== \n"; $strMessageBody .= "SUBTOTAL: $SUBTOTAL \n"; $strMessageBody .= "DISCOUNTS: $DISCOUNT \n"; $strMessageBody .= "FREIGHT: $SHIPPING \n"; $strMessageBody .= "TOTAL: $TOTAL \n"; $strMessageBody .= "\n"; $strMessageBody .= "Comments: \n"; $strMessageBody .= "--------- \n"; $strMessageBody .= "$comment \n"; $strMessageBody .= " \n"; if( $mode == "BOTH" || $mode == "EMAIL") { //# Send email order to you... $mailheaders = "From: $b_email\r\n"; //$mailheaders .="X-Mailer: PHP Mail generated by:NOP Design Shopping Cart\r\n"; $subject = "New Online Order"; mail($youremail, $subject, $strMessageBody, $mailheaders); } //# Send email conformation to the customer..... $mailheaders = "From: $youremail\r\n"; //$mailheaders .="X-Mailer: PHP Mail generated by:NOP Design Shopping Cart\r\n"; $subject = "Natural Balance Pet Foods - Order Confirmation"; mail($b_email, $subject, $strMessageBody, $mailheaders); include($header); echo "

Thank you for your order from our online store.

"; echo "

"; echo "

You will receive a confirmation email of your order momentarily.

"; echo "

"; echo "

An invoice and payment details will be included with your order when it is delivered.

"; echo "

"; echo "

Please contact us on 1300 132 505 if you have any questions or concerns.

"; echo "

"; echo "

Return Home

"; echo "

"; include($footer); ?>

We are missing the rest of the code.

Is there any reason you went that direction and not with an eCommerce system?

Also, what is the problem? What errors are you getting? Any error codes for us to review?

Show something so we can understand your problem. Most likely it is something simple. Perhaps a simple
function that was deprecated from PHP 5.2 to 5.5. But, we need to know what the error is and what line(s)
it was pointing at.

Tell us the error message(s) you are getting and show a few lines before and after where the error points
you to in the code. (code should be inside the PHP tags, of course!)

Sponsor our Newsletter | Privacy Policy | Terms of Service