$validation = 1;
$email = trim($_REQUEST['email']);
$domlist = array("mil", "gov");
function validateExt($email, $domlist) {
foreach ($domlist as $dom) {
if( $dom == substr($email,-3) ) {
return true;
}
}
return false;
}
function addToFile($email) {
// append a file each time form is submitted
if($email=="") $email = "Someone submitted a blank form";
$thisfile = 'entries.txt';
// Open the file to get existing content
$thiscurrent = file_get_contents($thisfile);
$thiscurrent .= date("j-n-Y, g:i a") . " - " . $email . "\n";
file_put_contents($thisfile, $thiscurrent);
}
function sendEmail($email) {
// Send an email to the email address given
$subject = 'Divine Imaging Govt. Contract Product Files';
// Email text will not be html, all line breaks will show as a
// Change this text to whatever you'd like to send to the customer
$message = 'Thank you for requesting search access to Divine Imaging Contract Product files.
Just click on the following link and use the below User and Password to log in:
Link: https://divineimaging.com/divineproducts
User: viewer
Password: logmein
If you have any issues, please feel free to email us at info@divineimaging.com';
$headers = 'From: info@divineimaging.com' . "\r\n" .
'Reply-To: info@divineimaging.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
return mail($email, $subject, $message, $headers);
}
if(isset($_REQUEST['email'])) {
// addToFile function
addTofile($email);
// Validates $email is an email address
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
if($email=="") {
$validationText = "Please enter a valid email address";
} else {
$validationText = "
". $email . " is not a valid email address";
}
$validation = 1;
} else {
$validation = 0;
}
// Validate each extension against the given email address
if (validateExt($email, $domlist)) {
if(sendEmail($email)) {
$validation = 1;
$success = "Email has been sent";
} else {
$success = "Email has not been sent";
}
} else {
$validation = 1;
$validationText .= "
Email address does not have a .mil or .gov extension.";
}
}
if($validation==1) {
?>
![]() |
||||||||||||||||||
|
|