本文整理匯總了PHP中role::manager_actions方法的典型用法代碼示例。如果您正苦於以下問題:PHP role::manager_actions方法的具體用法?PHP role::manager_actions怎麽用?PHP role::manager_actions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類role
的用法示例。
在下文中一共展示了role::manager_actions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
function index()
{
//判斷用戶是否是已經登錄狀態
$data = role::get_manager();
if ($data['id'] > 0) {
$data['success'] = 'true';
$data['msg'] = 1;
} else {
$data['success'] = 'false';
$data['msg'] = 1;
}
$username = $this->input->post('username');
$password = $this->input->post('password');
$secode = $this->input->post('secode');
$remember = $this->input->post('remember');
$data['success'] = 'false';
//驗證登錄
$manager = role::log_in($username, $password);
if (isset($manager['username'])) {
//判斷普通賬號的狀態、權限
if (!role::is_root($manager['username'])) {
if ($manager['active'] != 1) {
ulog::login($manager['id'], 1);
$data['msg'] = Kohana::lang('o_global.account_was_locked');
}
$actions = role::manager_actions($manager['id'], TRUE);
if (count($actions) < 1) {
ulog::login($manager['id'], 2);
$data['msg'] = Kohana::lang('o_global.account_permission_enough');
}
}
//是否記錄用戶名
if ($remember == 1) {
cookie::set('opococ_username', $username);
} else {
cookie::delete('opococ_username');
}
//清除記錄登錄錯誤記錄
//Session::instance()->delete('login_error_count');
//記入SESSION
role::set_manager_session($manager);
//記錄日誌
ulog::login($manager['id']);
$data['success'] = 'true';
$data['msg'] = 1;
/*if(empty($request_url))
{
remind::set(Kohana::lang('o_global.login_success'), '/index', 'success');
}
else
{
$request_url = url::base() . urldecode($request_url);
remind::set(Kohana::lang('o_global.login_success'), $request_url, 'success');
}*/
}
die(json_encode($data));
}
示例2: index
/**
* log in
*/
function index()
{
$this->logout(FALSE);
/* 原請求頁麵 */
$request_url = $this->input->get('request_url');
//用戶名和密碼輸入錯誤三次後就需要輸入驗證碼
$login_error_count = Session::instance()->get('login_error_count');
if (!$login_error_count) {
$login_error_count = 1;
Session::instance()->set('login_error_count', $login_error_count);
}
//判斷用戶是否是已經登錄狀態
$data = role::get_manager();
//D($data);
if ($data['id'] > 0) {
remind::set(Kohana::lang('o_global.current_status_login'), '/', 'success');
}
//驗證碼KEY
secoder::$seKey = 'opococ.secoder';
//錯誤信息
$message = remind::get_message();
if (empty($message)) {
$error_display = "none";
$error = "";
} else {
$error_display = "";
$error = $message;
}
//登錄
if ($_POST) {
$username = $this->input->post('username');
$password = $this->input->post('password');
$secode = $this->input->post('secode');
$remember = $this->input->post('remember');
//驗證驗證碼
if ($login_error_count > 3 && !secoder::check($secode)) {
remind::set(Kohana::lang('o_global.code_input_error'), 'login');
}
//驗證登錄
$manager = role::log_in($username, $password);
if (isset($manager['username'])) {
//判斷普通賬號的狀態、權限
if (!role::is_root($manager['username'])) {
if ($manager['active'] != 1) {
ulog::login($manager['id'], 1);
remind::set(Kohana::lang('o_global.account_was_locked'), 'login');
}
$actions = role::manager_actions($manager['id'], TRUE);
if (count($actions) < 1) {
ulog::login($manager['id'], 2);
remind::set(Kohana::lang('o_global.account_permission_enough'), 'login');
}
}
/* 是否記錄用戶名 */
if ($remember == 1) {
cookie::set('opococ_username', $username);
} else {
cookie::delete('opococ_username');
}
//清除記錄登錄錯誤記錄
Session::instance()->delete('login_error_count');
//記入SESSION
role::set_manager_session($manager);
//記錄日誌
ulog::login($manager['id']);
if (empty($request_url)) {
remind::set(Kohana::lang('o_global.login_success'), '/index', 'success');
} else {
$request_url = url::base() . urldecode($request_url);
remind::set(Kohana::lang('o_global.login_success'), $request_url, 'success');
}
} else {
ulog::login();
$login_error_count++;
Session::instance()->set('login_error_count', $login_error_count);
remind::set(Kohana::lang('o_global.user_and_password_error'), 'login');
}
}
/* 瀏覽器記錄的用戶名 */
$username = cookie::get('opococ_username');
$this->template = new View('login');
$this->template->login_error_count = $login_error_count;
$this->template->error = $error;
$this->template->error_display = $error_display;
$this->template->username = $username;
$this->template->render(TRUE);
}