Shanon
Shanon

Reputation: 353

Php session_destroy() is destroying all sessions in a browser

I have two admin panels with different files and folders and when i destroying session after logging out from one admin panel it automatically destroying the other admin panel session, they both have different session names and variables .

session_unset($_SESSION['ticket_level']); session_unset($_SESSION['ticket_name']); session_destroy(); header("location: ../login.php");

this is something i am using for one of them , i am not sure what the heck is going on or is this the right way to do it for not

Upvotes: 1

Views: 856

Answers (2)

Yann Sagon
Yann Sagon

Reputation: 577

Try to use

unset($_SESSION['ticket_level']);

session_unset is obsolet and is not meant to be used like this (it takes void as params)

Upvotes: 0

kgilden
kgilden

Reputation: 10356

Use session_name() for different applications running on the same server. Ex:

Site A:

session_name('site_A');

Site B

session_name('site_B');

You must call it before session_start() and on every single page.

Upvotes: 1

Related Questions