We just need to add the following code in the feedback.php to judge it.
Note: The following is just a PHP restricted IP instance code, if you intend to apply to the CMS, please modify it yourself, or if you are using DEDECMS, you can contact the site.
Copy CodeThe code is as follows:
Add IP Access Restrictions
if (getenv (' http_client_ip ') && strcasecmp (getenv (' http_client_ip '), ' unknown ') {
$userip = getenv (' http_client_ip ');
} elseif (getenv (' http_x_forwarded_for ') && strcasecmp (getenv (' http_x_forwarded_for '), ' unknown ') {
$userip = getenv (' http_x_forwarded_for ');
} elseif (getenv (' remote_addr ') && strcasecmp (getenv (' remote_addr '), ' unknown ') {
$userip = getenv (' remote_addr ');
} elseif (Isset ($_server[' remote_addr ") && $_server[' remote_addr '] && strcasecmp ($_server[' Remote_ ADDR '], ' unknown ') {
$userip = $_server[' remote_addr ');
}
Limit IP
if ($userip = = ' 27.37.188.128 ') {
Header ("location:http://sc.jb51.net");//forbidden to jump to the home station of the script
Exit
}
restricting IP Segments
$ip _arr = Explode ('. ', $userip);
#限制的ip段, suppose it's 192.168.*.*.
if (! ( ($ip _arr[0] = = ' 192 ' && $ip _arr[1]== ' 168 '))) {
Header ("location:http://sc.jb51.net");//forbidden to jump to the script home material station
Exit
}else{
Header ("location:http://www.jb51.net");//normal IP direct access to the home page of the script
Exit
}
?>
http://www.bkjia.com/PHPjc/323270.html www.bkjia.com true http://www.bkjia.com/PHPjc/323270.html techarticle We just need to add the following code in the feedback.php to judge it. Note: Below is just a PHP limit IP instance code, if you intend to apply to the CMS, please modify ...