if(!isset($to)) { $to = "contactsale@hotmail.com"; } if(!isset($form)) { $form = "OrderForm"; } if(!isset($email)) { $email = "contactisale@hotmail.com"; } $xls=" "; $today = gmdate ( "M d Y H:i:s" ); function print_form($array, $body) { if(gettype($array)=="array") { while (list($index, $sub) = each($array)) { $index = ereg_replace("\*", "", $index); $index = ereg_replace("_", " ", $index); $body = $body . $index . ": " . $sub . "\n"; } }else{ $body = $body . $array; } return $body; } function print_xls($array, $xls) { if(gettype($array)=="array") { while (list($index, $sub) = each($array)) { $index = ereg_replace("\*", "", $index); $index = ereg_replace("_", " ", $index); $xls = $xls . ", " . $sub; } }else{ $xls = $xls . $array; } return $xls; } function check_input($array){ global $HTTP_REFERER; $valid = 1; if(gettype($array)=="array") { while (list($index, $subarray) = each($array) ) { if(ereg("\*", $index) && (($subarray == "") || ($subarray == " "))) { $index = ereg_replace("\*", " ", $index); $index = ereg_replace("_", " ", $index); echo"
There is a problem with your submission. The field $index is required, please go back and fill in the form. (Or press the back button on your browser)
"; $valid = 0; return 0; exit; }elseif(eregi("email", $index)){ if(ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $subarray)){ $email_check = 1; }else{ $index = ereg_replace("\*", " ", $index); echo"There is a problem with your submission. The E-mail address you provided, $subarray, does not appear to be valid, please go back and give a valid address. (Or press the back button on your browser)
"; return 0; exit; } }else{ $email_check = 10; } } if($valid == "1" && ($email_check == "1" || $email_check == "10")) { return 1; }else{ return 0; } } } reset($HTTP_POST_VARS); if(check_input($HTTP_POST_VARS)) { $info ="At $today, a visitor to your site submited the form '$form'.\n\n"; if($REMOTE_HOST == " " || $REMOTE_HOST == "") { $host = "IP only"; }else{ $host = "$REMOTE_HOST"; } $body = print_form($HTTP_POST_VARS, $info) . "\n\nThe user who submited this form was: $REMOTE_ADDR ($host using $HTTP_USER_AGENT)"; $xls = print_xls($HTTP_POST_VARS, $xls); $fp = fopen("pheorders.txt", "a"); $fp1 = fopen("xlsorders.txt", "a"); fputs($fp, "===================\n"); fputs($fp, "Date: "); fputs($fp, date("F j, Y, g:i a")); fputs($fp, " +3\n"); fputs($fp, "Product: $form\n"); fputs($fp, "$body\n"); fputs($fp, "===================\n"); fputs($fp1, "$xls\n"); fclose($fp); fclose($fp1); mail($to, $form, $body, "From:$email\n"); include "thankyou.html"; } ?>