I have added a log function to Access_user Class ver. 1.99 which logs user’s user_ip_address, user’s log-in_name and date/time, which works when called from the redirected web-page (main page) which is called by the log-in function after it has executed. But calling it from here logs every time a user visits the main page, and if I call it from the log-in page it doesn’t record the user because the log function fires before log-in function.
Ive tried to add the log function to the log-in function inside the class with limited success, I cant seem to get $user variable statement to record the user in the log table. It works $user = $_SESSION[‘user’] from outside the class but I can’t get the $user variable to point correct class variable to make it work from within the class.
Any suggestions or advice will be gratefully accepted as I am learner learning PHP and loving it!
Here is my log function;
[<?PHP]
function LogEvent($event) {
$log_datetime = date(“Y-m-d H:i:s”);
$log_user = $_SESSION[‘user’];
$log_ipaddress = $
$log_info = sprintf(“INSERT INTO amsa_logs ( logs_DateTime, logs_Host, logs_User, logs_Event) VALUES (‘$log_datetime’,’$log_ipaddress’,’$log_user’,’$event’)”,
$this->table_name);
$this->ins_string($log_datetime);
$this->ins_string($log_ipaddress);
$this->ins_string($log_user);
$this->ins_string($event);
mysql_query($log_info); //cox///
}
[?>]
The class I’ve butchered ?
[ATTACH]15055[/ATTACH]
[canned-message]attachments-removed-during-migration