📄 login.php
字号:
<?php
include_once('init.php');
$error = '';
function doLogin($userid) {
global $smarty;
$_SESSION['userid'] = $userid;
include('index.php');
exit;
}
if(($userid = ChatServer::isLoggedIn()) && ChatServer::userInRole($userid, ROLE_ADMIN))
{
doLogin($userid);
} else {
$_SESSION['userid'] = null;
}
if(isset($_REQUEST['do'])) {
if(($userid = ChatServer::login($_REQUEST['login'], $_REQUEST['password'])) && ChatServer::userInRole($userid, ROLE_ADMIN)) {
doLogin($userid);
} else {
$_SESSION['userid'] = null;
$error = 'Could not grant admin role for this login and password.';
}
} else {
$_SESSION['userid'] = null;
$_REQUEST['login'] = '';
$_REQUEST['password'] = '';
}
$installed = isInstalled();
if( !$installed )
{
$_SESSION['userid'] = null;
$error = 'FlashChat is not installed.';
}
//Assign Smarty variables and load the admin template
$smarty->assign('error',$error);
$smarty->assign('installed',$installed);
$smarty->display('login.tpl');
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -