Best Way to Secure Your AdminCP


I have found that this is the absolute best way to secure your AdminCP. It's a simple code that is added to the top of your admin.php file.

Basically what it does, is if a person's IP address isn't whitelisted, it automatically redirects them to any chosen URL, which is impossible to get passed (unless editing the file obviously)

This isn't very practical if your Administators log in from several different IP's or their IP's change frequently, so make sure you talk it over with anyone that has access to the AdminCP.

On with the code!

Place this code at the top of your admin.php file, above EVERYTHING.
<?php $allow = array("", "" );
if(!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) {
} ?>
Replace the two IP addresses above with your IP and another IP, or just simply delete the second one, including the comma.

If you do not know your IP address, you can find it at

Пожалуйста, войдите или зарегистрируйтесь для просмотра текста.

(Thank you Floris)

Change to the URL of your choice, and it will automatically start redirecting for those who are not whitelisted!

To add an IP address, just simply follow the same pattern as the first two. "#", "#",