PDA

View Full Version : Date/time for user log doesn't work


polet
03-04-05, 05:47 AM
Anyone has the user logs working? In the user management section I receive a 7 or 8 digit number of login hours and idle time even though I just (fresh-) installed ver 2.
When checking the database for users all times and data are set to zero, e.g. 0000-00-00.

kubiix
03-04-05, 09:07 AM
I think it is a bug, you can see the same problem on demo site at http://www.dotproject.net/demo/

polet
03-04-05, 03:43 PM
Yes, that's what it looks like (I didn't have access to my system when posting this one). Sessions are stored in the database in the user section but all dates are set to 0000-00-00 and 00:00.

I didn't find the time and will to have a deeper look at the code at this time.

Let's hope it'll be fixed soon.

bsst
03-04-05, 05:31 PM
It seems like there are some problems with now() function insert and upate into datetime column when the value of this function is converted to string. I've done a little hack of quote function inside of the classes/query.class.php file to avoid converting datetime stamp to the string. This is just a temp solution and not the best way to fix this problem, but it works for now :)

function quote($string)
{
global $db;
if (strcasecmp($string, "now()") == 0)
{
return $string;
}
else
{
return $db->qstr($string, get_magic_quotes_runtime());
}
}


Hope this helps.

pedroa
07-04-05, 09:16 AM
Hi there,

I saw this problem and I solved it this way:

On classes/ui.class.php change line 689 to:

$q->addInsert('date_time_in', date('Y-m-d H:i:s'));

line 702 to:

$q->addUpdate('date_time_out', date('Y-m-d H:i:s'));

line 715 to:

$q->addUpdate('date_time_last_action', date('Y-m-d H:i:s'));

These will get things recorded properly.

Now to show the log correctly, change file modules/admin/vw_usr_log.php line 90 to 92 should be:

$q->addWhere("ual.date_time_in >='".$_REQUEST["log_start_date"]."000000'");
$q->addWhere("ual.date_time_out <='".$_REQUEST["log_end_date"]."235959'");
$q->addOrder('ual.date_time_last_action DESC');

With the grey theme I can't see the header because of the STYLE="background: #08245b", it's to dark but you can see it on the default theme. Guess I gonna change that to #cccccc (gray).

Hope you like it,

Pedro A.