karzina community forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

SMF - Just Installed!

Author Topic: Customers on line not reported correctly (report and admin home)  (Read 1022 times)

bruce

  • Administrator
  • Full Member
  • *****
  • Posts: 138
Customers on line not reported correctly (report and admin home)
« on: February 07, 2009, 05:32:02 PM »
This bug applies to all releases up to and including karzina 1.04
Instructions of how to patch those versions follows...

Customers On Line Report
This report is showing all of the rows in the table "session". These are supposed to be deleted when they are untouched for more than one hour but the session object will not always clean up in as timely a manner as we want for this report to be accurate. There is no reason to force the delete so we will modify the reporting.

So, to show only "current" records (in the spirit of the existing design, "current" is less than 1 hour old) in the "on line" report, you can make the following modification to the file \admin\controller\report_online.php

replace this
Code: [Select]

        $results = $database->getRows("select value, ip, time, url from session");
with this
Code: [Select]
        //  show only sessions that have not expired.
        $sql = "select `value`, `ip`, `time`, `url` from `session` where `expire` > '?'";
        $parsed = $database->parse($sql, time());
        $results = $database->getRows($parsed);
        //
If you want the values shown in the report to be less than 1 hour old, say up to 20 minutes old instead, then those records will expire in 40 minutes from now. Hence, you would change $parsed to the following
Code: [Select]
       $parsed = $database->parse($sql, time() + 40 * 60);

Administration Home Page
In the file admin\controller\home.php replace
Code: [Select]
    $user_info = $database->getRow("select count(*) as total from session");
with the following
Code: [Select]
        //  show only sessions that have not expired.
        $sql = "select count(*) as total from `session` where `expire` > '?'";
        $parsed = $database->parse($sql, time());
        $user_info = $database->getRow($parsed);
        //
Logged