Totally Zenned
- Join Date:
- Oct 2004
- Posts:
- 973
- Plugin Contributions:
- 0
[Done v1.3.9b] Counter History issue in 1.3.9a
Hi there,
I recently upgraded a site from 1.3.8a to 1.3.9a. The admin counter history looked like this after upgrading:
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
04/26/2010 1-1
I compared the includes/counter.php file from v1.3.8a and v1.3.9a and found this code change:
1.3.8a
$counter_query = "select startdate, counter, session_counter from " . TABLE_COUNTER_HISTORY . " where startdate='" . $date_now . "'";
$counter = $db->Execute($counter_query);
if ($counter->RecordCount() <= 0) {
$date_now = date('Ymd');
$sql = "insert into " . TABLE_COUNTER_HISTORY . " (startdate, counter, session_counter) values ('" . $date_now . "', '1', '1')";
$db->Execute($sql);
$counter_startdate = $date_now;
$counter_now = 1;
} else {
$counter_startdate = $counter->fields['startdate'];
$counter_now = ($counter->fields['counter'] + 1);
$session_counter_now = ($counter->fields['session_counter'] + $session_counter);
$sql = "update " . TABLE_COUNTER_HISTORY . " set counter = '" . $counter_now . "', session_counter ='" . $session_counter_now . "' where startdate='" . $date_now . "'";
$db->Execute($sql);
}
1.3.9a
$sql = "insert into " . TABLE_COUNTER_HISTORY . " (startdate, counter, session_counter) values ('" . $date_now . "', '1', '1')
on duplicate key update counter = counter + 1, session_counter = session_counter + " . (int)$session_counter;
$db->Execute($sql);
I put 1.3.8a code back in, and now the counter works fine. I'm not sure what the change in code was for, but it doesn't seem to be working correctly.
Thanks!
Danielle