hey,
i think if u r using php session then it is clear automatically when browser closed. means when it user opens the browser it goes to login page.but u can add this code to every page except login page.

<?php
if(!isset($_SESSION['sessionvalue'])){
?>
<script>
window.location('loginpage.php');
</script
<?php
}
?>

if it not help then tell me

Hi Nikesh!
My problem is also like this. I m closing window but when again i open window then i was already logged in. I have used this code at every page but it not workes until i Log out.

<?php
if(!isset($_SESSION['sessionvalue'])){
header(Location:'index.php');
}
?>

plz help me out.
thanks

To clear the session simply use the following.

$_SESSION=array();
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.