diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2009-10-18 18:43:30 +0200 |
---|---|---|
committer | Andreas Habel <mail@exceptionfault.de> | 2009-10-18 18:50:37 +0200 |
commit | 811908812766bd2850ac6ce865d1c6751c733bbb (patch) | |
tree | 139aef769f4db033c05dd37dac6f8000663cc6ec /registration.php | |
parent | 935897a79a6014bc0c34285e3a58e872864de1e4 (diff) | |
download | website-811908812766bd2850ac6ce865d1c6751c733bbb.tar.gz website-811908812766bd2850ac6ce865d1c6751c733bbb.tar.bz2 website-811908812766bd2850ac6ce865d1c6751c733bbb.tar.xz website-811908812766bd2850ac6ce865d1c6751c733bbb.zip |
Added gender to the registration form and more input verification
Diffstat (limited to 'registration.php')
-rw-r--r-- | registration.php | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/registration.php b/registration.php index 02a1911..6d3e73a 100644 --- a/registration.php +++ b/registration.php @@ -10,11 +10,11 @@ if (isset($_POST['register']) && $_POST['register'] == "true") { - // handle registration + // handle registration if (!isset($_POST['username']) || strlen($_POST['username']) < 4) { $err = "Username is not given or too short!"; $showform = true; - } + } else if (!isset($_POST['password1']) || strlen($_POST['password1']) < 4) { $err = "Password is not given or too short!"; $showform = true; @@ -23,10 +23,22 @@ { $err = "Password is not given or too short!"; $showform = true; } + else if (!ctype_alnum($_POST['username'])) + { + $err = 'Username contains invalid characters. Only alphanumeric characters are allowed.'; $showform = true; + } + else if (!ctype_alnum($_POST['password1'])) + { + $err = 'Password contains invalid characters. Only alphanumeric characters are allowed.'; $showform = true; + } else if ($_POST['password2'] != $_POST['password1']) { $err = "The given passwords don't match!"; $showform = true; - } + } + else if ($_POST['gender'] != 1 && $_POST['gender'] != 2) + { + $err = 'Please select your preferred gender.'; $showform = true; + } else { // check captcha @@ -35,21 +47,18 @@ $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); - if (!$resp->is_valid) + if (!$resp->is_valid) { - $err = "The captcha was incorret!"; $showform = true; + $err = "The captcha was incorrect!"; $showform = true; } else { - // everything was fine, create account $showform = false; // create a new account with ladmin here.... } } - - } if ($showform) @@ -82,6 +91,16 @@ <td><input type="password" size="20" name="password2" /></td> </tr> <tr> + <td>Gender:</td> + <td> + <select name="gender"> + <option value="0" selected></option> + <option value="1">Male</option> + <option value="2">Female</option> + </select> + </td> + </tr> + <tr> <td colspan="2"> <?php echo recaptcha_get_html($publickey); ?> </td> |