hi
i,m writing a script for chat room
i,d like to with clicking close button of browser user is exited from site
meaning of this say is with clicking close button all of session variable
is removed from server
i wrote below code for this action
but sorry i failed
please help me
my base page code is as follows
code of exit.php is as follows
i,m writing a script for chat room
i,d like to with clicking close button of browser user is exited from site
meaning of this say is with clicking close button all of session variable
is removed from server
i wrote below code for this action
but sorry i failed
please help me
my base page code is as follows
Code:
<?php
session_start();
$_SESSION['username']='sima';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function getData(source)
{<!--119-->
var XMLHttpRequestObj=false;
if(window.XMLHttpRequest)
{ XMLHttpRequestObj=new XMLHttpRequest();}
else if(window.ActiveXObject)
{ XMLHttpRequestObj=new ActiveXObject("Microsof.XMLHTTP");}
if(XMLHttpRequestObj)
{<!--131-->
XMLHttpRequestObj.open("GET",source);
XMLHttpRequestObj.onreadystatechange=function()
{<!--135-->
if(XMLHttpRequestObj.readyState==4 && (XMLHttpRequestObj.status==200 || XMLHttpRequestObj.status==0))
{<!--137-->
newWindow=window.open("show_users.php","new users");
newWindow.focus();
}<!--e137-->
}<!--e135-->
}<!--e131-->
XMLHttpRequestObj.send(null);
}<!--e119-->
</script>
</head>
<body onUnload="getData('exit.php');">
</body>
</html>
Code:
<?php session_start(); session_destroy(); ?>
Comment