2015-03-27 02:00:01 +01:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2015-08-03 02:49:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Check role
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-08-18 04:02:19 +02:00
|
|
|
function checkPost($args)
|
|
|
|
{
|
|
|
|
global $Security;
|
|
|
|
global $Login;
|
|
|
|
global $Language;
|
|
|
|
|
|
|
|
if($Security->isBlocked()) {
|
|
|
|
Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes'));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify User sanitize the input
|
|
|
|
if( $Login->verifyUser($_POST['username'], $_POST['password']) )
|
|
|
|
{
|
|
|
|
Redirect::page('admin', 'dashboard');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bruteforce protection, add IP to blacklist.
|
|
|
|
$Security->addLoginFail();
|
|
|
|
Alert::set($Language->g('Username or password incorrect'));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-08-03 02:49:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-03-27 02:00:01 +01:00
|
|
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
|
|
|
{
|
2015-08-18 04:02:19 +02:00
|
|
|
checkPost($_POST);
|
2015-08-03 02:49:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main after POST
|
|
|
|
// ============================================================================
|