...

View Full Version : deleting username when browser is closed.



SMGames
08-01-2007, 08:47 AM
Hi i am trying to delete a user from the online users when they close the browser, this is how i have done it:



<?php
if(@$_SESSION['Loggedin'] == 'false'){

$result = mysql_query("DELETE FROM online_users WHERE loginname='".$_SESSION['loginname']."'")
or die(mysql_error());

$row = mysql_fetch_array( $result ) }

?>

But im getting this error:

Parse error: syntax error, unexpected '}'

when users login it inserts there username into the online users, and when they logout it deletes it, but i am having trouble when the user doesnt logout and just closes the browser.

Or if anyone has any other ideas on how to create an online user system, i would like to hear them.

_Aerospace_Eng_
08-01-2007, 08:53 AM
$row = mysql_fetch_array( $result ); }
I think the way this forum does it is it sets the users login time and then it sets the time each time they visit a page. This time is then checked against the time() and if its greater than a certain amount they no longer appear "online" until they return and start using the site.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum