Latest News: (loading..)
Jack_mcs

View Counter

454 posts in this topic

This is the support thread for View Counter. View Counter provides a way to monitor and control what's going on in your shop. If you are familiar with the Who's Online addon, then this can be thought of as Who's Online on steroids. Most shop owners are not aware of the number of search bots, crawlers and skimmers that visit their shops on a daily basis. Some are useful but most are not. All they do is use the accounts bandwidth and slow the server down. This program provides a way to see and control them. Some of its functions are:

 

- View who's on the shop, including visitors and search bots.

- View a history of the IP's that have visited and how often.

- View the pages in the shop that have been visited and how many times each was visited.

- View the pages in the shop that have not been visited.

- Look up the DNS data for anyone on the shop.

- Ban by an IP, range of IP's or a domain name.

- Kick someone off the site and display a warning message.

- Send someone a message that is currently on your site.

- Trap IP's that do not follow the robots file directive.

- Ban IP's that change the url's to cause damage (hackers).

- Much more and growing.

 

View Counter is compatible with all versions of oscommerce.

 

I would like to extend my special thanks to Steve, aka Altoid, for the assistance he provided in testing this addon. His ability to notice things I missed, along with his valuable suggestions for improvements, resulted in a much better program than I initially had written. Thanks Steve. :)

Edited by Jack_mcs
kymation, DunWeb and joli1811 like this

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

 

My modified .htaccess will not allow the script to be run from the URL, could I suggest you also include it in the install.txt ?

 

 

 

Chris

Edited by DunWeb

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack,

 

After installation, I tried testing the contribution on a modified RC2a site. Although View Counter states there are NO active users (not even me), when I check Who's Online 3.6.6, I get a whole list of active users. See Screen shots

 

 

 

 

 

 

 

 

 

Chris

Share this post


Link to post
Share on other sites
My modified .htaccess will not allow the script to be run from the URL, could I suggest you also include it in the install.txt ?
I don't provide sql in non-file form anymore since it is too much of a maintenance issue and causes updating more difficult.

 

Regarding not seeing results, are you sure you have enabled it in the settings?

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

 

Yes, I did. Here is an screenshot.

 

 

 

 

Chris

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

I don't provide sql in non-file form anymore since it is too much of a maintenance issue and causes updating more difficult.

 

 

I guess those less experienced with modified .htaccess files will either 1) give up the installation 2) post for help in the support forum 3) hire you or someone else to install it for them

 

 

 

Chris

Share this post


Link to post
Share on other sites

Your screenshot doesn't show the View Counter link in the left column so it appears to not be fully installed. If that is not the case, I can only guess that something in your setup is preventing it from working, though I can't imagine what that might be. If you look in the view_counter table in the database are there any entries in it? If not, then the problem would be in the includes/modules/view_counter.php file. If there are entries, then something in your admin is preventing them from being shown. Since your .htaccess file prevented the mysql script from running, it might also be preventing the code from executing properly. Though it is pretty standard code so I can't imaging that is the case. But you can try removing the .htaccess contents that are not needed for operation, like for a url rewriter, to see if that is the reason.

 

I've installed this into about 10 shops so far and never had a problem with the .htaccess file. That includes my own, which is highly modified for security reasons. So I don't expect this to be an issue with most shops but if it is, yes, the .htaccess file would need to be pasted here for me to figure out the reason for the failure.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack,

 

Very top left of the column. YES, the view_counter database table has entries in it. I will monkey around with the module file and see what I can do.

 

Thanks for your assistance.

 

 

 

Chris

Share this post


Link to post
Share on other sites

Ahh, OK. I'm so used to looking at the lower end of the column for new entries that I didn't notice it at the top.

 

For not seeing the entries, if you haven't tried it yet, un-check Active just to see what that does. Also make sure there are no entries in the banned and ignore lists. There shouldn't be at this point but it is worth a look.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack,

 

Yes, I have played with all of the settings. No listing is showing. I am going to install it into a 2.3.3 site later that has less modifications to see how it functions there.

 

 

 

Chris

Share this post


Link to post
Share on other sites

Hi

 

I just installed this add on and if I click on Active Only under the type in view counter->color, it comes up with the following

 

 

Oops! Google Chrome could not find localsites

Suggestions:

Search on Google:

 

and the url in the browser looks like the following

 

http://localsites/ContributionTesting/headertags_3/admin/view_counter.php

 

Have I gone wrong somewhere or do I just need to change a file or something

 

Kind regards

 

Ian

Share this post


Link to post
Share on other sites

The monitor section etc is working all ok and clicking round my site and is coming up in the monitor section

Share this post


Link to post
Share on other sites

I just installed this add on and if I click on Active Only under the type in view counter->color, it comes up with the following

The color section is just for applying color and seeing at a glance what the colors will look like. The links on that page (for the monitor part) are not meant for use. I will probably need to disable those or add a note not to use them.

Share this post


Link to post
Share on other sites

Chris, and anyone else having problems seeing results, I just ran across the problem you were having with not being able to see the entries in the monitor section. On this site, the problem turned out to be that the php and mysql times were different so the mysql call, which checks for a certain period, wasn't returning anything. The quick workaround is to set the Active Time in the settings to some large number, like 600. It is a mistake in the logic of the code to not check for the actual time so I will change that when I get a chance.

 

This site also has a failure when the code tries to decode the session ID to get cart contents. The session ID it stores isn't standard, or at least not one I've seen before. So if anyone is having this problem, in the admin/includes/functions/view_counter.php file, find this line

function UnserializeSession($session_data) {

and add this below it

return array();

If anyone has experience with decoding a non-standard SID, I would welcome suggestions. A standrd cart session starts with something like

cart|O:12:"shoppingCart":5:{s:8

but this one is more like

gBj5tjZRZU-WBY8WuUqS1WC6BEFBN

There's no compression or cache being used.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

I have installed this package and for the most part things are working, I have two issues, the first one is an error log entry that keeps occuring with a file write permission. Here is an excerp from the apache error log that occurs when I am working on another program in the admin panel links programs or just about any admin program access.

 

It apears to be trying to open a file for append or write in the includes directory. I checked the permissions for the directory

 

drwxr-xr-x 2 apache apache 4096 May 24 14:00 includes

 

I have even tried to make them rw accessable to the world, but still get the same error

 

drwxrwxrwx 8 apache apache 4096 May 24 14:17 includes

 

 

[Fri May 24 14:00:51 2013] [error] [client 108.235.105.221] PHP Warning: fopen(includes/botstore_2013-05-24.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in /var/www/vintagegeekstuff/catalog/includes/modules/view_counter.php on line 388, referer: http://www.vintagegeekstuff.com/admin/links.php?page=1&lID=1

 

This is the code segment that is trying to open the file, I even created an include directory in the modules directory to see if that was where it was actually trying to write the file, but got the same errors. I can not find any reference to the "botstore***" file in any other module, so maybe its a piece of left over code or something????

 

if ($storeBot) {

$file = 'includes/botstore_' . date("Y-m-d") . '.txt';

$mode = (file_exists($file) ? 'a' : 'w');

if (($fp = fopen($file , $mode))) {

$fout = fwrite($fp, 'Bot Found Entry' . "\r\n");

$fout = fwrite($fp, $_SERVER['REMOTE_ADDR'] . ' at '. date('H:i:s') . "\r\n");

$fout = fwrite($fp, 'UA = ' . $_SERVER['HTTP_USER_AGENT']) . "\r\n";

$fout = fwrite($fp, $botStoreData);

$fout = fwrite($fp, '' . "\r\n"); //extra line

fclose($fp);

}

$storeBot = false;

}

 

 

The Second problem I managed fix, that was what I believe to be an error in the coding to call out the ip address of the online customer to send a message to in the Tools panel.

 

view_counter_tools.php

Drop list to send a message was blank, found $db[ip] was invalid field name

 

Changed line 254

 

from:

 

$activeIPArray[] = array('id' => $db['ip'], 'text' => $db['ip']);

 

 

to:

$activeIPArray[] = array('id' => $db['ip_number'], 'text' => $db['bot_name']);

 

Thanks for a really nice addon

Bill V

Share this post


Link to post
Share on other sites

For the first problem, that is due to some troubleshooting code I forgot to disabled. In the includes/moudles/view_counter.php file, find this line

    $storeBot = true;

and remove it.

 

For the second problem, find this block of code in admin/view_counter_tools.php (around line 100)

  if (VIEW_COUNTER_ENABLE_KILL_SESSION == 'true') {
	  $data = $_POST['customer_msg'];
	  $activeTime = (VIEW_COUNTER_ACTIVE_TIME > 0 ? VIEW_COUNTER_ACTIVE_TIME : 5);
	  $whereActive = " and last_date > (NOW() - INTERVAL " . (int)$activeTime . " MINUTE ) ";   
	  $db_query = tep_db_query("select session_id from " . TABLE_VIEW_COUNTER . " vc where vc.ip_number NOT in (select vcb.ip_number from view_counter_banned vcb where ignore_status <> 1 ) and ip_active=1 and isadmin = '' and language_id = " . (int)$languages_id . $whereActive . " group by ip_number order by last_date asc");
	  $db = tep_db_fetch_array($db_query);

	  $ip = $_POST['customer_ip'];
	  $msg = tep_db_prepare_input($data);
	  $session = $db['session_id'];

	  KickOffIP($ip, $session, $msg);

and replace it with

  if (VIEW_COUNTER_ENABLE_KILL_SESSION == 'true') {
	  $data = tep_db_prepare_input($_POST['customer_msg']);
	  $ip = (int)$_POST['customer_ip'];
	  $activeTime = (VIEW_COUNTER_ACTIVE_TIME > 0 ? VIEW_COUNTER_ACTIVE_TIME : 5);
	  $whereActive = " and last_date > (NOW() - INTERVAL " . (int)$activeTime . " MINUTE ) ";
	  $db_query = tep_db_query("select session_id from " . TABLE_VIEW_COUNTER . " where ip_number = " . $ip . " and ip_active=1 and isadmin = '' and language_id = " . (int)$languages_id . $whereActive . " group by ip_number order by last_date asc");
	  $db = tep_db_fetch_array($db_query);
	  $msg = tep_db_prepare_input($data);
	  $session = $db['session_id'];
	  KickOffIP($ip, $session, $msg);

Then find this code (around line 247)

	  $db_query = tep_db_query("select * from " . TABLE_VIEW_COUNTER . " vc where vc.ip_number NOT in (select vcb.ip_number from view_counter_banned vcb where ignore_status <> 1 ) and ip_active=1 and isadmin = '' and language_id = " . (int)$languages_id . $whereActive . " group by ip_number order by last_date asc");
	  $activeIPArray = array();
	  $activeIPArray[] = array('id' => TEXT_CUSTOMER_ACTIVE_SESSIONS, 'text' => TEXT_CUSTOMER_ACTIVE_SESSIONS);

	  while ($db = tep_db_fetch_array($db_query)) {  
		  $activeIPArray[] = array('id' => $db['ip'], 'text' => $db['ip']);
	  }

and replace it with

	  $db_query = tep_db_query("select ip_number, inet_ntoa(ip_number) as ip from " . TABLE_VIEW_COUNTER . " where ip_active=1 and isadmin = '' and language_id = " . (int)$languages_id . $whereActive . " group by ip_number order by last_date asc");
	  $activeIPArray = array();
	  $activeIPArray[] = array('id' => TEXT_CUSTOMER_ACTIVE_SESSIONS, 'text' => TEXT_CUSTOMER_ACTIVE_SESSIONS);
	  while ($db = tep_db_fetch_array($db_query)) {  
		  $activeIPArray[] = array('id' => $db['ip_number'], 'text' => $db['ip']);
	  }

Please give it a try and let me know if there are still any problems.

Share this post


Link to post
Share on other sites

A new version has been uploaded with these changes:

 

- Added a hackers found report

- Changed color page to recognize the session ID parameter

- Changed form code on color page to use the hide session function to allow loading when SIDs are present

- Changed code to prevent View Counter from running with the googlefeeder.php script is ran

- Fixed coding errors in tools->Rebuild the .htaccess option

- Fixed coding errors for the customer notification tool in admin/view_counter_tools.php

- Removed testing code in includes/modules/view_counter.php

Share this post


Link to post
Share on other sites

Hi Jack, thank you very much for the addon. I had installed supertracker before which is quite good, the only thing is that I can not ban ip there and have to use cPanel IP manager. With your View Counter, it seems has the abilities to do more then just view and report, it is great. However, I have problem to use it, I am not sure it is only me has the problem or not. When you click on the color, under the show:, there are four radio options, and the default is Visitors, if I click on the other it just direct me to http://localsites/ContributionTesting/headertags_3/admin/view_counter.php same as Type: default Related and if you changed to other it just link to localsites. Something is wrong with the typing box here(I can not change line), I can not type with proper format, sorry about that. Lyn

Edited by ce7

Share this post


Link to post
Share on other sites

Also on the color page, I can see 51 list of the past visitor history, but I can not go to the next page or any other page, it is again the same will link to localsites. Another questions is that I follow your usage, but it doesn't have any changes and list after I visit my site. I installed the new version 04 Jul 2013. Thanks in advance. Lyn

Share this post


Link to post
Share on other sites

As stated previously, the color page is for setting colors - nothing else. If you want to use the tool, use the monitor section.

Share this post


Link to post
Share on other sites

Hello i just install this add-ons and everything works except of the e-mail sent to online customers. I have an SMTP email configuration and all the e-mails from the oscommerce is ok

 

anything for this

Share this post


Link to post
Share on other sites

Did you enable the kick off option in the settings? Is any message given on the View Counter page when you try to send the message?

Share this post


Link to post
Share on other sites

Hi Jack,

 

Thanks for this addon, It look good after installed, except that the page won't refresh automatically, once the counter to 0, it keep counting negatively and even i click the F5 to refresh manually, all IP# keep stay on the list even the client's IP# already gone. ( check from original who's online).

 

Is that nornaml?

 

Any advised?

Share this post


Link to post
Share on other sites

I've seen the problem with the timer on a site that had it set low (under 12 seconds as I recall). I can't reproduce it here and that shop owner didn't want it looked at - he just raised the time out setting. That may work for you. As for the list, yes, they stay there. If you scroll over the filename, it will say of the session is active or not. Or, you can just click on the Active box to show current visitors.

Share this post


Link to post
Share on other sites

Jack,

 

I am attempting to set this up on a local computer, in anticipation of running it on my live site. The installation runs fine and I am able to see and manipulate all of the options. The trouble begins when I attempt to turn on View Counter. As soon as I do, I get the following error:

 

1048 - Column 'ip_number' cannot be null

 

insert view_counter set file_name = 'configuration.php', arg = 'gID=18&cID=453', view_count = 1, ip_number = INET_ATON( '::1' ), ip_active = 1, session_id = 'um4oq4091t2e4k255uqohtgle2', isbot = 0, isadmin = '/admin/', last_date = now(), bot_name = '', referrer = 'http://localhost/admin/configuration.php', referrer_query = 'gID=18&cID=453&action=edit', user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0', language_id = 1

 

Once I get that error, the site is dead. I have to roll back the database to fix it.

 

Is this error due to this being on 'localhost' and not having a real IP? I would hate to not be able to test it out on my local computer prior to running it on my live site, especially if there is a chance of crashing the live site.

 

Thank you for your work and I am looking forward to a reply. Have a great day.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now