All pastes #110763 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-08-01 22:04 UTC
rendered paste body
<?php 

    function valid_email($email) {
	
		$atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';    // allowed characters for part before "at" character
		$domain = '([a-z]([-a-z0-9]*[a-z0-9]+)?)'; // allowed characters for part after "at" character

		$regex = '^' . $atom . '+' .        // One or more atom characters.
		'(\.' . $atom . '+)*'.              // Followed by zero or more dot separated sets of one or more atom characters.
		'@'.                                // Followed by an "at" character.
		'(' . $domain . '{1,63}\.)+'.        // Followed by one or max 63 domain characters (dot separated).
		$domain . '{2,63}'.                  // Must be followed by one set consisting a period of two
		'$';                                // or max 63 domain characters.
		
		if (strlen($email) == 0) {
			return false;			
		}
		if (eregi($regex, $email)) {
			return true;
		}

		return false;
	}


if(isset($_POST["button"])) { 
	//header 
	
	ini_set ("sendmail_from","contact@i-trash.com"); 

	// Your email address 
	$email = $_POST['email']; 
	if (!(is_email_type($email))) 
	{ 
		$msg = "<h1><font color=red>Bad Email Address</font></h1>"; 
		$isEmail = false; 
	} 
	//to email 
	// You can add mor than one email here
	// antonnid@gmail.com,erm@the-erm.com,another@whereever.com
	$toemail = "antonnid@gmail.com"; 	

	// The subject 
	$subject = $_POST['subject']; 

	// The message 
	$message = $_POST['message']; 

	if($isEmail) 
	{ 
		mail($toemail, $subject, $message, "From: $email"); 
		echo "Your message has been sent. I will reply as soon as i can i apreaciate your suggestions."; 
	} 
	else 
	{ 
		echo $message; 
	}
	echo "Your email has been sent.";
	exit;
}


?> 

<html> 
<head> 
<link rel="stylesheet" type="text/css" href="/itrash.css"> 
</head> 
<body id="body"> 
<div id="border"> 

<form method="post"> 

   <p align="center"><b>Contact Me</b></p> 
    <table border="1" cellspacing="0" align="center">     
    <tr> 
        <td>From:</td> 
        <td><input type="text" name="email"></td> 
    </tr> 
    <tr> 
        <td>Subject:</td> 
        <td><input type="text" name="subject"></td> 
    </tr> 
    <tr> 
        <td>Message:</td> 
        <td><textarea rows="5" name="message" maxlength="500"></textarea></td> 
    </tr> 
    </table> 
    <p align="center"> 
    <input type="submit" name="button" /> 
  <p align="center"> 
  </p> 
  <p align="center"><a href="/source/contact_me.php"><b>source code</b></a> </p> 
</form> 
<!-- 
<p align="center">From: 
    <input type="text" name="femail"> 
    Subject: 
    <input type="text" name="subject"> 
    Message: 
    <input type="text" name="message"> !--> 
  </div> 
</body> 
</html>