|
|
#1 |
|
Member
Join Date: Sep 2007
Posts: 58
Rep Power: 9 ![]() |
how do i block an ip from viewing my site
|
|
|
|
|
|
#2 |
|
Coder
Join Date: Mar 2006
Posts: 4,567
Rep Power: 111 ![]() ![]() |
Best bet is to do this at the host level. Most hosts have the ability to set IP's to block within the hosting interface.
|
|
|
|
|
|
#3 |
|
Member
Join Date: Sep 2007
Posts: 58
Rep Power: 9 ![]() |
I am with 1and1 I hope this works here is the code for PHP
<?php $deny = array("222.222.222", "333.333.333"); if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) { header("location: http://www.google.com/"); exit(); } ?> any more feedback please
|
|
|
|
|
|
#4 |
|
Coder
Join Date: Mar 2006
Posts: 4,567
Rep Power: 111 ![]() ![]() |
I dont know anything about 1and1 but as I said its much easier to log into your hosting control panel and implement their IP blocking tools than try and create your own.
And if your host doesnt offer such a function I suggest lookinginto doing it via .htaccess. http://www.javascriptkit.com/howto/htaccess5.shtml |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| adding content to specific pages | archavir | v3.1 Questions & Support | 6 | 08-21-2007 05:08 AM |