Banning


#1

IS there a way I can ba someone’s IP from visiting website?

Also are there any security measures I should take; or will dreamhost do that for me

Thanks very much.


#2

I’m not too sure on that, I’ll let someone else reply with that one.
You can always use a PHP alternative though.
If it’s just PHP you want, then something like

$ban_arr = array();
$ban_arr[] = “123.456.789.1”;
if($_SERVER[‘REMOTE_ADDR’], $ban_arr){
echo “You are banned.”;
exit();
}

Just keep adding a new $ban_arr for each banned id. Your best bet is to put this in a file called ban.php and then include it in all your files that need it. Problem with this method is you would have to upload the script everytime someone wants banning. And it won’t ban IP ranges. But it’s a quick and easy way to do it.
Or you could store the IPs in a database. But everytime the script is called, it would query the database which takes longer and increases the amount of open queries for you db.


#3

Im very new to all this and I dont really understand

I used front page to make the website.

i remember hearing that you can ban ips on dreamhost

Thanks for your help


#4

G’day, MasterT.
See if the information in this thread, “Banning IPs”, is of any help to you.
All the best,
marsbar