Registration



Information | Programme | Contact | Registration | Payment

.spn_err { font-weight:bold; color:red; } "; # Print an error message if the form is incomplete. if ($passed == FALSE) { echo "Please complete all of the required fields.
"; } # Print an error message if the email address is invalid. if ($emailpassed == FALSE) { echo "Please enter a valid email address.
"; } # Print an error message if no days' accomodation have been selected. if ($accompassed == FALSE) { echo "Please select at least one night for which you require accomodation.
"; } # Print an error message if no poster title has been given. if ($posterpassed == FALSE) { echo "Please provide a title for your poster.
"; } # Print the form body. # Set ###### to the webpage address echo "
Contact details













Accommodation and meals Do you require accommodation?


If yes, please select the nights for which you require accomodation:



Please specify any dietary requirements you may have below.
"; } function check_fields(){ # Check that all the fields have been completed - returns false if any are incomplete. $pass_check = TRUE; foreach ($_POST as $key => $val) { if ((empty($val)) && (strpos($key,'opt') === FALSE )){ $pass_check = FALSE; } } return $pass_check; } function check_email() { # Check the email address is valid - returns TRUE on valid address. if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$_POST['a_email'])){ list($username,$domain)=split('@',$_POST['a_email']); if(!checkdnsrr($domain,'MX')) { return FALSE; } return TRUE; } return FALSE; } function check_accomodation() { if (($_POST['a_accomm'] == "Yes") && !( (isset($_POST['opt_a_accomm_full_sun8'])) || (isset($_POST['opt_a_accomm_full_mon9'])) )) { return FALSE; } return TRUE; } function check_poster() { if ( ($_POST['a_poster'] == "Yes") && ($_POST['opt_a_poster_title'] == "") ) { return FALSE; } return TRUE; } function mail_result(){ # Email the completed form to '######'. $to = 'mathmondes@pgr.reading.ac.uk'; $subject = "M_MONDES_REG_REQ"; $body = "\n\n"; foreach ($_POST as $key => $val) { $body .= $key . ": " . $val . "\n\n"; } mail($to,$subject,$body); # Set ###### to the location of the webpage header("Location: http://www.personal.reading.ac.uk/~xk023928/reg_form.php?register=true"); exit(); } if (isset($_GET['register'])){ # 'Thank you' message to the user echo "Thank you. Your registration has been submitted. An email confirmation will be sent to your email account shortly. If you have requested accomodation in the registration form, please click here to find details of how to make payment."; } else { if (!isset($_POST['submit'])){ # Default action - print the form. build_form(); } else { $passed = check_fields(); $emailpassed = check_email(); $accompassed = check_accomodation(); $posterpassed = check_poster(); if (($passed == FALSE) || ($emailpassed == FALSE) || ($accompassed == FALSE) || ($posterpassed == FALSE) ){ build_form($passed,$emailpassed,$accompassed,$posterpassed); } else { mail_result(); } } } ?>