(root)/login-do.php @ 192 - Rev 495
Rev 483 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?php
require '_taios.php';
$page = new Taios_Page
('Login');
$username = $_POST['username'];
$password = $_POST['password'];
$remember = $_POST['remember'] == 'yes';
if(strpos($_POST['oldurl'], "tim32.org") === FALSE || strpos($_POST['oldurl'], "login") !== FALSE)
$redirurl = "http://tim32.org";
else
$redirurl = $_POST['oldurl'];
if (empty($username))
{
$page->redirect('login.php?error=No Username Specified&oldurl=' . urlencode($redirurl));
}
if (empty($password))
{
$page->redirect('login.php?error=No Password Specified&oldurl=' . urlencode($redirurl));
}
$user = $page->getUserByUsername($username);
if (!$user || $user->password !== sha1($password))
{
$page->redirect('login.php?error=Incorrect Username or Password&oldurl=' . urlencode($redirurl));
}
$expires = -1;
if ($remember)
{
$expires = time() + 60 * 60 * 24 * 30;
}
setcookie('Tim32_Login', $user->username . '|~|' . $user->password, $expires, '/');
$page->redirect($redirurl);
?>