Forum Moderators: coopster

Message Too Old, No Replies

How to limit access in a second of a IP using PHP?

Limit and auto ban the IP which access more than x times in a second?

         

redstrike

5:42 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



I have asked this question in the General box!

And I received the answer quickly but i am not a coder! So i looking someone for help me to code that ideal!

If your pages are PHP, ASP or another server side language then you could place a snippet of code at the top of each page which would do this. In PHP you can get at the IP using $_SERVER['REMOTE_ADDR']. Then you save this in a file every time the page is accessed. If too many requests come from an IP then add it to a ban list. The ban list is checked on every request before doing anything else. If the IP is on the ban list then 301 the user to localhost or just give them a not found error.

Could someone help me code this ideal? My site getting attack by ddos... but i am not a coder so i could't do it.

Thank you very much!

whoisgregg

5:54 pm on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like you could use the bad bot blocking script [webmasterworld.com] some WebmasterWorld members are constantly improving. :)

redstrike

7:22 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



I have read those topics.

They are good and i have more things to study...

Although my English are bad, i try my best!

Thanks for your help!