Debt Consolidation - Property in Bulgaria - Debt Consolidation - Web Hosting - Song Lyrics A to Z

PDA

View Full Version : session problem


chxxangie
Nov 20th 2007, 9:52 pm
session_start();
ini_set("session.gc_maxlifetime", "10"); //in second

if(isset($_SESSION['active'])){
}else{
session_unset();
session_destroy();
?>
<SCRIPT LANGUAGE="Javascript">
alert ('Your sesion has expired.\nPlease login again!');
document.location = "login.php"
</SCRIPT>
<?php
exit;
}
?>


i want to destroy the session if the user do not have respone in a period of the time.
i search from internet is the above code.
but when i trying it doesn't work?
do i miss something or...???

DeViAnThans3
Nov 21st 2007, 2:57 am
Does it shows the error message (javascript alert), or not? If not, the if statement seems to be not working. Else, try using session_unregister('global-session-variable-name'); :)
Also you could try using session_destroy() only.

edit: this helps with me: - this code removes unnecessary cookies.

if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}