验证 URL 的长度、大写字母和某些完整单词


Validate URL's for length, captial letters and certain whole words?

我有一些代码,它获取某人在注册我的应用程序时选择的 URL 并对其进行检查。但我想添加以下限制。

  • 必须至少为 3 个字母
  • 没有国会大厦的信件
  • 没有特定的词"管理,支持等..."

这是我到目前为止所拥有的 - 但它现在只在寻找特殊的字母:

elseif($action == "validate"){
    $option = $_GET["option"];
    $value = $_GET["value"];
    switch($option){
    case "URL":             
$sql = mysql_select_db($value,$connect);
if(preg_match ( "@[^A-Za-z0-9]+@i", $value ) > 0) { $valid = "FALSE";   continue; }
$sql == 1 ?  $valid = "FALSE" : $valid = "TRUE";
}
if(preg_match("@^[a-z0-9]{3,25}$@", $value ) && (!preg_match("@admin|support|anything else@",$value))) { 
    //Restrict the word length to 25 characters at max, 3 at least.
    //Do some stuff. The $value meets the requirements as set forth
 ...
}
elseif($action == "validate"){
    $option = $_GET["option"];
    $value = $_GET["value"];
    switch($option){
    case "URL":             
    $sql = mysql_select_db($value,$connect);
    if(preg_match ( "@[^A-Za-z0-9]+@i", $value ) > 0) { $valid = "FALSE";   continue; }
    if(strlen($value) <= 3) { $valid = "FALSE";   continue; } //less than 3 char
    if(strstr($value, 'admin')) { $valid = "FALSE";   continue; }
      //.. the same for your other words
    $sql == 1 ?  $valid = "FALSE" : $valid = "TRUE";
}