How can I block certain IP. address from visiting my site?

Status
Not open for further replies.

Michel Z.

New member
Jun 24, 2006
910
8
0
Israel
I want to block IP. address of person visiting my site.
I don't want this person to visit my site & being a SPY all the time!
I have his IP. address through my site stats.
How can I do this? Through my host or domain provider? Where do I go (which option)?
Many thanks! :)
 


You could do it like this:

Code:
<?php
if($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') {

YOUR SITE CODE HERE

} else {
echo "Fuck off douchebag!";
}
?>

I'm a PHP noob, so if it doesn't work, don't be pissed. :p
 
does this have to do with your post the other day?

Nevermind, that was someone else.
 
You could do it like this:

Code:
<?php
if($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') {
 
YOUR SITE CODE HERE
 
} else {
echo "Fuck off douchebag!";
}
?>

I'm a PHP noob, so if it doesn't work, don't be pissed. :p

I like your echo "Fuck off douchebag!" LOL :D
 
What system are you using? Unix or Windows?

If it's a Unix system using Apache then you can put this in a .htaccess file and block the IP address. Just remember. You can block the IP but there is always a way around that if he's smart enough. He'll just change the IP and you'll be playing whack-a-mole with him.

In any case. Here's the code. Replace the xxx.xxx.xxx.xxx with the IP address.

Code:
deny from xxx.xxx.xxx.xxx
Zen
 
What system are you using? Unix or Windows?

If it's a Unix system using Apache then you can put this in a .htaccess file and block the IP address. Just remember. You can block the IP but there is always a way around that if he's smart enough. He'll just change the IP and you'll be playing whack-a-mole with him.

In any case. Here's the code. Replace the xxx.xxx.xxx.xxx with the IP address.

Code:
deny from xxx.xxx.xxx.xxx
Zen

Also noticed now that my cpanel has a "IP Deny Manager" option, that should do the job as well! :)
 
Status
Not open for further replies.