24 lines
645 B
PHP
24 lines
645 B
PHP
|
<?php
|
||
|
require('../incl/const.php');
|
||
|
require('../class/database.php');
|
||
|
require('../class/user.php');
|
||
|
|
||
|
session_start();
|
||
|
if(isset($_SESSION['user'])) {
|
||
|
header("Location: ../../index.php");
|
||
|
}
|
||
|
|
||
|
$database = new Database(DB_HOST, DB_NAME, DB_USER, DB_PASS, DB_PORT, DB_SCMA);
|
||
|
$user_obj = new user_Class($database->getConn(), 0);
|
||
|
|
||
|
if(isset($_POST['submit'])&&!empty($_POST['submit'])){
|
||
|
$row = $user_obj->loginCheck($_POST['pwd'], $_POST['email']);
|
||
|
if($row){
|
||
|
$_SESSION['user'] = $row;
|
||
|
header("Location: ../../index.php");
|
||
|
}else{
|
||
|
header("Location: ../../login.php?err=".urlencode('Error: Failed to login!'));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|