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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<?php
include './inc/init.php';
/* Part of the HTML Executable Activation Kit
Copyright G.D.G. Software 2009-2011. All rights reserved.
Redistribution of this code is stricly prohibited.
*/
$action = fRequest::getValid(
'action',
array('log_out', 'log_in')
);
if ('log_out' == $action) {
fAuthorization::destroyUserInfo();
fMessaging::create('success', URL_ROOT.'/login.php', 'You were successfully logged out');
fURL::redirect(URL_ROOT.'/login.php?action=log_in');
fSession::destroy();
return;
}
if ('log_in' == $action) {
if (fRequest::isPost()) {
try {
$username = fRequest::get('username');
$pass = fRequest::get('password');
$valid_login = ($username == $adminname);
$valid_pass = ($pass == $adminpass);
/*fCryptography::checkPasswordHash(
fRequest::get('password'),
'fCryptography::password_hash#B8CnJMDK29#acdec016d3e6608703f1684139dcfa40e424eb55'
);*/
if (!$valid_login || !$valid_pass) {
throw new fValidationException('The login or password entered is invalid');
}
// We don't have any fancy users, so this is something to indicate the user is logged in
fAuthorization::setUserToken($username);
fURL::redirect(
fAuthorization::getRequestedURL(TRUE, URL_ROOT.'/index.php')
);
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
}
include 'templates/log_in.php';
return;
}
?> |
Partager