This repository has been archived by the owner on Apr 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
/
login.bit
41 lines (30 loc) · 1.47 KB
/
login.bit
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
37
38
39
40
41
<?php
// ============================================================================
// CONTROLLER
// ============================================================================
if( $Login->is_logued() || $Login->remember_me() )
Redirect::controller('admin','dashboard','view');
// ============================================================================
// POST
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$safe = array();
$safe['username'] = Validation::sanitize_html($_POST['username']);
$safe['password'] = Validation::sanitize_html($_POST['password']);
$Login->verify_login( array('username'=>$safe['username'], 'password'=>$safe['password']) );
if( $Login->is_logued() )
{
// Check remember me
if( isset($_POST['remember']) && $_POST['remember']=='1' )
$Login->set_remember_me();
// Notification - Session started
$_DB_NOTIFICATIONS->add('session_start', $settings['notification_session_start'], array('username'=>$safe['username']));
// Redirect to Dashboard
Redirect::controller('admin','dashboard','view');
}
// Notification - Session failed
$_DB_NOTIFICATIONS->add('session_fail', $settings['notification_session_fail'], array('username'=>$safe['username'], 'password'=>$safe['password']));
Session::set_alert($_LANG['INCORRECT_USERNAME_OR_PASSWORD'].'. <a href="'.HTML_PATH_ROOT.'admin.php?controller=user&action=send_forgot">'.$_LANG['FORGOT_PASSWORD'].'</a>');
}
?>