3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Define some constants define( "RECIPIENT_NAME", "Kitchen Interiors" ); define( "RECIPIENT_EMAIL", "info@kitcheninteriors.ca" ); define( "EMAIL_SUBJECT", "Kitchen Interiors - Visitor Message" ); // Read the form values $success = false; $senderName = isset( $_POST['senderName'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['senderName'] ) : ""; $senderEmail = isset( $_POST['senderEmail'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : ""; $message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : ""; $messagecontent = "\r\n Name:" . $senderName . "\r\n Email:" . $senderEmail . "\r\n Message:" . $message; $SpamErrorMessage = "No Websites URLs permitted"; if(preg_match("/http/i", "$senderName")) {echo "$SpamErrorMessage"; exit();} if(preg_match("/http/i", "$senderEmail")) {echo "$SpamErrorMessage"; exit();} if(preg_match("/http/i", "$message")) {echo "$SpamErrorMessage"; exit();} $recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">"; $headers = "From: " . $senderName . " <" . $senderEmail . ">"; $success = mail( $recipient, EMAIL_SUBJECT, $messagecontent, $headers ); ?> <html> <head> <title>Thank You</title> </head> <body style="background-color:#1b1b1b;"> <div style="margin-left:auto; margin-right:auto; margin-top:200px; text-align:center; color:#fff !important; font-size:24px; line-height:30px; font-weight:bold; font-family:Arial;"> <?php if ( $success ) echo "<p>Thanks for sending your message! We'll get back to you shortly.</p>" ?> <?php if ( !$success ) echo "<p>There was a problem sending your message. Please try again.</p>" ?> <p>Click your browser's Back button to return to the page.</p> </div> </body> </html>
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
Warning: mail() has been disabled for security reasons in /in/VqA88 on line 23 <html> <head> <title>Thank You</title> </head> <body style="background-color:#1b1b1b;"> <div style="margin-left:auto; margin-right:auto; margin-top:200px; text-align:center; color:#fff !important; font-size:24px; line-height:30px; font-weight:bold; font-family:Arial;"> <p>There was a problem sending your message. Please try again.</p> <p>Click your browser's Back button to return to the page.</p> </div> </body> </html>
Output for hhvm-3.15.4
<html> <head> <title>Thank You</title> </head> <body style="background-color:#1b1b1b;"> <div style="margin-left:auto; margin-right:auto; margin-top:200px; text-align:center; color:#fff !important; font-size:24px; line-height:30px; font-weight:bold; font-family:Arial;"> <p>There was a problem sending your message. Please try again.</p> <p>Click your browser's Back button to return to the page.</p> </div> </body> </html>