Exemple #1
0
 function is_url($s)
 {
     // checks if string is a url
     $is_url = false;
     if (strlen($s) > 4 && isalpha($s[0]) && !strstr($s, '..') && substr_count($s, '.') == 2 && (substr($s, -4, 1) == '.' || substr($s, -3, 1) == '.')) {
         $is_url = true;
     }
     if (filter_var($s, FILTER_VALIDATE_URL) != FALSE) {
         $is_url = true;
     }
     return $is_url;
 }
Exemple #2
0
 function is_url($s)
 {
     // checks if string is a url
     $is_url = 0;
     if (strlen($s) > 4 && isalpha($s[0]) && !strstr($s, '..') && substr_count($s, '.') == 2 && (substr($s, -4, 1) == '.' || substr($s, -3, 1) == '.')) {
         $is_url = 1;
     }
     return $is_url;
 }