How to ban IP addresses?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

How to ban IP addresses?

Post by Mercury »

Question 1: I would like to ban this IP address: 91.201.66.73 I have added this IP to the field in main configuration but the IP still appears in session list even after deleting all sessions.

Question 2: What if anything should I place between each IP in that field in main configuration? Should I put space, comma, or a comma followed by a space?

Question 3: Is there any limit to the number of IP I can put in that field?

Thank you for your help.
www.puppylinuxforum.org
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How to ban IP addresses?

Post by Thorsten »

Hi,
posting.php?mode=quote&f=2&p=32489
Mercury wrote:Question 1: I would like to ban this IP address: 91.201.66.73 I have added this IP to the field in main configuration but the IP still appears in session list even after deleting all sessions.
The IP ban is currently only used for preventing an IP to add content. I could add the IP ban to the session tracking, too. Would you suggest it?
Mercury wrote:Question 2: What if anything should I place between each IP in that field in main configuration? Should I put space, comma, or a comma followed by a space?
Please put a space between the IPs.
Mercury wrote:Question 3: Is there any limit to the number of IP I can put in that field?
yes, 255 characters currently.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

Thorsten wrote:The IP ban is currently only used for preventing an IP to add content.
Useful but not what I wanted.
I could add the IP ban to the session tracking, too. Would you suggest it?
Most definitely. If you want to know why I want to ban that IP then do a Scroogle search for it (I don’t use Go0gle, it’s evil).
Please put a space between the IPs.
OK
Thorsten wrote:
Mercury wrote:Question 3: Is there any limit to the number of IP I can put in that field?
yes, 255 characters currently.
My rough calculation suggests that a limit of 255 characters = 15 IP max (including spaces).
www.puppylinuxforum.org
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How to ban IP addresses?

Post by Thorsten »

Hi,

this should add the IP ban for sessions as well:

https://github.com/thorsten/phpMyFAQ/co ... 5feea2ef10

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

I assume I should copy the contents of the code and save as “Session.php” in the “inc” directory.

That is very impress Thorsten. I will give it a try and let you know how it works. :)
www.puppylinuxforum.org
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How to ban IP addresses?

Post by Thorsten »

Hi,

you can use this file version of inc/Session.php: https://github.com/thorsten/phpMyFAQ/bl ... ession.php

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

I’m confused, what is the difference and which one do I use in 2.5.4 (I haven’t upgraded yet)
www.puppylinuxforum.org
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How to ban IP addresses?

Post by Thorsten »

Hi,

ah, okay... you can use the function function userTracking() from above in your 2.5.4 based version. I checked the code base.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

Thorsten wrote:ah, okay... you can use the function function userTracking() from above in your 2.5.4 based version. I checked the code base.
I don't have a clue about what you just said. I used the search in my browser to find userTracking but that didn't enlighten me. If you are suggesting that I modify that file then I wouldn't know where to begin.
www.puppylinuxforum.org
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How to ban IP addresses?

Post by Thorsten »

Hi,

I added the patch to 2.5.x, you can grab the file here:

https://github.com/thorsten/phpMyFAQ/bl ... ession.php

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

Thanks, I'll try it after I eat my lunch.

This isn't mission critical so don't feel like you have to wait around here.
www.puppylinuxforum.org
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: How to ban IP addresses?

Post by Thorsten »

Hi,

I don't wait. I'll leave now for cooking dinner. :-)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

I never saw a download link for https://github.com/thorsten/phpMyFAQ/bl ... ession.php so I copied and pasted the text into a text editor and saved it that way. Then I uploaded Session.php

To test I used two PC. Each PC had it’s own Internet connection and IP address. I used one to enter an IP in “Ban these IPs”. Then I visited the site with the banned IP but no joy. I visited several times as the banned IP but still no joy. I even forced a reload in the browser.

Any ideas why this didn’t work? Did I do something wrong? This seems simple enough to test so I think I got that part right.
www.puppylinuxforum.org
knubew
Posts: 10
Joined: Wed Jan 13, 2010 1:52 am

IP Adresse sperren / Yahoo! Slurp

Post by knubew »

Thorsten wrote:Hi,

you can use this file version of inc/Session.php: https://github.com/thorsten/phpMyFAQ/bl ... ession.php

bye
Thorsten
Hallo Thorsten,

ich habe ebenfalls das Problem, dass eine bestimmte IP (67.195.115.57 / Yahoo! Slurp) jeden Tag mehrere tausend Session-Einträge in den Benutzer-Sessions hinterlässt. Auch die neue Datei "Session.php" hilft da leider nicht, obgleich ich die IP im Admin-Interface gebannt habe. Auch der "Yahoo! Slurp" Eintrag in der "/config/constants.php" scheint gründsätzlich nicht zu helfen.

Die Detail-Session Einträge sehen dann wie folgt aus:

2010-12-31 00:14:26 old_session (1078879)
Referer:
Browser: Mozilla/5.0 (compatible, Yahoo! Slurp, http://help.yahoo.com/help/us/ysearch/slurp)
IP-Adresse: 67.195.115.57

Es wäre toll, wenn es dafür eine Lösung gäbe.

Guten Rutsch !
Knut
Mercury
Posts: 51
Joined: Fri Dec 17, 2010 9:25 pm
Contact:

Re: How to ban IP addresses?

Post by Mercury »

Hi knubew,
That bot really does belongs to Yahoo. This might help you: How to Reduce the Number of Requests the Search Crawler Makes on Your Site

As I don’t speak German I used a translator to read your post. :)
www.puppylinuxforum.org
Post Reply