Check who is log in

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shamrock

    Check who is log in

    Hi,

    I need to write application which tell me
    who is login. In example:
    1. login as Shamrock
    2. I see Shamrock login
    3. someone login as Morbious
    4. They both see : Shamrock & Morbious
    5. Shamrock logout
    6. Morbious refresh site and see only Morbious is logged
    Any sugesstions ?


    Best regards,

    Shamrock
  • Geoff Berrow

    #2
    Re: Check who is log in

    I noticed that Message-ID: <42338881$0$323 2$f69f905@mamut 2.aster.pl>
    from Shamrock contained the following:
    [color=blue]
    >1. login as Shamrock
    >2. I see Shamrock login
    >3. someone login as Morbious
    >4. They both see : Shamrock & Morbious
    >5. Shamrock logout
    >6. Morbious refresh site and see only Morbious is logged
    >Any sugesstions ?[/color]

    You need to store the login information in a file or database. Change
    the database when someone logs out (or after n minutes of inactivity).
    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Gordon Burditt

      #3
      Re: Check who is log in

      >I need to write application which tell me[color=blue]
      >who is login. In example:
      >1. login as Shamrock
      >2. I see Shamrock login
      >3. someone login as Morbious
      >4. They both see : Shamrock & Morbious
      >5. Shamrock logout
      >6. Morbious refresh site and see only Morbious is logged
      >Any sugesstions ?[/color]

      Browsers don't log out. Users rarely log out (if you provide a
      link to log out and the login is protecting sufficiently sensitive
      information, a few of your users MIGHT use it).

      The closest you can usually get is to (a) decide that a person is
      logged out if the last page refresh is older than X time, and (b)
      process explicit logouts if someone actually uses them.

      Put the login info in a database. If they refresh a page, update
      the last_refreshed_ timestamp. To see who is logged in, select the
      entries with a login name and whose last_refreshed_ timestamp is
      later than, say, an hour ago.

      Gordon L. Burditt

      Comment

      • R. Rajesh Jeba Anbiah

        #4
        [FAQ] Find logged in users

        Q: How to find the logged in users?
        Q: How to find the number of logged in users?

        A: If you use session based authentication/login mechanism, it is quite
        easy when you use custom-DB-based session--so that the session
        variables will be stored in database instead of default files. As the
        session will be available in the database table, it is easy to query
        it/count the number of sessions or records.

        Refer:



        +++
        @todo Cleanup. Better link to DB handler

        Comment

        • Chung Leong

          #5
          Re: Check who is log in

          "Shamrock" <Shamrock@anywh atyou.want> wrote in message
          news:42338881$0 $3232$f69f905@m amut2.aster.pl. ..[color=blue]
          > Hi,
          >
          > I need to write application which tell me
          > who is login. In example:
          > 1. login as Shamrock
          > 2. I see Shamrock login
          > 3. someone login as Morbious
          > 4. They both see : Shamrock & Morbious
          > 5. Shamrock logout
          > 6. Morbious refresh site and see only Morbious is logged
          > Any sugesstions ?
          >
          >
          > Best regards,
          >
          > Shamrock[/color]

          A very simple way to do this is to glob the session save path, obtainable
          through ini_get(). Session files have names of the form "sess_<session_ id>".
          Cut off the prefix and load each session by calling session_id(),
          session_start() , and session_write_c lose(). Be sure to save a copy of the
          current $_SESSION first.

          The downside to this method is that on a share server, you will end up
          reading the sessions of other web sites as well. There are ways to get
          around the problem though.


          Comment

          Working...