2
I have a big problem with the function of displacing the panel, I made a public Function Logout()
Filing cabinet Login.class.php:
public function Logout(){
if($this->isLogged()) {
unset($_SESSION[$this->prefix.['email']]);
unset($_SESSION[$this->prefix.['password']]);
session_destroy();
return true;
} else {
return false;
}
}
And in my file panel.php is like this:
session_start();
$Logins = new Logins();
if (!$Logins->isLogged()) {
header("Location: ?pag=login");
} else {}
if(isset($_GET['action']) == 'logout') {
if($Logins->Logout()) {
header("Location: ?pag=login");
}
}
Now that I’m having problems, I’m exactly 8 hours stuck in it, when I click Logout it goes back to home.php but the Session does not destroy, nothing happens. What I am doing wrong?
There must be a syntax error in
unset($_SESSION[$this->prefix.['email']])andunset($_SESSION[$this->prefix.['password']]), because of.after prefix.– stderr
Opa I fixed, but nothing was solved yet, it was like this now
unset($_SESSION[$this->prefix.'email']); unset($_SESSION[$this->prefix.'password']);– Guilherme Alves
I left like you said and still nothing... :'(
– Guilherme Alves
What is
prefix? whether that information is in a Session try to access it like this:unset($_SESSION['email']);andunset($_SESSION['password']);– stderr
prefixis a parameter configuration that I made, for me to change the name ofsessionWhen I find it necessary, you understand? Yes I’ve tried this way too but nothing I still think I must be doing something wrong and pretty ugly yet rsrs. :'(– Guilherme Alves
Vish. How do you guard the e-mail and the password in Session?
– stderr
Well, my code is very long so I’ll put it on Pastebin http://pastebin.com/hNbbQdFE
– Guilherme Alves
Let’s go continue this discussion in chat.
– Guilherme Alves
Little suggestion:
$_SESSION[$this->name]['email']would not be better than using the prefix?– Wallace Maxters