|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/simes/ |
Upload File : |
<?php
// Make sure the form has actually been submitted
if (!isset($_POST["name"])) die("No Direct Access");
$name = $_POST["name"];
$email = $_POST["email"];
$spam = $_POST["username"]; // Honeypot
//$error[] = preg_match("/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i", $_POST["email"]) ? "" : "INVALID EMAIL ADDRESS";
if (!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$", $email)) {
$error .= "Invalid email address entered";
$errors = 1;
}
if ($errors == 1) echo $error;
else {
$values = array("name", "email");
$required = array("name", "email");
$your_email = "[email protected]";
$email_subject = "New Email Sign Up";
$email_content = "New Email Sign Up. Please add to list:\n";
foreach ($values as $key=>$value) {
if (in_array($value, $required)) {
if ($key != "name" && $key != "email") {
if (empty($_POST[$value])) {
echo "PLEASE FILL IN REQUIRED FIELDS";
exit;
}
}
$email_content .= $value.": ".$_POST[$value]."\n";
}
}
if (@mail($your_email, $email_subject, $email_content)) echo "You have been added!";
else echo "ERROR!";
// If the Honeypot field has been filled in
if ($spam) die("No spamming allowed");
else {
// Process the form like normal
}
}
?>