-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
31 lines (28 loc) · 875 Bytes
/
login.php
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
<?php
require('./includes/helpers.php');
require('./includes/password.php');
require('./classes/user.php');
$method = $_SERVER['REQUEST_METHOD'];
if($method == 'POST'){
//include the database
include_once('./conn/db.php');
if( !empty($_POST['email']) && !empty($_POST['password']) ){
$data = array(
'email' => $_POST['email'],
'password' => $_POST['password'],
'ip' => getIpAsInt());
$user = new User($data);
if($user->email === false){
header("Location: ./index.php");
}else {
if(!isset($_SESSION)) { session_start(); }
$_SESSION['id'] = $user->userID;
$_SESSION['Player'] = true;
header("Location: ./index.php");
}
}else
{
header("Location: ./index.php");
}
}
?>