Rev 354 | Rev 356 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 169 | tom | 1 | <?php |
| 2 | |||
| 3 | require '_taios.php'; |
||
| 348 | tom | 4 | require_once '_recaptchalib.php'; |
| 169 | tom | 5 | |
| 6 | $page = new Taios_Page('Login'); |
||
| 7 | |||
| 8 | $username = $_POST['username']; |
||
| 9 | $password = $_POST['password']; |
||
| 10 | $password2 = $_POST['password2']; |
||
| 11 | $email = $_POST['email']; |
||
| 12 | $name = $_POST['name']; |
||
| 13 | |||
| 14 | if (empty($username)) |
||
| 15 | { |
||
| 16 | $page->redirect('register.php?error=No Username Specified'); |
||
| 17 | } |
||
| 18 | if (empty($password)) |
||
| 19 | { |
||
| 20 | $page->redirect('register.php?error=No Password Specified'); |
||
| 21 | } |
||
| 22 | if (empty($password2)) |
||
| 23 | { |
||
| 24 | $page->redirect('register.php?error=No Repeat Password Specified'); |
||
| 25 | } |
||
| 26 | if ($password != $password2) |
||
| 27 | { |
||
| 28 | $page->redirect('register.php?error=Passwords do not match'); |
||
| 29 | } |
||
| 355 | tom | 30 | |
| 31 | $resp = recaptcha_check_answer(RECAPTCHA_PRIVATEKEY, _SERVER["REMOTE_ADDR"], |
||
| 354 | tom | 32 | $_POST["recaptcha_challenge_field"], |
| 33 | $_POST["recaptcha_response_field"]); |
||
| 169 | tom | 34 | |
| 354 | tom | 35 | if (!$resp->is_valid) |
| 36 | { |
||
| 37 | $page->redirect('register.php?error=Incorrect reCAPTCHA response'); |
||
| 38 | } |
||
| 39 | |||
| 169 | tom | 40 | $page->query('INSERT INTO Users (AccessID, Username, Password, EmailAddress, Name, ChallengeID) VALUES (2, "' . $username . '", "' . sha1($password) . '", "' . $email . '", "' . $name . '", 0)'); |
| 41 | |||
| 42 | $page->redirect('login.php'); |
||
| 43 | |||
| 44 | ?> |