3v4l.org

run code in 300+ PHP versions simultaneously
<?php //create short variable names $phonee=$_POST['Phone']; $nn="[a-zA-Z]"; $honda=1; $name = check_input($_POST['FirstName']); //run check_input function all all incoming data $fromEmail = check_input($_POST['Email']); $toaddress = "kcambridge@est-static.com"; //INITIAL VALIDATION //Function checks input and strips potential dangerous characters so injection code cannot be //interpereted correctly function check_input($data) { $data = trim($data); // strips any quotes escaped with slashes $data = stripslashes($data); //strips slashes $data = htmlspecialchars($data); //replaces HTML characters like > with HTML version &lt; return $data; } function isEmailValid($fromEmail) { $pattern = "^[_a-z0-9.-]+(\._a-z0-9.-+)*@[a-z0-9.-]+(\.[a-z0-9.-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern,$fromEmail)) { //eregi - case insensitive regular expression match return true; } else { return false; } } //FORM SUBMISSION VALIDATION //Scipt checks for new line characters like "\r" or "\n" which allows spam to create a new line //in email headers. If these characters are found return ERROR if (((!isEmailValid($fromEmail)) || ($fromEmail == "")|| (strlen($_POST["Phone"]) < 10 ) || preg_match("/$nn/",$phonee))) { echo "Error - From email address is Invalid or has been left blank or Phone number is not valid." . "<br/><br/>" . "Please return to form and re-enter a valid Email Address or phone number." . "<br/><br/>"; } else { $to = "kcambridge@est-static.com"; $subject = "Aegis Newsletter Signup"; $from = $_POST['Email']; $message =''. " \n"; foreach($_POST as $name => $data) { if(is_array($data)) { foreach($data as $datum) $message .= $name . ": " . $datum . " \n"; } else $message .= $name . ": " . $data . " \n"; } # Attempt to send email if(mail($to, $subject, $message, "From: $fromEmail")) header('location:thanks.htm'); else echo "Mail send failure - message not sent";} ?>

preferences:
48.03 ms | 402 KiB | 5 Q