|
This script, basically, will stop a user viewing a page of your site if you add their IP to the list at the top, just paste this code at the top of every page of your site or save it as banned.php and put:
<?php include("banned.php"); ?>
at the top of every page.
<?php $banned_ip = array(); $banned_ip[] = '111.111.111.111'; $banned_ip[] = '111.111.111.112'; $banned_ip[] = '111.111.111.113'; $banned_ip[] = '111.111.111.114';
foreach($banned_ip as $banned) { $ip = $_SERVER['REMOTE_ADDR']; if($ip == $banned){ echo "You have been banned!"; exit();
} } ?>
|
|
|
|
Personally, it'd be easier to use "die('You have been banned!');" But echo then exit() work fine.
|
|
|
|
|
What does die() do? End the document?
|
|
|
|
Ends all PHP script after it from exicuting I believe.
|
|
|
|
|
die() would end everything. HTML included, i believe.
die() also takes in an optional parameter, which allows you to post a message.
|
Religion should be put back in its place - beneath man, not above him.
|
|
|