This topic is locked

Log file ?

5/13/2009 3:23:38 AM
PHPRunner General questions
F
fatahalbahar author

Dear all,
Good day,
I wonder if you could help me how to build log file for monitoring the users in PHP runner?
Regards.

J
Jane 5/13/2009

Hi,
I would suggest to create a Log table in your database for this purpose. This table can store information about all changes in the database.
After that you can implement AfterSuccessfulLogin, After record added, After record updated events:

global $conn;

$str = "insert into Log (username, datefieldname, action) values ('".$_SESSION["UserID"]."', now(),'action')";

db_exec($str,$conn);



This is it.

S
sogoli 5/16/2009

Hi,

I would suggest to create a Log table in your database for this purpose. This table can store information about all changes in the database.
After that you can implement AfterSuccessfulLogin, After record added, After record updated events:
This is it.



what is "action"?

J
Jane 5/18/2009

Replace action with your actual value: update, add, login.

H
helvis2009 6/9/2009

hello ..
really worked here, but how do I add the record that was changed? need to know what was the record that has to change .. thanks!

J
Jane 6/9/2009

Hi,
check this code:

global $conn;

$str = "insert into Log (username, datefieldname, action, recordid) values ('".$_SESSION["UserID"]."', now(),'update', ".$keys["FieldName"].")";

db_exec($str,$conn);



where FieldName is your actual field name where primary key is stored.

H
helvis2009 6/9/2009

Ok my friend .. it worked .. thanks!
More how you get the name of the field that was changed, because I have 05 fields in the table and would like to know which of them was published ..