• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
check session and redirect to login page

#1
Dear all,

I am making codeiginter php web site. I have login session. But how to check the session login expired and redirect to login page in less code way. I have the header php web page in which I want to code something to achieve this. Do you have any ideas ??
Reply

#2
(01-15-2016, 04:48 AM)rchiu5hk Wrote: Dear all,

I am making codeiginter php web site. I have login session. But how to check the session login expired and redirect to login page in less code way. I have the header php web page in which I want to code something to achieve this. Do you have any ideas ??

The easiest thing for you to do is look at how one of the existing CI auth libraries is doing it. Also, unless you like sitting around for hundreds of hours and making sure you have not introduced any security vulnerabilities into your site, you're better off using one of the existing CI auth libraries.
Reply

#3
Code:
$this->load->library('session');

Code:
if ($this->session->userdata('logged_in')) {

// code statements My Account
else
{
redirect('login', 'refresh');
}
Web Developer
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.