Welcome Guest, Not a member yet? Register   Sign In
Session Not Destroy
#1

[eluser]ahora[/eluser]
Hello

this see in code
<?PHP

class admin extends Controller
{
function desktop()
{
$this->load->library('session');
if(!$this->session->userdata('login'))
header('location: ../login/');
echo $this->session->userdata('login')
.'<br>'
.'<a href="../logout/">logout</a>';
}

function login()
{
$this->load->library('session');
$this->load->database();

$sHtml['title'] = 'Please Login';
$login['user'] = $this->input->post('nitUserAdmin', true);
$login['pass'] = $this->input->post('nipPassAdmin', true);
$login['erro'] = 'NO';

if($this->input->post('nihFrmLoginAdmin')){
$query = "SELECT * FROM admin WHERE username='"
.$login['user']
."' AND password='"
.$login['pass']
."'";
$query = $this->db->query($query);
$numRow = $query->num_rows();
if($numRow == 1){
$this->session->set_userdata('login', $login['user']);
header('location: ../desktop/');
}
else{
$login['erro'] = 'username/password invalid';
}
}

$this->load->view('admin/sHtml', $sHtml);
$this->load->view('admin/login', $login);
$this->load->view('admin/eHtml');
}

function logout()
{
$this->load->library('session');
$this->session->unset_userdata('login');
header('location: ../login/');
}
}
?&gt;


This is Problem.... when this page back.... refresh page show admin....
#2

[eluser]Bramme[/eluser]
very sorry, but you'll have to try and explain your problem a bit better. I'd love to help but I simply can't understand what you mean...
#3

[eluser]ahora[/eluser]
yes

when want logout... click on logout and move to page login

ok ?

now click on back .... move to page replay admin

ok?

now i want when click on back .... replay move to login .. because user is logout
.
ok ?
#4

[eluser]Colin Williams[/eluser]
We don't even see a 'replay' controller function? What are we missing?

Sounds to me like if a user logs out, they are logged out and shouldn't have access to the admin functions. So where exactly is the problem?
#5

[eluser]ahora[/eluser]
I problem To Spleak Engish

I am Speak Persian

can you Speak Persian ?
#6

[eluser]mglinski[/eluser]
Replace
Code:
$this->session->unset_userdata('login');
with
Code:
$this->session->sess_destroy();
-Matt
#7

[eluser]Colin Williams[/eluser]
There might be parts of the session he wants to maintain.
#8

[eluser]mglinski[/eluser]
Then why not save those parts in an array from the current session, destroy the old one, and then create a new one? The removal function does not seem to be working as expected.
-Matt
#9

[eluser]Colin Williams[/eluser]
The removal function works fine. If you don't think so, try it out yourself. If you can produce a case where it fails, show us. The problem, I believe, is elsewhere. We're just having a bit of trouble communicating to get at that place.




Theme © iAndrew 2016 - Forum software by © MyBB