Results 1 to 2 of 2

Thread: Please help learner with simple log function

  1. #1
    Join Date
    Sep 2012

    Question Please help learner with simple log function

    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;

    function LogEvent($event) {
    $log_datetime = date("Y-m-d H:i:s");
    $log_user = $_SESSION['user'];
    $log_ipaddress = $_SERVER['REMOTE_ADDR'];
    $log_info = sprintf("INSERT INTO amsa_logs ( logs_DateTime, logs_Host, logs_User, logs_Event) VALUES ('$log_datetime','$log_ipaddress','$log_user','$event')",
    mysql_query($log_info); //cox///

    The class I've butchered

  2. #2
    Join Date
    Sep 2012

    resolved Problem fixed

    problem solved, wasn't the function, it was where i was calling it from, when call it from the user(goto_page) function its works fine.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center