All pastes #393637 Raw Edit

Untitled

public php v1 · immutable
·published 2007-03-13 18:51 UTC
rendered paste body
<?php//change contactform below to whatever your form name is. I added this to prevent people typing the url in directly and  sending emails without the contact form.	if (strstr ($_SERVER['HTTP_REFERER'], 'contact')) { 	///////////////////////////////////////////////////////////////	//                    change these values                   //	/////////////////////////////////////////////////////////////	$to = "nick@bigfootdesigns.co.uk"; //email address to send to	$subject = "Bigfoot Designs Feedback"; //subject when you recieve the mail 	$headers = 'From: nick@bigfootdesigns.co.uk'; //change this	 	//do not change these unless you changed the ids and names of your form of your form	$name = $_REQUEST['name']; 	$email = $_REQUEST['email'];	$email_message = $_REQUEST['message'];	$id = $_REQUEST['id']; //id of the div around your submit/send button	$ip = $_SERVER['REMOTE_ADDR'];   //the main body of the email	$message = "You have been given an email via your contact form:\n Name: ". $name ."\n Email Address: " 				. $email ."\n Message: ". $email_message . "\n\n The message was sent from IP address: " .$ip;	//check for valid email address    $success = eregi("^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$", $email);		if ($success) {		if ($sent = mail($to, $subject, stripslashes($message), $headers)) {      	//sleep(2);//only if you want it to		echo "<img src='img/yes.png' alt='success' /> Message Sent! <br>";	  }    }			else {		echo "<img src='img/no.png' alt='fail' /> There was a problem sending the message.<br /> Please check you have " 			."provided a valid email address. Click <a href='#' onclick='showbutton()'>here</a> to try again."; 	}	}  else { //if someone trys to type the url in directly, e.g. http://www.yourdomain/mailman.php?name=blah&email=blah&message=blah&id=blah //this is the message they will see.	echo "Message NOT sent! Use the contact form!<br>";	exit;}?>