session_start();
require_once ("./include/common.php");
require_once ("./class/article.class.php");
require_once ("./class/info.class.php");
require_once ("./include/function.php");
$error = 0;
$email = trim($_POST['formemail']);
$name = trim($_POST['formname']);
$website = trim($_POST['formwebsite']);
$phone = trim($_POST['formphone']);
$comments = trim($_POST['formcomment']);
//$requestors_url = $_SERVER['REMOTE_ADDR'];
if (isset($_POST['action']) && ($_POST['action'] == "document"))
{
if (is_valid_email($email) == "no")
{
$email_failed="Please enter a valid and not hotmail or yahoo email.";
$error = 1;
}
if ($name == "")
{
$name_failed="Please enter your name.";
$error = 1;
}
/* if($phone){
if(!(is_numeric($phone)))
{
$phone_failed="Please correct the phone number.";
$error = 1;
}
} */
if ($comments == "")
{
$comments_failed="Please enter Comments.";
$error = 1;
}
if ($error == 1)
{
$error_msg = "
Required fields input missing or error.
";
}else
{
//send email to admin
$to = "info@centranum.com";
//$to = "j26.nz@hotmail.com";
$subject = "Request for Demo";
$message = "Demo is requested by
Name: $name
Email: $email
";
if ($phone) { $message .= "Phone: $phone
"; }
if ($website) { $message .= "Website: $website
"; }
if ($comments) { $message .= "Comment: $comments
"; }
if (sendmail($to, $subject, $message, $headers)=="error")
{
$error_msg = "
|
Sorry! The email could not be delivered to $email. Please try again later. |
|
";
$maildeliver = "n";
}else
{
$maildeliver = "y";
//send email to user
$to = $email;
$subject = "Request for Demo - Centranum";
$message = "
As Requested Demo Centranum
Dear $name:
Thanks for registering for a demo. We will be in touch with you shortly.
For further information, please email info@centranum.com
Thank you,
The Centranum Team
";
$headers = "MIME-Version: 1.0\r\n"."Content-type: text/html; charset=iso-8859-1\r\n".
"From: info@centranum.com\r\n"."Reply-To: info@centranum.com\r\n";
if (sendmail($to, $subject, $message, $headers)=="error")
{
$error_msg = "
|
Sorry! The email could not be delivered to $email. Please try again later. |
|
";
$maildeliver = "n";
}else
{
$maildeliver = "y";
}
}
//record info to database
$Info = new Info();
$Info->firstname = $name;
$Info->email = $email;
$Info->phone = $phone;
$Info->company = $website;
$Info->maildeliver = $maildeliver;
$Info->store();
if($maildeliver == "y")
{
//confirm message
header("location: demo_confirm");
//echo "Your request is sent. Centranum team will contact you shortly. Thanks";
//exit;
}
$email_failed = "";
$name_failed = "";
$email = "";
$name = "";
}
}
?>
Request for Demo
Please complete the form below with valid business email and website.
echo $error_msg;?>