[3.3][RC] Filter by country - version 1.0.16

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Suggested Hosts
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
janus_zonstraal
Registered User
Posts: 4692
Joined: Sat Aug 30, 2014 1:30 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by janus_zonstraal »

A member of my gets this error with the latest version
unnamed.png
After disable the extension he had access again to the board.
Sorry! My English is bat ;) !!!
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

Please disable the extension while I look into it. The code is supposed to prevent this from happening, but clearly isn't.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
User avatar
janus_zonstraal
Registered User
Posts: 4692
Joined: Sat Aug 30, 2014 1:30 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by janus_zonstraal »

Ok., thanks for investigation.
Sorry! My English is bat ;) !!!
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

Thanks for the bug report. I'm guessing there are multiple HTTP headers with the same IP in it.

You can try these changes to main_listener.php:

After line 287:

Code: Select all

		$now = time();
add:

Code: Select all

		$used_countries = array();
After line 294:

Code: Select all

			$country_code = $user_ip['country_code'];
add:

Code: Select all

			if (in_array($country_code, $used_countries))
			{
				continue;
			}
After line 353:

Code: Select all

			$this->db->sql_query($sql);
add:

Code: Select all

			$used_countries[] = $user_ip['country_code'];
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
User avatar
janus_zonstraal
Registered User
Posts: 4692
Joined: Sat Aug 30, 2014 1:30 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by janus_zonstraal »

Made the changes and ask member to test.
Sorry! My English is bat ;) !!!
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

Thank you. This is an important bug to fix I never saw before. It never occurred to me that multiple HTTP headers would have the same IP address, which is what I think happened. In the last version this would not have shown the issue because INSERT statements were made one at a time and I was directed to do them all at once using $db->sql_multi_insert.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
User avatar
janus_zonstraal
Registered User
Posts: 4692
Joined: Sat Aug 30, 2014 1:30 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by janus_zonstraal »

Now I see (sometimes) this warning

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/phpbbservices/filterbycountry/event/main_listener.php on line 364: count(): Parameter must be an array or an object that implements Countable
This is line 364
if (count($insert_sql_ary) > 0)
Sorry! My English is bat ;) !!!
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

janus_zonstraal wrote:
Thu Jul 02, 2020 2:00 pm
Now I see (sometimes) this warning

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/phpbbservices/filterbycountry/event/main_listener.php on line 364: count(): Parameter must be an array or an object that implements Countable
This is line 364
if (count($insert_sql_ary) > 0)
See this post.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
User avatar
janus_zonstraal
Registered User
Posts: 4692
Joined: Sat Aug 30, 2014 1:30 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by janus_zonstraal »

Sorry, I forgot that post :oops:
Sorry! My English is bat ;) !!!
bug-i
Registered User
Posts: 128
Joined: Fri Feb 17, 2017 12:45 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by bug-i »

I've got an idea for improvement or I guess have found a bug: The statistics is very nice, but probably wrong:

I have blocked all countries except germany. Additionally I have activated the option to allow registered users acces from restricted countries. I know that some users use vpn and therefore do not have an german ip. This isnt reflected in the statistics right now, or even worse - counted wrong into the coulum restricted page request instead of into allowed page requests.

I would suggest to add an column: "Allowed page requests from restricted countries, but known users", or at least to count the page request for allowed users from restricted pages into the column "Allowed page requests" instead of into "Restricted page requests"
stats.png
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

Thanks for your testing and I must say those are impressive statistics that you are collecting. I gather there are no issues like those recently reported and you made the recent bug fixes.

In earlier testing we figured out that VPN IPs were assigned to countries. Originally I assumed they would be country-less. Here in the USA it would be pretty unusual for a USA user to use a VPN in another country. I'm guessing that's less true in Europe where countries are more closely clustered than in the USA. So your suggestion makes sense and I'll see how feasible it is. I don't think you are experiencing a bug, but rather a feature!
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
bug-i
Registered User
Posts: 128
Joined: Fri Feb 17, 2017 12:45 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by bug-i »

MarkDHamill wrote:
Thu Jul 02, 2020 9:27 pm
Thanks for your testing and I must say those are impressive statistics that you are collecting. I gather there are no issues like those recently reported and you made the recent bug fixes.
Not sure about that, I used Version 1.0.12 until yesterday and updated now to 1.0.13.
Page request seems to be massive - so I guess there was something wrong - I will reset the counter and then we will see :D

My suggestion becomes not only relevant when using vpn. Also if you have a phpBB3-Board with international users can this become tricky if you restrict access to several countries.

And speaking of suggestions: A button "clear statistics" would be nice. :mrgreen:
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

Statistics can be cleared by disabling statistics and then reenabling them. Could be easier, however.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
bug-i
Registered User
Posts: 128
Joined: Fri Feb 17, 2017 12:45 pm

Re: [3.3][RC] Filter by country - version 1.0.13

Post by bug-i »

now with version 13 the statistics seem to be better. And according to the stats I guess that VPN and restricted access is now counted correct. Although the total numbers are still way to high. Now I have two other issues. (by the way - is this here the right place to ask for support, or should I write that somewhere else?)

Issue A):
From time to time a JSON-error (didnt have that error with Version 12) happens. I cant tell when this exactly happens, just from time to time. Also I dont know if this is really related to filter by country or if something else is broken:
Screenshot_20200705-030004.jpg

Issue B):
there are accesses counted from restricted countries from unknown users. This seems to be working now, but page-numbers for allowed request seem to be too high. I just have a very low number of users (mostly Germany). I really cant imagine that they produce around 4K page requests per day.
Nevertheless - filtering by day doesnt work. I set back all stats to zero a few days ago with upgrade to Version 13. All stats show 8K page request, but if you sum up the filtering of two single days then you receive significant more than 8k page request:
stats all.png
3rd to 4th.png
2nd to 3rd.png
User avatar
MarkDHamill
Registered User
Posts: 4247
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [3.3][RC] Filter by country - version 1.0.13

Post by MarkDHamill »

Of course I am working on a new version. The statistics seem high to me too which is why I opened this topic in the extension writer's forum:

viewtopic.php?f=461&t=2558671

The solution to the debug message is documented here:

viewtopic.php?p=15537186#p15537186

For absolute date ranges, UTC is used. Also when specifying an end date, remember it includes all time through 23:59:59 for the day.

Traffic inside the ACP is not counted.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
Post Reply

Return to “Extensions in Development”