CodeIgniter Forums
sess_destroy() and browser refresh - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: sess_destroy() and browser refresh (/showthread.php?tid=46037)



sess_destroy() and browser refresh - El Forum - 10-15-2011

[eluser]rajend3[/eluser]
My signout function calls sess_destroy() then loads a view through a function I created in a helper class. In my header view I check if uid is set and if it is display a signout button instead of a signin button. When I signout the signout button is still displayed unless I refresh the page. Any ideas on what I'm doing wrong?

Signout function
Quote: public function signout()
{
$this->session->sess_destroy();
load_view("home_view");
}

Load view helper function
Quote:if ( ! function_exists('load_view'))
{
function load_view($content, $data = null)
{
$CI =& get_instance();

if ($CI->session->userdata("uid") !== FALSE)
{
$data["uid"] = $CI->session->userdata("uid");
}


$data["content"] = $content;
$CI->load->view("includes/template_view", $data);
}
}

View:
Quote: <?php if (isset($uid)): ?>
<-a id="signin" class="blueButton" href="http://localhost/index.php/authentication_controller/signout">Sign out</a>
&lt;?php else: ?&gt;
<-a id="signin" class="blueButton" href="http://localhost/index.php/authentication_controller/signin">Sign in</a>
&lt;?php endif; ?&gt;