Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2007
    Thanked 0 Times in 0 Posts

    deleting username when browser is closed.

    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 Code:
    if(@$_SESSION['Loggedin'] == 'false'){

    $result mysql_query("DELETE FROM online_users WHERE loginname='".$_SESSION['loginname']."'"
    or die(
    $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.
    http://www.smgames.staticfire.co.uk Under construction, Currently hiring mods and admins anyone interested pm me.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    In a place far, far away...
    Thanked 1,043 Times in 1,019 Posts
    $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.
    Last edited by _Aerospace_Eng_; 08-01-2007 at 09:56 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts