forked from matteveland/inventory_old
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
36 lines (30 loc) · 718 Bytes
/
auth.php
File metadata and controls
36 lines (30 loc) · 718 Bytes
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
32
33
34
35
36
<?php
/**
* auth.php
*
* @package default
*/
include_once 'includes/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) {
//create session with id
$session->login($user_id);
//Update Sign in time
updateLastLogIn($user_id);
$session->msg("s", "Welcome to Inventory.");
redirect('home.php', false);
} else {
$session->msg("d", "Sorry Username/Password incorrect.");
redirect('index.php', false);
}
} else {
$session->msg("d", $errors);
redirect('index.php', false);
}
?>