aboutsummaryrefslogtreecommitdiffstats
path: root/php/login.php
blob: 536a5bfb99c6dbf1d20075589996f8ab286c66a4 (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");
}

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

$_SESSION['username'] = $user->username;
header('Location: /');

?>