Using .htaccess 












Using .htaccess/.htpasswd Password Protection 





Coding Tips 








Uploads and Downloads 



Mail 
see it on this page





Working with Images 


Frequently Requested Website Functionality 
see it on this page
see it on this page
see it on this page
see it on this page











Using PHP 




Website Managment 








Other Tips 









Ban or allow IP Addresses (not using htaccess)
While a .htaccess file can be used to ban or allow, it cannot be selective by function. This is something you can easily do with a script.
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipArray = preg_replace("#\r\n?|\n#","",file('IP.dat')); // read the file into an array and remove new line breaks (should cover all OS)
foreach ($ipArray as $ipTest) {
if (substr_count($ip, $ipTest) != "0") {
header('location: /banned.htm'); // the banned display page
die();
}
}
?>
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$ipArray = preg_replace("#\r\n?|\n#","",file('IP.dat')); // read the file into an array and remove new line breaks (should cover all OS)
unset($allowed);
foreach ($ipArray as $ipTest) if (substr_count($ip, $ipTest) != "0") $allowed = "yes";
if ($allowed != "yes") {
header('location: /banned.htm'); // the banned display page
die();
}
?>
