Email Entry

Posted on
Words:
Screen%20Shot%202016-07-14%20at%2014.21.31_0

)/i”, $_POST[‘comments’])) $points += 2; if (strlen($_POST[‘name’]) < 3) $points += 1; if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500)) $points += 2; if (preg_match(“/[bcdfghjklmnpqrstvwxyz]{7,}/i”, $_POST[‘comments’])) $points += 1; // end score assignments foreach($requiredFields as $field) { trim($_POST[$field]); if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != “Please fill in all the required fields and submit again.rn”) $error_msg[] = “Please fill in all the required fields and submit again.”; } if (!empty($_POST[‘name’]) && !preg_match(“/^[a-zA-Z-‘s]*$/”, stripslashes($_POST[‘name’]))) $error_msg[] = “The name field must not contain special characters.rn”; if (!empty($_POST[’email’]) && !preg_match(‘/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+’ . ‘(.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i’, strtolower($_POST[’email’]))) $error_msg[] = “That is not a valid e-mail address.rn”; if (!empty($_POST[‘url’]) && !preg_match(‘/^(http|https)://(([A-Z0-9][A-Z0-9_-]*)(.[A-Z0-9][A-Z0-9_-]*)+)(:(d+))?/?/i’, $_POST[‘url’])) $error_msg[] = “Invalid website url.rn”; if ($error_msg == NULL && $points <= $maxPoints) { $subject = "Automatic Form Email"; $message = "You received this e-mail message through your website: nn"; foreach ($_POST as $key => $val) { if (is_array($val)) { foreach ($val as $subval) { $message .= ucwords($key) . “: ” . clean($subval) . “rn”; } } else { $message .= ucwords($key) . “: ” . clean($val) . “rn”; } } $message .= “rn”; $message .= ‘IP: ‘.$_SERVER[‘REMOTE_ADDR’].”rn”; $message .= ‘Browser: ‘.$_SERVER[‘HTTP_USER_AGENT’].”rn”; $message .= ‘Points: ‘.$points; if (strstr($_SERVER[‘SERVER_SOFTWARE’], “Win”)) { $headers = “From: sam@1.ccrn”; } else { $headers = “From: http://www.1.cc rn”; } $headers .= “Reply-To: {$_POST[’email’]}rn”; if (mail($sam@1.cc,$subject,$message,$headers)) { if (!empty($thanksPage)) { header(“Location: http//www.1.cc); exit; } else { $result = ‘Your mail was successfully sent.’; $disable = true; } } else { $error_msg[] = ‘Your mail could not be sent this time. [‘.$points.’]’; } } else { if (empty($error_msg)) $error_msg[] = ‘Your mail looks too much like spam, and could not be sent this time. [‘.$points.’]’; } } function get_data($var) { if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]); } ?>

p.error, p.success {
font-weight: bold;
padding: 10px;
border: 1px solid;
}
p.error {
background: #ffc0c0;
color: #900;
}
p.success {
background: #b3ff69;
color: #4fa000;
}

ERROR: ‘. implode(”
“, $error_msg) . ”
 
“; } if ($result != NULL) { echo ‘
‘. $result . ”
“; } ?>

Name: *

Leave a Reply