Jump to content

Is it possible to restric access to /admin page to only specific ip address?


ak1001
 Share

Recommended Posts

Is it possible to restrict access to /admin page to only specific ip addresses?

like in apache conf for example :

<Location />
  Require ip 192.168.0.0/24
</Location>

?

Link to comment
Share on other sites

You could edit /site/templates/admin.php so that it looks something like this:

// Get the user's IP address
$ip = $session->getIP();
// Define the allowed IP addresses
$allowed_ips = ['111.111.111.111', '222.222.222.222'];
// Check user's IP is allowed
if(!in_array($ip, $allowed_ips)) {
	return 'Access denied';
}

require($config->paths->adminTemplates . 'controller.php'); 

 

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...