Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Visitors 1.6


Guest

Recommended Posts

Hmmm, seems it doesn't like the new year...

 

Looking at the chart for "by days this month" and the chart is giving me numbers for all days this month, and the numbers are outlandish (over 8,000 in some cases). it looks like it's for "by days last year".

 

Is anyone else seeing this? If so, have you figured a workaround (kluge)?

Link to comment
Share on other sites

Hate to follow up my own post, but the problem looks like:

$visitor_stats_query = tep_db_query("select DAYOFMONTH(date) as name, count(counter) as value from visitors where MONTH(now()) - MONTH(date) < 1 group by DAYOFMONTH(date)");

 

It also looks like some of the other reports have gone to pot...

(search engine keywords is now non-functional as well)

 

:(

Link to comment
Share on other sites

Strange but true. I have the same problem. Now how do we solve it?

normally the person who wrote the tool is using the tool, notices the problem and then fixes it with a release or update.

 

that appears to not be the case here.

 

So, I have been dinking around with it, but I'm not quite sure what the fix is at this time (it's dates and SQL, not a personal strong point of mine)

 

My hope is that the original author will get a fix posted before I have a chance to hack at it. If not, then after I move my store to a new host, I'll take a look at it.

 

:(

Link to comment
Share on other sites

normally the person who wrote the tool is using the tool, notices the problem and then fixes it with a release or update.

He did! But I don't use this contribution anymore ... :(

 

The problem is an easy fix and I will try to make a new contribution later this week. In the meantime, you may just try to paste in these changes:

 

switch ($report) {

case "1": // By Hours Today

$visitor_stats_query = tep_db_query("select HOUR(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " where to_days(now()) - to_days(date) < 1 group by HOUR(date)");

break;

case "3": // By Months this Year

$visitor_stats_query = tep_db_query("select MONTHNAME(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " where YEAR(now()) - YEAR(date) < 1 group by MONTH(date)");

break;

case "4": // All by Year

$visitor_stats_query = tep_db_query("select YEAR(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " group by YEAR(date)");

break;

case "5": // All by Hours

$visitor_stats_query = tep_db_query("select HOUR(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " group by HOUR(date)");

break;

case "6": // All by Day of Month

$visitor_stats_query = tep_db_query("select DAYOFMONTH(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " group by DAYOFMONTH(date)");

break;

case "7": // Average Clicks per IP by Days

$visitor_stats_query = tep_db_query("select DAYOFMONTH(date) as name, avg(counter) as value FROM " . TABLE_VISITORS . " group by DAYOFMONTH(date)");

break;

case "8": // Total Clicks by Top Countries

$visitor_stats_query = tep_db_query("select browser_language as name, sum(counter) as value FROM " . TABLE_VISITORS . " group by browser_language");

break;

case "9": // Total Clicks by Site Language

$visitor_stats_query = tep_db_query("select language as name, sum(counter) as value FROM " . TABLE_VISITORS . " group by language");

break;

case "10": // Search Engine Keywords

$visitor_stats_query = tep_db_query("select referer as name, count(counter) as value FROM " . TABLE_VISITORS . " group by referer");

break;

case "11": // NYA

$visitor_stats_query = tep_db_query("select DAYOFMONTH(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " where MONTH(now()) - MONTH(date) < 1 and YEAR(now()) - YEAR(date) < 1 group by DAYOFMONTH(date)");

break;

case "12": // NYA

$visitor_stats_query = tep_db_query("select DAYOFMONTH(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " where MONTH(now()) - MONTH(date) < 1 and YEAR(now()) - YEAR(date) < 1 group by DAYOFMONTH(date)");

break;

default: // By Days this Month

$visitor_stats_query = tep_db_query("select DAYOFMONTH(date) as name, count(counter) as value FROM " . TABLE_VISITORS . " where MONTH(now()) - MONTH(date) < 1 and YEAR(now()) - YEAR(date) < 1 group by DAYOFMONTH(date)");

}

 

 

and in application_top:

 

// Visitors Start

$b_lang = getenv('HTTP_ACCEPT_LANGUAGE');

$referer = getenv('HTTP_REFERER');

if ($referer == '') {

$referer = 'direct';

}

$uri = getenv('REQUEST_URI');

if ( function_exists('tep_get_ip_address') ) {

$b_ip = tep_get_ip_address();

} else {

$b_ip = getenv('REMOTE_ADDR');

}

if ($b_lang == '') {

$b_lang = 'robot';

}

$b_count = '1';

$ip_count = tep_db_query("select counter FROM " . TABLE_VISITORS . " where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1");

if (!tep_db_num_rows($ip_count)) {

tep_db_query("insert into " . TABLE_VISITORS . " (date,counter,browser_ip,browser_language,language,referer,uri) values (now(),'".$b_count."','".$b_ip."','".$b_lang."','".$language."','".$referer."','".$uri."')");

} else {

$ip_values = tep_db_fetch_array($ip_count);

$b_count = ($ip_values['counter'] + 1);

tep_db_query("update " . TABLE_VISITORS . " set counter = '" . $b_count . "', date = now() where browser_ip = '" . $b_ip . "' AND browser_language = '" . $b_lang . "' AND to_days(now()) - to_days(date) < 1");

}

 

// Visitors End

 

Plus you will need to define TABLE_VISITORS in database tables:

 

define('TABLE_VISITORS', 'visitors');

 

 

I will do a diff on my version and the one contributed and see what changes are required.

Ian-san

Flawlessnet

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...