daily pastebin goal
83%
SHARE
TWEET

validate IP (with regexp)

tolikpunkoff Jul 26th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //...
  2. $ip_pattern="#(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)#";
  3. //...
  4.  
  5. function isip($ip_str) //соответствие данных формату IP
  6. {  
  7.     global $ip_pattern;
  8.     $ret=FALSE;
  9.     if (preg_match($ip_pattern,$ip_str))
  10.     {
  11.         $ret=TRUE;
  12.     }
  13.     return $ret;
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top