This topic is locked

Record Login and logout

11/7/2005 4:45:36 PM
PHPRunner General questions
prleo1 author

Admin,
Is there an easy way to record in my database who is logging in and out through sessions? I would like to record the ip adresss, time-in, time-out, and username.
I have been reading PHP 5 Unleashed and have implemented a session recorder; but I am finding it very difficult to take this simple example and implementing it in your sophisticated code.
Thanks,

PR

admin 11/8/2005

Hi,
the only way to record both logins and logouts is to use custom session handlers.
You can use an example from "PHP 5 Unleashed" book to store them.
Just put your session handling fuctions and variables into include\dbcommon.php file and insert a call to session_set_save_handler() function into each generated PHP file just before

session_start();



line.