<?php
// Your Email Address
$youremail = "aal@mail-aal-forum.com";
// Register Form
if ( isset($_POST['email']) && isset($_POST['name']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
// Detect & Prevent Header Injections
$test = "/(content-type|bcc:|cc:|to:)/i";
foreach ( $_POST as $key => $val ) {
if ( preg_match( $test, $val ) ) {
exit;
}
}
// Email Format
$body = "New Registration for the MAIL workshop \n\n";
$body .= "========== \n\n";
$body .= "Name: $_POST[name] \n\n";
$body .= "Organization: $_POST[telephone] \n\n";
$body .= "Email: $_POST[email] \n\n";
//Send email
mail( $youremail, "New Event Registration", $body, "From:" . $_POST['email'] );
$data = $_POST[name] . ";" . $_POST[telephone].";".$_POST[email]."\n";
$ret = file_put_contents('subscribers.csv', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
}
/*
// Subscribe Form
if( isset($_POST['subscriber']) && filter_var($_POST['subscriber'], FILTER_VALIDATE_EMAIL) ) {
$data = $_POST['subscriber'] . ";" . "\n";
$ret = file_put_contents('subscribers.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
} else {
die('No post data to process');
}
*/
?>