wp/wp-content/themes/IN-MOTION-package-u1/in-motion/functions/contact.php
changeset 0 d970ebf37754
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wp/wp-content/themes/IN-MOTION-package-u1/in-motion/functions/contact.php	Wed Nov 06 03:21:17 2013 +0000
@@ -0,0 +1,49 @@
+<?php
+//If the form is submitted
+if(isset($_POST['submit'])) {
+
+	//Check to make sure that the name field is not empty
+	if(trim($_POST['contactname']) == '') {
+		$hasError = true;
+	} else {
+		$name = trim($_POST['contactname']);
+	}
+
+	//Check to make sure that the subject field is not empty
+	if(trim($_POST['subject']) == '') {
+		$hasError = true;
+	} else {
+		$subject = trim($_POST['subject']);
+	}
+
+	//Check to make sure sure that a valid email address is submitted
+	if(trim($_POST['email']) == '')  {
+		$hasError = true;
+	} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
+		$hasError = true;
+	} else {
+		$email = trim($_POST['email']);
+	}
+
+	//Check to make sure comments were entered
+	if(trim($_POST['message']) == '') {
+		$hasError = true;
+	} else {
+		if(function_exists('stripslashes')) {
+			$comments = stripslashes(trim($_POST['message']));
+		} else {
+			$comments = trim($_POST['message']);
+		}
+	}
+
+	//If there is no error, send the email
+	if(!isset($hasError)) {
+		$emailTo = get_option_tree( 'contact_page_email' );  /*Put your own email address here*/ 
+		$body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
+		$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
+
+		mail($emailTo, $subject, $body, $headers);
+		$emailSent = true;
+	}
+}
+?>
\ No newline at end of file