(root)/register-do.php - Rev 479
Rev 356 |
Rev 500 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?php
require '_taios.php';
require_once '_recaptchalib.php';
$page = new Taios_Page
('Login');
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$email = $_POST['email'];
$name = $_POST['name'];
$maths = $_POST['maths'];
if (empty($username))
{
$page->redirect('register.php?error=No Username Specified');
}
if (empty($password))
{
$page->redirect('register.php?error=No Password Specified');
}
if (empty($password2))
{
$page->redirect('register.php?error=No Repeat Password Specified');
}
if ($password != $password2)
{
$page->redirect('register.php?error=Passwords do not match');
}
if ($maths != '75')
{
$page->redirect('register.php?error=Incorrect maths answer');
}
$resp = recaptcha_check_answer
(RECAPTCHA_PRIVATEKEY
, $_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid)
{
$page->redirect('register.php?error=Incorrect reCAPTCHA response');
}
$page->query('INSERT INTO Users (AccessID, Username, Password, EmailAddress, Name, ChallengeID) VALUES (2, "' . $username . '", "' . sha1($password) . '", "' . $email . '", "' . $name . '", 0)');
$page->redirect('login.php');
?>