The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Only Allow Whitelisted IP's ?
#1
Hey Guys,

I see that it's possible to black list and white list IPs.

Is it possible to only allow whitelisted IPs to login...i.e. lock the whole system down apart from whitelisted IP's?

Cheers,

Matt
  Reply
#2
There are a few ways you can handle this.

//go to users/maintenance.php and delete the line
if($settings->site_offline==0) Redirect::to($us_url_root.'index.php');

Then just go to usersc/includes/head_tags.php
At the bottom, open your php tag and use one of the two of these if statements

//if you want a massive amount of IPs that you can control from the dashboard, you can do
if($currentPage != 'maintenance.php'){//prevent redirect loops
$ip = ipCheck();
$check = $db->query("SELECT ip FROM us_ip_whitelist WHERE ip = ?",[$ip])->count();
if($check < 1){
Redirect::to($us_url_root.'users/maintenance.php');
}
}

//if you only want a few ip's to visit the site, then putting them in an array is a little faster
$ips = [
'127.0.0.1','192.168.95.153'
];
if($currentPage != 'maintenance.php'){//prevent redirect loops
$ip = ipCheck();
if(!in_array($ip,$ips)){
Redirect::to($us_url_root.'users/maintenance.php');
}
}
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)