![]() |
Allow Certain IP's To Access (or View) AdminCP
Can someone tell me how to stop anyone from viewing the admincp if they don't have an IP in the list? I know I can use a htaccess to stop anyone from accessing it, but is there a way that I can enter an IP address (If the admin user uses a static IP) that is only allowed to see the admincp?
|
At the beginning of your index.php file in your admincp folder, add the following:
Code:
if(!preg_match("/^(68\.142\.18\.|68\.143\.19\.)/",$_SERVER['REMOTE_ADDR'])){ Code:
if(!preg_match("/^68\.142\.1\.143/",$_SERVER['REMOTE_ADDR'])){ Here is an example of the WRONG way: Code:
if(!preg_match("/^68\.142\.1/",$_SERVER['REMOTE_ADDR'])){ |
Do you use Apache?
Then i'd suggest using .htaccess <Limit GET POST> order deny,allow deny from all allow from 199.166.210.12 </Limit> This wil only allow access form IP 199.166.210.12. If you want to allow several IPs, repeat the allow-line. Isn't that what you want? |
What I posted was a software mod in PHP... the apache version is more desirable and works just as well.
If your ISP doesn't allow .htaccess, do the PHP version. |
Quote:
All other scripts would still be accessable? |
Quote:
I did use htaccess to protect my admin cp, but one day I forgot my password and I had to go into my cpanel to re-create the htaccess. Also, at times where I need quick access, and don't want to enter a password, this fix does it. :ermm: |
All times are GMT. The time now is 07:00 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|