rendered paste body<?php
function is_email_type($email) {
$email_types = array('gmail', 'yahoo', 'hotmail');
foreach ($email_types as $type) {
//int strpos ( string haystack, mixed needle [, int offset] )
if (strpos($email, '@'.$type) !== false) {
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 = "bad e-mail";
$isEmail = false;
}
//to email
$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 $msg;
}
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/itrash.css">
</head>
<body id="body">
<div id="border">
<?php
if (isset($_POST['email'])) {
?><font color="red">Bad Email</font><br><?php
}
?>
<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>