• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

PHP Problem

WilcoW

New Pleskian
After upgrading to 10.4.4 mail send script does not work anymore. The PHP version stayed the same 5.2.17....

Weird problem, anyone an idea?

<?php
$Owner_email = "*********@hpeprint.com";
$Owner = "Snackbar Friecoenda";
// process.php
if(isset($_POST['saveForm']))
{
/*
* Specify the field names that are in the form. This is meant
* for security so that someone can't send whatever they want
* to the form.
*/
$allowedFields = array(
'FirstName',
'LastName',
'Email',
'Phone',
'StreetAddress',
'City',
'Zip',
'Pickdel'
);

// Specify the field names that you want to require...
$requiredFields = array(
'FirstName',
'LastName',
'Email',
'Phone',
'StreetAddress',
'City',
'Zip',
'Pickdel'
);

//fill the prduct name array
//global $PRODUCTS;
$PRODUCT_NAME = array();
foreach($PRODUCTS as $prod)
{
$PRODUCT_NAME[$prod[0]] = $prod[1] ;
}

$order_tbl = new HTML_Table(null, 'display', 0, 2, 0);
$order_tbl->addRow();
$order_tbl->addCell('Produkt ', 'first', 'header');
$order_tbl->addCell('Prijs', null, 'header');
$order_tbl->addCell('Aantal', null, 'header' );
$order_tbl->addCell('Totaal', null, 'header' );

// Loop through the $_POST array, which comes from the form...
$errors = array();
foreach($_POST AS $key => $value)
{
// first need to make sure this is an allowed field
if(in_array($key, $allowedFields))
{
$$key = $value;

// is this a required field?
if(in_array($key, $requiredFields) && $value == '')
{
$errors[] = "The field $key is required.";
}
}

//Collect the ordered dishes
$exp_arr = explode("_",$key);
if(($exp_arr[1] == 'qty')&&($value != 0))
{
$sel_price = $_POST[($exp_arr[0] . '_price')];
$sel_tot = $sel_price * $value;
$order_tbl->addRow();
$order_tbl->addCell($PRODUCT_NAME[$exp_arr[0]]);
$order_tbl->addCell('€' . number_format($sel_price, 2 , ',' , ' ') ,'cur');
$order_tbl->addCell($value,'qty');
$order_tbl->addCell('€' . number_format($sel_tot, 2 , ',' , ' ') ,'cur');
}
}

// were there any errors?
if(count($errors) > 0)
{
$resultString = '<p>Er is een probleem met het invullen van het formulier :</p>';
$resultString .= '<ul>';
foreach($errors as $error)
{
$resultString .= "<li>$error</li>";
}
$resultString .= '</ul>';

}
else
{
$del_str = "U kunt uw bestelling ophalen bij Snackbar Friecoenda";

//Calculate the total price
$order_price = $_POST['total'];

if((isset($_POST['Pickdel']))&&($_POST['Pickdel'] == "Delivery"))
{
$order_price = $order_price + 2.00;
$del_str = "Uw bestelling wordt bezorgd. Adres ".$StreetAddress .','. $City . ', Postcode - ' . $Zip ;
}

$order_price_str = number_format($order_price, 2 , ',' , ' ');

$resultString = "Bedankt voor uw bestelling! Uw bestelling is succesvol geplaatst en de totale kosten van de bestelling zijn € ".$order_price_str;

$subject = 'Bestelling Friecoenda';

$message = '<html>
<body>
Beste ' . $_POST['FirstName'] .',<br /><br />

Uw bestelling :-<br />' . $order_tbl->display() .
'<br />Totaal prijs : € '.$order_price_str.'.<br />'
.$del_str .
'<br /> '.
'Uw Opmerking - '.$_POST['Note'] .
'<br /> Telefoon -' . $Phone . '<br /> Email -' . $Email .
'<br /><br />Met vriendelijke groet,<br />'
.$Owner.'</body></html>';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: ' . "\r\n";
$headers .= 'From: '.$Owner_email."\r\n";
$headers .= 'Cc: '.$Owner_email."\r\n";
$headers .= 'Bcc: ' . $Email.', [email protected]'."\r\n";
// Mail it
if(mail($Email, $subject, $message, $headers))
{
$resultString = $resultString.".Bestelling is geplaatst";
}
else
{
$resultString = $resultString.".Fout met verzenden";
}


}

// display the result string
echo $resultString;
}
?>
 
Back
Top