-
Notifications
You must be signed in to change notification settings - Fork 1
/
auth.php
31 lines (29 loc) · 943 Bytes
/
auth.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 include_once('include/load.php'); ?>
<?php
$req_fields = array('username','password' );
validate_fields($req_fields);
$username = remove_junk($_POST['username']);
$password = remove_junk($_POST['password']);
if(empty($errors)){
$user_id = authenticate($username, $password);
if ($user_id > 0) {
//create session with id
$session->login($user_id);
//Update Sign in time
updateLastLogIn($user_id);
$session->msg("s", "Bienvenido a EASY BUSINESS ___ By Yoel Monsalve, Abril 2021.");
redirect(SITE_URL.'home.php',false);
} else if ($user_id == -2) {
$session->msg("w", "Usuario inactivo");
redirect(SITE_URL.'index.php',false);
}
else {
$session->msg("d", "Nombre de usuario y/o contraseña incorrecto.");
redirect(SITE_URL.'index.php',false);
}
}
else {
$session->msg("d", $errors);
redirect(SITE_URL.'index.php',false);
}
?>