CstAn
05-11-2007, 08:16 AM
Dear all,
How can get the logout time although user did not logout?
I m using this script to get the time when user press "X" (button at top right). But i cant get when user right click at toolbar and close the browser.
function RorC() {
var top=self.screenTop;
if (top>9000){
//alert('window was closed'+top)
xmlHttp = createXmlHttpRequestObject();
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
var values = new Object();
values.userId =document.getElementById("userIdMain").value;;
values.type = 0;
// Encode POST data
var data = '';
for (var i in values) {
data += (data?'&':'')+i+'='+encodeURIComponent(values[i]);
}
url = "inc/queryForAJAX.php";
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader ('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');
// define the method to handle server responses
xmlHttp.onreadystatechange = handleServerResponseForSaveData;
// make the server request
xmlHttp.send(data);
}else{
// if the connection is busy, try again after one second
setTimeout('RorC()', 1000);
}
}
}
function handleServerResponseForSaveData(){
}
<body onUnload="if (document.all) RorC();">
</body>
the httprequest will sent a request to server and update the date time.
How can i totally prevent one acount can multiple login at a time?
thanks.
How can get the logout time although user did not logout?
I m using this script to get the time when user press "X" (button at top right). But i cant get when user right click at toolbar and close the browser.
function RorC() {
var top=self.screenTop;
if (top>9000){
//alert('window was closed'+top)
xmlHttp = createXmlHttpRequestObject();
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
var values = new Object();
values.userId =document.getElementById("userIdMain").value;;
values.type = 0;
// Encode POST data
var data = '';
for (var i in values) {
data += (data?'&':'')+i+'='+encodeURIComponent(values[i]);
}
url = "inc/queryForAJAX.php";
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader ('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');
// define the method to handle server responses
xmlHttp.onreadystatechange = handleServerResponseForSaveData;
// make the server request
xmlHttp.send(data);
}else{
// if the connection is busy, try again after one second
setTimeout('RorC()', 1000);
}
}
}
function handleServerResponseForSaveData(){
}
<body onUnload="if (document.all) RorC();">
</body>
the httprequest will sent a request to server and update the date time.
How can i totally prevent one acount can multiple login at a time?
thanks.