Contact Us'; function valid($mail) { $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+'; $domain = '(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+'; $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}'; $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'; return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail); } $goodstyle = '/^[a-z0-9()\/\'":\*+|,.; \- !?&#$@]{2,75}$/i'; if (isset($_SESSION['name'])) $_POST['name'] = $_SESSION['name']; if (isset($_SESSION['email'])) $_POST['email'] = $_SESSION['email']; if (isset($_POST['name'])) $name=trim($_POST['name']); else $name=""; if (isset($_POST['email'])) $email=trim($_POST['email']); else $email=""; if (isset($_POST['message'])) $message=$_POST['message']; else $message=""; if (isset($_POST['contactformseen'])) $contactformseen="y"; else $contactformseen="n"; $contactform='

Your Name

Your Email:

Your Message:

'; if($contactformseen!="y") { echo "$contactform"; } else { $errstr=""; if (strlen($name)<1) { $errstr.="At least tell us your first name.
"; } if (strlen($name>50)) { $errstr.="Wow, is your name really longer than 50 characters?
"; } if (!preg_match($goodstyle, $name)){ $errstr.="You must have hit the wrong key when typing your name. Just use ordinary letters.
"; } if (strlen($email)>128) { $errstr.="Your email address doesn't exceed 128 characters, does it? That's a long one.
"; } if (!valid($email)) { $errstr.="I think you entered an invalid email address.
"; } if (strlen($message)>2000) { $errstr.="Could you make your message a little shorter (say, less than 2000 characters)?
"; } if (!preg_match($goodstyle, $message)){ $errstr.="Could you go back and type your message in ordinary letters, without special codes?
"; } if ($errstr!='') { echo '
'; echo '

'.$errstr.'

'; echo '
'; echo $contactform; } else { if (isSet($_SERVER)) { if (isSet($_SERVER['HTTP_X_FORWARDED_FOR'])) { $realip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isSet($_SERVER['HTTP_CLIENT_IP'])) { $realip = $_SERVER['HTTP_CLIENT_IP']; } else { $realip = $_SERVER['REMOTE_ADDR']; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $realip = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) { $realip = getenv( 'HTTP_CLIENT_IP' ); } else { $realip = getenv( 'REMOTE_ADDR' ); } } $host = @gethostbyaddr($realip); $today = date("F j, Y, g:i a"); $sendmessage = "--------------------\n"; $sendmessage.= "Name: $name\n"; $sendmessage.= "Email: $email\n"; $sendmessage.= "Message:\n\n$message\n"; $sendmessage.= "--------------------\n"; $sendmessage.= "\n\nFrom IP: $realip\n"; $sendmessage.= "HOST: $host\n\n"; $sendmessage.= "Sent: $today"; $subject="Stylecascade Contact: ".$name; mail("michael@stylecascade.com", $subject, $sendmessage, "From: $name <$email>\r\nReply-To: $email\r\nX-Sender: Strong CONTACT (http://www.stronghtml.com)\r\nReturn-Path: <$email>"); echo '

Thank you for contacting Stylecascade.com. We will get back to you promptly.

'; } } include 'menu.htm'; include 'footer.htm'; ?>