blob: 44356840d470ac6a5c5aa16342c39c355b28019d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
session_start();
require_once('vendor.inc.php');
if(isset($_GET['logout']))
{
session_destroy();
header('Location: login.php');
}
if(isset($_SESSION['username']))
{
header('Location: .');
}
if(isset($_POST['username']) && isset($_POST['password']))
{
$username = $_POST['username'];
$password = $_POST['password'];
$user = UserQuery::create()->findOneByUsername($username);
if ( !is_object($user) )
{
header('Location: login.php');
}
if($user->checkPassword($password))
{
$_SESSION['username'] = $username;
}
header('Location: .');
}
$smarty = new Smarty;
$smarty->display('login.tpl');
?>
|