Welcome Guest, Not a member yet? Register   Sign In
Tank_Auth error message when session expires
#2

[eluser]dinhtrung[/eluser]
Seems like the error appears because of setcookie() function in Sessions library, not by Tank_Auth. Because redirect() use header to redirect the page, too, and setcookie() also a header function, so this collision appears. As a replacement, you could render an auto-update page and redirect later. I usually did this:
Code:
function __construct()
{
    parent::__construct();
    if ($this->tank_auth->is_logged_in == FALSE){
        $info['message'] = "You are not logged in. Please login to continue.";  # Message to display to the user.
        $info["url"] = site_url('auth/login');  # The url we gonna redirect to
        # $info['time'] = 2; # Number of seconds the info page should be display before redirect.
        echo $this->load->view('info', $info, TRUE);
        exit;
    } else ....
For the info view in the last echo statement:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="refresh" content="&lt;?= (isset($time))?$time:'1000' ?&gt;; URL=&lt;?= $url; ?&gt;"&gt;
&lt;title&gt;Information&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<h3>Information</h3>
<p class='notice'>&lt;?= $message; ?&gt;</p>
&lt;/body&gt;
Please feed back if this method works. Wink


Messages In This Thread
Tank_Auth error message when session expires - by El Forum - 12-02-2009, 05:07 AM
Tank_Auth error message when session expires - by El Forum - 12-02-2009, 10:04 AM
Tank_Auth error message when session expires - by El Forum - 12-02-2009, 10:22 AM
Tank_Auth error message when session expires - by El Forum - 12-03-2009, 03:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB