Jump to content

Recommended Posts

Hello dear supporting friends,

some days ago I realized that my viewcounter 1.6 was not blocking any country.

This funcionality was working and I have not idea what could have affected it.

I have test it using the 3 diferent ip2location_DB11 database files and have reconfigured the country block list again but anything I did worked. 

 

Should the .htaccess file be modified when I add a country to a block country list?  

 

How could I do a step by step troubleshooting to this funcionality?

 

Please help!!!, this is a great addon and I need it much.

Thanks in advanced.

Share this post


Link to post
Share on other sites

@@elara To enable country blocking, you just need to enable that option in the settings and then setup the countries to block in tools. If you did an update recently, maybe one of those was reset.

 

How are you testing it? How do you know it is not blocking a country? This site works well for checking which countries are blocked.

Share this post


Link to post
Share on other sites

@@elara To enable country blocking, you just need to enable that option in the settings and then setup the countries to block in tools. If you did an update recently, maybe one of those was reset.

 

How are you testing it? How do you know it is not blocking a country? This site works well for checking which countries are blocked.

Hi Jack, thanks a lot for answer me.
 
Well, I have not done any update or reset before the problem, that why I dont understand why it stopped working. Yes, I made sure to have enabled the option for country blocinkg in the module settings and then setup it (again) the countries to block in tools.
 
I setup to block any country on the list except Chile. I am sure it is not blocking anything due to several the symptoms and facts.
1) I have Livezilla and it said me the country of visiting. (Many countries are on the visiting list today)
2) The white list on the right side of tools (These IP's have been blocked based on their countries) is empty now and have been empty since I deleted any entry for testing purposes some days ago.
3) I just tried with the page you gave me (http://www.locabrowser.com/) from USA and Spain and the conexions were successful and no blocked country entries was added to the blocked list on the tools white list.
 
How could I do a step by step troubleshooting to this funcionality?
 
 
Thanks a lot for any help.
Edited by elara

Share this post


Link to post
Share on other sites

I assume Livezilla is external to the shop. The blocking code in View Counter only blocks at the shop level. So anything outside the shop will still allow full access.

 

Regarding the test, be sure you are entering the url to your shop, not to your site, assuming they are different. View Counter only works for the shop.

 

To troubleshoot it, in the includes/modules/view_counter_country_block.php file, find this code

    if (false) {
        if (! $dup) {

and change it to

    if (true) {
        if (! $dup) {

That should create a file in the includes directory named blocked_countrys_debug.txt that will contain countries that should be blocked. I haven't used it since several versions ago but I think it will still work.

Share this post


Link to post
Share on other sites

I assume Livezilla is external to the shop. The blocking code in View Counter only blocks at the shop level. So anything outside the shop will still allow full access.

 

Regarding the test, be sure you are entering the url to your shop, not to your site, assuming they are different. View Counter only works for the shop.

 

To troubleshoot it, in the includes/modules/view_counter_country_block.php file, find this code

    if (false) {
        if (! $dup) {

and change it to

    if (true) {
        if (! $dup) {

That should create a file in the includes directory named blocked_countrys_debug.txt that will contain countries that should be blocked. I haven't used it since several versions ago but I think it will still work.

Hello Jack,
 
I did the change on the includes/modules/view_counter_country_block.php as you said me. It created the file named blocked_countrys_debug.txt as you said, nevertheless I saw every possible country listed in that file, even my country (Chile) that is not said to be blocked according to my setup in tools. 
 
Please help!!, I dont understand what can be happening, but it is clear to me that no country is been blocking now.  
 
What other troubleshooting actions could you recomend me?
 
PD: 
Livezilla is internal to me shop.
I am in Chile and I tested from spain or USA using my shop, not my server.
 
Thanks a lot.

Share this post


Link to post
Share on other sites

 

Hello Jack,
 
I did the change on the includes/modules/view_counter_country_block.php as you said me. It created the file named blocked_countrys_debug.txt as you said, nevertheless I saw every possible country listed in that file, even my country (Chile) that is not said to be blocked according to my setup in tools. 
 
Please help!!, I dont understand what can be happening, but it is clear to me that no country is been blocking now.  
 
What other troubleshooting actions could you recomend me?
 
PD: 
Livezilla is internal to me shop.
I am in Chile and I tested from spain or USA using my shop, not my server.
 
Thanks a lot.

 

 

Hello Jack,

 

 V.1.6 is the first version of View Counter I  installed. The block countries option never worked as far I could test as per your

todays  instructions to eLara

 

I tried the above suggested change in includes/modules/view_counter_country_block.php but the blocked_countrys_debug.txt

is not created. I repaired the session table as suggested in previous posts, that did not help either.

 

Also I noticed all of a sudden since about 3 days that the admin IP  color changed to bot's color and did not show anymore as

admin but as "NO Bot ID" in the Monitor reports

 

Would you have any idea?


david

Share this post


Link to post
Share on other sites

@@elara The file should have two lines per country. One shows the country and the IP and the other shows if it has been blocked or not. It won't do any blocking, it is just checking. If it says it has not already been blocked, then the regular code should be blocking it. It should not show your own country unless you have that in the block list in admin. I can't offer any other help in a support thread since such a problem would require code changes and testing to find the problem.

 

@@Eim2 As mentioned in the last post by @@elara, the code is writing to the file for him. If it isn't for you, it might be something on the server or in your files that is preventing that. There isn't anything in the code to change a color setting other than when the color section is used so I can't even guess at what might have caused that to happen.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hello Jack,

 

I ll check further and probably un- and reinstall eventually.

 

For the admin color change, I guess it's because admin is now recognized first as bot without any ID ("No Bot ID")

and then as admin. Really strange that it happened all of a sudden.

 

One more I noticed. The referrer IPs drop down list is empty meaning no ip to select on the reports page

whereas all other options show the full list of ips in the drop downs (Ip count, path tracker etc)

 

Thanks a lot anyways.

Regards


david

Share this post


Link to post
Share on other sites

That s filed in when someone visits the site. The referrer setting isn't guaranteed to exist but you should see some entries. I've seen one host that limited the server fields so maybe yours is doing something like that.  Other than that, I don't know what the cause may be.

Share this post


Link to post
Share on other sites
Hi Jack,  

 

please let me one more comment and two simple questions.

 

I have reinstalled Viewcounter again from the beginning. I delete some spaces in the includes/languages/english.php file and wow!, one of my historical nightmares exception monitor error seem to have desapeared by now... 

 

Questions are:

 

1) I reviewed and discovered that the not working country blocking problem started about the same date I enabled https support in my shop.  I am using the cpannel redirect from http to https now. Could be it the reason for not blocking countries? (blocking http but not https)

What need Viewcounter in order to block countries in https access? 

 

2) In regard to "Fatal error: Uncaught exception 'Exception'... "error in monitor tool, 

How can I clear the complete historical database of IPs and everything showing by monitor tool?

 

Thanks a lot again

 

Edo.

Share this post


Link to post
Share on other sites

Using https won't make a difference since the code is just looking at the IP.

 

There isn't a way to clear the database tables in the current, released, version. You would need to manually edit the database or run the uninstall and install database scripts.

Share this post


Link to post
Share on other sites

Using https won't make a difference since the code is just looking at the IP.

 

There isn't a way to clear the database tables in the current, released, version. You would need to manually edit the database or run the uninstall and install database scripts.

Thank you very much Jack anyway.

 

Edo.

Share this post


Link to post
Share on other sites

A new version has been uploaded with these changes:

 

  1. Added an option to list known good IP's that is used on the shop side when banning is done.
  2. Added an option to autofill city, state and country fields on the create account and new address pages.
  3. Changed code on the shop side to enable the banning of IP's that have triggered the bad bot trap.
  4. Fixed some logic errors and made code improvements on the shop side.

Notes:

 

1 - if you are going to use the new autofill option, you may need to upload a new database file. DB 11 or higher is required for that to work.

2 - If you are going to use the new autoban option, be sure to add your IP to the Good IP setting.

Share this post


Link to post
Share on other sites

Hi Jack.

Many thanks for your great job, and for sharing it.

 

I'm testing it on my local server (under  Win7, Wampserver). When installing database, it gives some errors on some tables like this:

 

1101 - BLOB, TEXT, GEOMETRY or JSON column 'session_msg' can't have a default value

 

The tables are view_counter_flags, view_counter_session_kill and view_counter_settings. After some googleing, it seems to be due to mysql on windows server.  And yes, when installing on my webserver no problem at all, and it works fine. 

Sorry, I'm unable of giving any solution or suggestion. Simply, perhaps somebody can find this info useful. On my side, the hack was simple. Installed on a webserver, made a copy of DB, and an SQL creating them on my local server for the tables above (after commenting them in the install file).

 

Regards


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

Since it only occurs on your local setup, it is most likely due to that setup. This thread may help.

Share this post


Link to post
Share on other sites

Many thanks, Jack. Done! I simply wanted to post it as a warning for other users. In the case that somebody, just testing on a local server, could think that it doesn't work, to let him/her know that it was not true.

 

Further testings. Checking "Send a message to a customer" (admin->view counter->tools), it gives me an error, and call my attention that the url shown is

my-site/admin/view_counter_toolsphp  (It seems as if a dot is missed before "php"). This is on my webserver.

 

Regards


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

This s an error that only occurs in pre-2.3 shops, or maybe early 2.3 versions. To fix it, In admin/includes/boxes/view_counter.php, find

'<a href="' . tep_href_link(view_counter_tools.php,

and change it to

'<a href="' . tep_href_link('view_counter_tools.php',

And in view_counter_tools.php, there are four instances of view_counter_tools.php that need to be changed to 'view_counter_tools.php'  (add apostrophes around them).

Share this post


Link to post
Share on other sites

Thanks! Works really nice!!

 

My shop is a BS Gold.

 

Thanks again, Jack.


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Hi Jack

 

I have the module installed V1.6 on live site and 1.7 on test site.

What I find with both, is that I am unable to ban countries under tools>ban countries.What I see is a wide box which lists all the countries and a very,very narrow long box to the right, where banned countries are added using the buttons ADD or NEW,  all that happens is I get taken back to the tools menu.

I suspect I must have done something wrong although I have uninstalled completely V1.6 and replaced with V1.7 stilloblem.

 

Any thoughts, other than that it works brilliantly.

 

Many thanks

Grandp

Share this post


Link to post
Share on other sites

@@grandpa Did you apply the fixes mentioned above? Did you enable the option in the settings for blocking countries?

Share this post


Link to post
Share on other sites

I took a look at the addon today and came across php notification warnings.  Of course these are not critical; however, I like to keep my logs clean.  See attached and run a compare to find the modifications.

 

Also note, that on 2.3.4BS the admin side calls the language files in app_top.  I commented out the calls that were not needed i two of the files in admin.

 

Your reference to this being "Who's Online on steroids" is an understatement.

:thumbsup:

NewFiles.zip

Share this post


Link to post
Share on other sites

Just a suggestion.  admin/view_counter.php @ line 721: how about add a little button to auto filter on the ip address.  this would save the copy n paste.

 

This would be for 2.3.4.

 

Find

                          <td class="borderCell" width="10%"><span style="vertical-align:bottom;"><?php echo $flag . '<a onMouseover="ddrivetip(\'' . ShowIPDetails($domainInfo) . '\',\'' . $colors[COLOR_CART_POPUP_BACK] . '\',\'' . $showWidth . '\' )"; onMouseout="hideddrivetip()"' . '>' . $view['ip_number'] . '</a></span></span>'; ?></td>

Replace with

                          <td class="borderCell" width="10%"><span style="vertical-align:bottom;"><?php echo $flag . '<a onMouseover="ddrivetip(\'' . ShowIPDetails($domainInfo) . '\',\'' . $colors[COLOR_CART_POPUP_BACK] . '\',\'' . $showWidth . '\' )"; onMouseout="hideddrivetip()"' . '>' . $view['ip_number'] . '</a></span></span>' . tep_draw_form('filter_' . $view['ip_number'], 'view_counter.php', '', 'post') . tep_hide_session_id() . tep_draw_hidden_field('action', 'process') . tep_draw_hidden_field('submit_only_this_ip', TEXT_SHOW_ONLY_IP) . tep_draw_hidden_field('only_this_ip', $view['ip_number']) . tep_draw_button('', 'zoomin', null, 'primary');?></form></td>
Edited by marcello

Share this post


Link to post
Share on other sites

@@marcello I think some changes were posted to fix some of the php warnings not too long ago.

 

@@marcello Thanks for posting the code. I will take a look at it.

Share this post


Link to post
Share on other sites

No problem.

 

Just a heads up.  If you decide to go with the filter next to the ip address.  You will need to move the form creation for radio button options after this form. 

echo tep_draw_form('view_counter_form', FILENAME_VIEW_COUNTER, '', 'post') . tep_hide_session_id() . tep_draw_hidden_field('action', 'process_list');

would need to be shifted to

<td class="borderCell" width="3%" align="center"><?php echo tep_draw_form('view_counter_form_ip_number', FILENAME_VIEW_COUNTER, '', 'post') . tep_hide_session_id() . tep_draw_hidden_field('action', 'process_list') . '<input type="radio" name="ban_ip_' . $view['ip_number'] . '", value="' . $view['ip_number'] . '", onchange="this.form.submit();">'; ?></td>

and the </form> would need to shifted before the </tr>

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

×