From b884b4c200253194c5da793bbba3e7ab449cc4e1 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Wed, 14 Mar 2012 07:40:06 +0000 Subject: [PATCH] + add a isLocalIP() function. --- framework/helper.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/framework/helper.class.php b/framework/helper.class.php index 300d328578..c7c9d631a7 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -439,3 +439,14 @@ function a($var) print_r($var); echo ""; } + +/** + * Judge the server ip is local or not. + * + * @access public + * @return void + */ +function isLocalIP() +{ + return !filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE); +}