This topic is locked
[SOLVED]

 Tracking Log ins

4/16/2009 8:16:30 PM
PHPRunner General questions
A
ashipley author

A nice fearuew for PHPRuner, when using dynamic protection, would be to have it create a table to tracvk the names of users who log in and when they log in, If desired, you could even have a field to track what page they were trying to access when they passed through the log in page. This would help the developer track what kind of activity the database is seeing.

J
Jepsen 4/17/2009

Arthur
This is quite common and I am sure that many of us do that. I do it in all my databases the following way:
Have a table with log-ins
events ---> After successful log-in

//********** Insert a record into another table ************

global $conn;

$Username = @$_SESSION["UserID"];

$IP = $_SERVER["REMOTE_ADDR"];

$strSQLInsert = "insert into db_connects (user, ip) values ('$Username', '$IP')";

db_exec($strSQLInsert,$conn);
$strSQLInsert = "UPDATE _medlemsregister SET lastvisit = now() where brugernavn = '$Username'";

db_exec($strSQLInsert,$conn);


The table have a field for when it is taking place. Rather than having PHPR to du it, I have made defalt database value "now()"
Finally I update the users record to show his last log-in

T
taumic 4/17/2009

Hallo Morten - hallo Forum,
is it also possible to log the unsuccessful logins via event "After unsuccessful login"?
I want to log the wrong username and the wrong password, but in with variables there are stored?
Thank you!
Michael

J
Jane 4/17/2009

Hi,
the same variables ($username and $password) are available in the AfterUnsuccessfulLogin event.

T
taumic 4/17/2009

Hi,
easy and ingenious !!
Thanks a lot!
Michael