I want to clear the session in a project. If i have opened an another project in the same browser, that session also cleared. How to clear the session without affecting the other projects?
gurusubramaniam
0
Newbie Poster
Recommended Answers
Jump to Posttry using unset()
Example:
<?php session_start(); unset($_SESSION['username']); unset($_SESSION['user_id']); or session_start(); unset($_SESSION['username'], $_SESSION['user_id']) ?>
With this you could unset specific vars if needed. or you could
use
session_unset();
to kill them all.
When I write logout scripts I use
<?php session_start(); session_unset(); session_destroy(); …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.