Subversion Repositories taios

Rev

Rev 483 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 tom 1
<?php
2
 
3
require '_taios.php';
4
 
5
$page = new Taios_Page('Login');
6
 
7
$username = $_POST['username'];
8
$password = $_POST['password'];
9
$remember = $_POST['remember'] == 'yes';
10
 
11
if (empty($username))
12
{
13
    $page->redirect('login.php?error=No Username Specified');
14
}
15
if (empty($password))
16
{
17
    $page->redirect('login.php?error=No Password Specified');
18
}
19
 
20
$user = $page->getUserByUsername($username);
21
if (!$user || $user->password != sha1($password))
22
{
23
    $page->redirect('login.php?error=Incorrect Username or Password');
24
}
25
 
26
$expires = -1;
27
 
28
if ($remember)
29
{
30
    $expires = time() + 60 * 60 * 24 * 30;
31
}
32
 
33
setcookie('Tim32_Login', $user->username . '|~|' . $user->password, $expires, '/');
34
 
35
$page->redirect('index.php');
36
 
37
?>