输入验证安全性 - 不允许 http:// 或 https://



我尝试做一些基本的验证。我想使提交链接变得不可能。我写了一些工作半好的代码。如果在输入的开头http://https://

不起作用
if(((stripos($message, "http://")) || (stripos($message, "https://"))) !== false)
    {
echo"Link is Here";
    }
else 
    {  
echo"Link is NOT Here";
    }

有没有办法解决这个问题。我使用函数stripos因为我必须确保http://https://不区分大小写,所以我可以接受所有类型的托盘,例如HTTP://hTTps://

这与

你的if陈述有关。将其更改为:

if(stripos($message, "http://") !== false || stripos($message, "https://") !== false)
{
    echo "Link is here";
}
else 
{  
    echo "Link is NOT here";
}

最新更新