forked from clee231/Flourish-Conference-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
executable file
·75 lines (59 loc) · 2.82 KB
/
registration.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
define('SITE_PATH', './');
define('HACKFREE', 1);
//// INCLUDE INFO
include (SITE_PATH."common.php");
if ( $_POST )
{
$recaptcha_response = recaptcha_check_answer( RECAPTCHA_PRIVATE_KEY, $_SERVER['REMOTE_ADDR'], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if ( !$recaptcha_response->is_valid )
{
$error = "The recaptcha code that you entered is not valid";
}
if ( !$_POST['name'] ) $error = "Please enter your name";
if ( !$_POST['email'] ) $error = "Please enter your email";
if ( !$_POST['student'] ) $error = "Please enter whether you are a UIC student or not";
if ( $_POST['size'] != "small" && $_POST['size'] != "medium" && $_POST['size'] != "large" && $_POST['size'] != "xl" && $_POST['size'] != "xxl" && $_POST['size'] != "" ) $error = "Please enter a proper T-Shirt size";
if ( $_POST['student'] != "yes" && $_POST['student'] != "no" ) $error = "Please enter a proper student status";
$stmt = $db->stmt_init();
$sql = "INSERT INTO ". REGISTRATION_TABLE ." (`name`, `email`, `size`, `student`, `hear`, `comments`, `ip_address`, `where`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
if ( $stmt->prepare($sql) && !$error)
{
$stmt->bind_param("ssssssss", $_POST['name'], $_POST['email'], $_POST['size'], $_POST['student'], $_POST['hear'], $_POST['comments'], $_SERVER['REMOTE_ADDR'], $_POST['where']);
if( $stmt->execute() )
{
$smarty->assign('successMessage', "Thank you for registering for Flourish Conference 2012! An email has been sent confirming your proposal. We will send you updates on the conference as soon as we have more information.");
$headers = 'From: event@flourishconf.com' . "\r\n" .
'Reply-To: event@flourishconf.com' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = "Thank you for Registering for Flourish Conference 2012! Here are the details that you have entered:<br />";
foreach ( $_POST as $key => $value )
{
if ( $key != "recaptcha_challenge_field" && $key != "submit" && $key != "recaptcha_response_field")
$message .= $key .": ". strip_tags($value)."<br />";
}
mail($_POST['email'], "Thank you for registering for Flourish Conference 2012!", $message, $headers);
$success = true;
}else{
$success = false;
}
$stmt->close();
}else{
$success = false;
}
if ( !$success && !$error )
{
$error ="There was an error regestering you for the conference, please email us at <a href=\"mailto:". CONTACT_EMAIL ."\">". CONTACT_EMAIL ."</a> to report the error.";
}
if ( $error ) $smarty->assign('message', $error);
}
$smarty->assign('recaptcha', recaptcha_get_html(RECAPTCHA_PUBLIC_KEY));
$smarty->assign('POST', $_POST);
//We reached end, parse and end
include (SITE_PATH."footer.php");
if ( $success )
$smarty->display('thanks.tpl');
else
$smarty->display('registration.tpl');
//We're out of here.
?>