Welcome Guest, Not a member yet? Register   Sign In
Problem with session flashdata
#1

[eluser]kevinh21[/eluser]
Hi everyone
I'm programming an administrator-backend for my website. I use the erkanaauth library to make this easier.

Now i have some problems with flashdata to show a message when the access is denied.

admin controller:

Code:
function settings()
{
   if($this->erkanaauth->try_session_login())
   {
      $this->_showSite('admin/settings', 'left_settings');
   }else{
      $this->session->set_flashdata('status', 'You must be logged in to view this page');
      $this->_showSite('admin/login');
   }
}
...
function _showSite($module, $leftmodule = false)
{
   $data['module'] = $module;
   if($leftmodule <> false) $data['left'] = $leftmodule;
   $this->load->view('admin_layout', $data);
}

admin/login.php (view):
Code:
<div class="content wide">
<h1 id="login">Login</h1>
<hr />

&lt;?=$this->validation->error_string;?&gt;
&lt;?php echo '<p class="notice">'.$this->session->flashdata('status').'</p>';?&gt;

&lt;form class="login" action="&lt;?=site_url('admin/login')?&gt;" method="post"&gt;
.....
&lt;/form&gt;

</div>

The Problem:
If i call admin/settings, it should check if i'm logged in. If not, it should set a flashdata message (status) and show the admin/login.php view with my function showSite().
In this view, it should display the flashmessage i set.

But he is not showing the message when i'm cliking on a link that refers to admin/settings.
I need to click at least twice, then it will show me the flashmessage.

What i'm doing wrong?


Messages In This Thread
Problem with session flashdata - by El Forum - 07-01-2008, 05:15 AM
Problem with session flashdata - by El Forum - 07-01-2008, 06:29 AM
Problem with session flashdata - by El Forum - 07-01-2008, 06:39 AM
Problem with session flashdata - by El Forum - 07-01-2008, 06:56 AM
Problem with session flashdata - by El Forum - 07-09-2008, 08:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB