RE: help avoid multiple login

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Mensagem original-----
De: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx] 

>>the normal way of doing session 'closing' is by way of 'garbage
> 
> collection'
> 
>>- every now and then a script/process/function is run that 'closes' any
>>sessions which are (according to your criteria) inactive. php has stuff
>>built it that will do this for you to a degree.
>>-----
>>
>>Is there a way I can access sessions from other users on a script?

what exactly do you mean by that last sentence? I don't quite follow it.
------

I mean if I knew all active session id's I could compare them to the
members_online table.

An example in pseudo code:

// Member logs in, store session id, login datetime, last visit datetime:
INSERT INTO members_online

// Get active session ids from table:
php code

// Compare active session ids with table sessions:
for ($i=0; $i < table rows; $i++){
      if ( !isset( session id from member $i )) {
            DELETE member from table
      }
}

>>If yes I could store the session id on a table and later check if isset.
>> You could write the session id into a table when the session is started,
>> along with the start time.
>> Something like
>> sessionid CHAR|starttime DATETIME|lastvisittime DATETIME
>> You could then update this table each time the user visits a page, and
>> delete it if the interval between starttime and lastvisittime is longer
than
>> you want. A cron job/scheduled task could be used to clean this table up
>> periodically

>a nice description of 'session garbage collection' :-) ....
>which is pretty much all you can do in terms of 'logoff'.


I already use a class to perform this task. The problem is if a member
closes the browser windows and then tries to login again before the
specified timeout.

Does Apache have a function like asp Session_OnStart, Session_OnEnd ?

I am using IIS and PHP 5.0.4

Thanks in advance.
Pedro.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux