|
Rapid Electroplating Process, Inc.
|
rep7_tes2.html
";
$err_flg_tst=1;
$nameErr = $emailErr = $companyErr= $requestErr= "";
$name = $email = $request = $company="";
$err_flg=-1;
//$err_flg1=-1;
if (!empty($_POST["status"]))
{
if ($_POST["status"]<>"Msg Sent")
{
/*
//last msg not sent--check current input
echo "Posted Name: " . $_POST["name"] . "
";
echo "Posted Email: " . $_POST["email"] . "
";
echo "Posted Company: " . $_POST["company"] . "
";
echo "Posted Request: " . $_POST["request"] . "
";
echo "Posted Status: " . $_POST["status"] . "
";
*/
$name= $_POST["name"] ;
$email= $_POST["email"];
$company= $_POST["company"];
$request= $_POST["request"];
$status= $_POST["status"];
//echo "Name (POST): " . $_POST["name"] . "
";
} else {
// last msg sent--start clean
/*
$name= "";
$email= "";
$company= "";
$request= "";
$status= "";
*/
}
}
// echo "Name (normal): " . $name . "
";
// echo "Name (GLOBAL): " . $GLOBALS["name"] . "
";
// echo "Err_flg: " . $err_flg . "a" . $lf2 . "b";
?>
|
|
|
|
Please Contact Us For More Information: info@rapidelectroplating.com
0) {set_input($loop_cnt,$nameErr);};
//function set_input($loop_cnt,$nameErr){
//echo "Test2:" . $name . "
";
/*
if ($GLOBALS["err_flg1"]==-1)
{
$GLOBALS["nameErr"] =$GLOBALS["emailErr"] =$GLOBALS["companyErr"]= "";
$GLOBALS["name"] = $GLOBALS["email"] = $GLOBALS["request"] = $GLOBALS["company"]="";
echo $GLOBALS["err_flg"] . " in reset values" . "
";
}
*/
//echo $GLOBALS["err_flg"] . " into set_input _flg" . "
";
//echo $GLOBALS["err_flg1"] . " into set_input _flg1" . "
";
//echo "Test3:" . $name . "
";
$err_flg=0;
//echo $GLOBALS["err_flg"] . " into set_input" . "
";
//echo "Test3a:" . $name . "
";
if (empty($name))
{
$nameErr = "Name is required";
$err_flg=1;
} else {
$name = test_input($name);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
$nameErr = "Only letters and white space allowed";
$err_flg=2;
}
}
//echo "Test3b:" . $name . "
";
//echo "Err_Flg:" . $err_flg . "
";
//echo "Test4b:" . $email . "
";
if (empty($email)) {
$emailErr = "Email is required";
$err_flg=3;
} else {
$email = test_input($email);
// check if e-mail address is well-formed
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
//echo "Invalid email: " . $email . "
";
$err_flg=4;
}
}
//echo "Test4b:" . $email . "
";
//echo "Err_Flg:" . $err_flg . "
";
//echo "Err_Flg1:" . $err_flg1 . "
";
/* ****
if (empty($_POST["website"])) {
$website = "";
} else {
$website = test_input($_POST["website"]);
// check if URL address syntax is valid
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {
$websiteErr = "Invalid URL";
$err_flg=3;
}
}
**** */
//echo "Data befor Company/Request checks
";
/*
if (!empty($name)) {
echo "Value name: " . $name . "
";
echo "Value email: " . $email . "
";
echo "Value company: " . $company . "
";
echo "Value request: " . $request . "
";
echo "Value status: " . $status . "
";
} else {
echo "Nothing posted yet" . "
";
}
*/
if (empty($company)) {
$company = "";
} else {
$company = test_input($company);
}
//echo "Out of check: Company: " . $company . "
";
if (empty($request)) {
$comment = "";
} else {
$request = test_input($request);
}
//echo "Out of check: Request: " . $request . "
";
/* ****
if (empty($_POST["gender"])) {
$genderErr = "Gender is required";
$err_flg=99;
} else {
$gender = test_input($_POST["gender"]);
}
**** */
if ($err_flg==0){
$MSG_STATUS="Msg Ready";
} else {
$msg_status="Msg Error";
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
//echo "ready to set msg_form err_flg: " . $err_flg . "
" ;
if ($err_flg==0) {$status=="Msg Sent";}
//echo "Value name: " . $name . "
";
//echo "Value email: " . $email . "
";
//echo "Value company: " . $company . "
";
//echo "Value request: " . $request . "
";
//echo "Value status: " . $status . "
";
// ****************************check current msg and send if $err_flg=0 **********************
// echo "err_flg: $err_flg
";
/*
if (!empty($_POST["name"])) {
echo "POST val name: " . $_POST["name"] . "
";
echo "POST val email: " . $_POST["email"] . "
";
echo "POST val company: " . $_POST["company"] . "
";
echo "POST val request: " . $_POST["request"] . "
";
echo "POST val status: " . $_POST["status"] . "
";
} else {
echo "Nothing posted yet" . "
";
}
*/
if ($err_flg >0 ){
// echo "Msg NOT sent: Errors
";
// echo ("End of err_flg check Name: $name" . "
");
} elseif ($err_flg<0) {
echo "Msg not prepared yet
";
$err_flg=0;
} else {
// send the message
$msg=("Name: " . $name . "\n" . "E-Mail: " . $email . "\n" . "Company: " . $company . "\n" . "Request: " . $request . "\n" );
// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);
// send email
$headers ='From: R2_admin@rapidelectroplating-admin.com' . "
" . 'Reply-To: info@rapidelectroplating.com' . "
" . 'X-Mailer: PHP/' . phpversion();
$mail_sent=false;
$mail_sent=mail('r2_admin@rapidelectroplating-admin.com','Inquiry from WebSite-xx',$msg,$headers);
// $mail_sent=mail('rrapids@cox.net','Inquiry from WebSite',$msg,$headers);
echo " mail_sent: $mail_sent" . "
";
if ($mail_sent){
echo "Your Message:
" . "
";
echo nl2br($msg) ;
echo "
";
echo "Msg sent";
$err_flg1=-1;
echo "
";
$status="Mail Sent";
$err_flg=-1;
$name= "";
$email= "";
$company= "";
$request= "";
$status= "Msg Sent";
} else {
echo "Msg send failure, resubmit
";
}
}
//echo ("End of check Name: $name" . "
");
/* *********************************** */
?>
https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts
 
© 2006-2018 Rapid Electroplating Process, Inc