PDA

View Full Version : How to ban an IP address in phplinkdirectory script?


westhaven
10-24-2005, 02:27 PM
How to ban an IP address in phplinkdirectory script? I am really fed up of some visitors who keep spamming my dirs.

phil2564
10-25-2005, 03:51 PM
Hi! Try doing this!

Step 1 - Make a new php file called ban.php and copy this code into it then save the file in the templates folder.

Content visible to registered users only.


STEP 2 - In the main template file called main.tpl in the templates folder open main.tpl and look for {include file="header.tpl"} that is around line 17 above that include this code:

Content visible to registered users only.

And thats all did not test it but it should work like a charm. If you need to add a few IPs you can just copy the code over and put the next IP in it like the example below. If you need to do it for a major amount of ips let me know I will give ya better script to put in the ban.php file. Otherwise try this out for a while should work great.

Phil

EXAMPLE FOR BANNING 4 IPs: Content visible to registered users only.

David
10-25-2005, 04:10 PM
Nice!
Thanks for the contribution. :)

Bill
10-25-2005, 10:14 PM
Nice work, I wonder if we can intergrate it into the ACP. ;)

Timeless
10-26-2005, 10:48 AM
Hi m8,

i have test this one..cause this function would be nice..but i got this error and i think, i have everything made right..its easy...

Fatal error: Smarty error: [in ban.php line 7]: syntax error: unrecognized tag: header("HTTP/1.0 403 Forbidden"); exit(0); (Smarty_Compiler.class.php, line 436)

phil2564
10-30-2005, 04:18 AM
Sorry I should have tested this one before I posted. But I did a quick test and this is how it must be done. I told you guys to put the include statement in the main.tpl my mistake it must be in the header.tpl at the top. So it can check for the ips to ban. So before any code on the header.tpl file put this code

Content visible to registered users only.

So it should look like this in your header file --- "this is the first few lines."
Content visible to registered users only.

STEP 2 the ban.php file is still the same:

Content visible to registered users only.

You can also ban multiple IPs the same way I said in my previous posts using this system.

Hope this helps everyone and go ahead add this one in its a big helper.
If you need any help with getting it to work email me at: admin@autopartlistings.com
Phil
CHECKOUT MY DIRECTORY
www.autopartlistings.com