SessionTimeout))
{
$_SESSION['UserId'] = 0;
$_SESSION['UserName'] = '';
}
$_SESSION['Time'] = time();
return($_SESSION['UserId'] != 0);
}
function Login($Username, $Password)
{
global $Config;
global $Database;
$Database->select_db($Config['Mangos']['DatabaseRealmd']);
$DbResult = $Database->select('account', 'Id,username', '(gmlevel > 0) AND (username = "'.$Username.'") AND (sha_pass_hash = SHA1(CONCAT(UCASE("'.$Username.'"),":",UCASE("'.$Password.'"))))');
if($DbResult->num_rows > 0)
{
$User = $DbResult->fetch_array();
$_SESSION['UserId'] = $User['Id'];
$_SESSION['UserName'] = $User['username'];
echo('Byl jste přihlášen.
');
} else {
echo('Přístup nepovolen!
');
}
}
function Logout()
{
$_SESSION['UserId'] = 0;
echo('Byl jste odhlášen.
');
}
}
?>