当用户直接通过CODEIGNITER中的URL打开仪表板页面时,询问登录页面 [英] ask login page when user opens dashboard page directly through URL in CODEIGNITER

查看:38
本文介绍了当用户直接通过CODEIGNITER中的URL打开仪表板页面时,询问登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仪表板页面..如果有人直接通过URL系统打开仪表板链接,则不允许他们打开该页面.

I have a dashboard page..if anyone opens dashboard link directly through URL system dosen't allow them to open that page..

当他们直接通过URL系统打开页面时,应询问LOGIN.请帮助我如何在codeigniter中执行此操作.

when they open page directly through URL system should ask LOGIN.. please help me how to do this in codeigniter..

推荐答案

如果未存储会话,则所有控制器检查会话数据是否可用,然后重定向到您的登录屏幕.将条件添加到__construct函数中并进行检查.

All of controller check session data available or not if session are not store then redirect to your login screen. put if condition to your __construct function and check it.

function __construct()
{
    parent::__construct();
    if(! isset($this->session->userdata['user_info'])){
        redirect($this->data['admin_url'].'authentication');
        exit ;
    }
}

这篇关于当用户直接通过CODEIGNITER中的URL打开仪表板页面时,询问登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆