aboutsummaryrefslogtreecommitdiffstats
path: root/php/login.php
blob: 6fb3909421f829f0beeac67498a87c09884b84e1 (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
<?php
require_once "user.php";
require_once "database.php";
require_once "misc.php";

session_start();

$username=$_POST["username"];
$password=$_POST["password"];
/*server side verification*/
if(gettype($username)!="string" || gettype($password)!="string")
{
	die("You didn't specify the pass or the username");
}

$user=$database->authenticate($username,$password);
if(!$user)
{
	die("Password or username is incorrect");
}

$_SESSION['user_object'] = $user;

header('Location: /');

?>