网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   代码交流 (https://www.0058.net/forumdisplay.php?f=16)
-   -   ban / block IP addresses (https://www.0058.net/showthread.php?t=1594)

topvip 2006-10-18 12:28 AM

ban / block IP addresses
 
This example gets the users IP address and exits the page if it matches a banned number.
Quote:

<?php

//Set banned IP
$banned = '123.123.123.123';

//get user IP address
$userip = $_SERVER['REMOTE_ADDR'];

//check for banned IP address
if($userip == $banned){
echo "<BR>This IP address has been banned";
exit();
}

//continue with script...

?>


All times are GMT +8. The time now is 10:49 PM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.