Subversion Repositories taios

Rev

Rev 348 | Rev 355 | 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
}
354 tom 30
$resp = recaptcha_check_answer(RECAPTCHA_PRIVATEKEY,$ _SERVER["REMOTE_ADDR"],
31
                               $_POST["recaptcha_challenge_field"],
32
                               $_POST["recaptcha_response_field"]);
169 tom 33
 
354 tom 34
if (!$resp->is_valid)
35
{
36
    $page->redirect('register.php?error=Incorrect reCAPTCHA response');
37
}
38
 
169 tom 39
$page->query('INSERT INTO Users (AccessID, Username, Password, EmailAddress, Name, ChallengeID) VALUES (2, "' . $username . '", "' . sha1($password) . '", "' . $email . '", "' . $name . '", 0)');
40
 
41
$page->redirect('login.php');
42
 
43
?>