Download this file

process.php    49 lines (39 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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');
}
*/
?>