Welcome Guest, Not a member yet? Register   Sign In
Working with flashdata for viewing pages
#1

[eluser]xtremer360[/eluser]
The purpose of this code is to check the set value of the user's status id to verify if they are even activated, banned, suspended, or deleted. I just happen to take checks to the extreme. I know if they are viewing the page they are on in my control panel they shouldn't have been able to get to this point but they are just extra checks but that's how I prefer to do things. My question is that am I performing these tasks correctly with in reference to the session flashdata and the redirect. What I'm wanting to do is say they have the proper credentials to view the page content but I go in and say delete their account. If they go to a different page with the same sort of if statements that it goes to the logout page and logs their session out and then also after it visits the logout page it redirects to the login page which I have already on that logout page but that on the login page if the flash data is set then it views it.

roster.php [controller] aids in the listing of my roster members
Code:
//permissions based code for that controller/view
//user is registered but not activated
if ($user_data->user_status_id == 1)
{
    $this->session->set_flashdata('message',    $this->config->item('user_account_deleted_message'));
    redirect('logout', 'refresh');
    $x++;
}
//user is suspended
if ($user_data->user_status_id == 3)
{
    $this->session->set_flashdata('message', $this->config->item('user_account_suspended_message'));
    redirect('logout', 'refresh');
    $x++;                
}
//user is banned
if ($user_data->user_status_id == 4)
{
    $this->session->set_flashdata('message', $this->config->item('user_account_banned_message'));
    redirect('logout', 'refresh');
    $x++;
}
//user is deleted
if ($user_data->user_status_id == 5)
{
    $this->session->set_flashdata('message', $this->config->item('user_account_deleted_message'));
    redirect('logout', 'refresh');
    $x++;                
}


logout.php
Code:
public function index()
{
    $this->session->keep_flashdata('message');
    $this->session->sess_destroy();
    $this->session->set_userdata(array('user_id' => '', 'username' => '', 'xtr' => '', 'role' => '', 'default_roster_id' => ''));
    redirect('login', 'refresh');
}

login_form_view.php
Code:
<?php if ($this->session->flashdata('message') && (!empty($this->session->flashdata('message'))))
{
    echo '<div class="alert">'.$this->session->flashdata('message').'</div>';    
}
#2

[eluser]xtremer360[/eluser]
Any ideas?
#3

[eluser]xtremer360[/eluser]
*bump*




Theme © iAndrew 2016 - Forum software by © MyBB