- Fixed bug #6697: improved the URL validation function

4.5.x
Dries Buytaert 2004-03-27 09:32:12 +00:00
parent 0b876c4486
commit f3d419b74e
1 changed files with 2 additions and 2 deletions

View File

@ -563,10 +563,10 @@ function valid_email_address($mail) {
*/
function valid_url($url, $absolute = false) {
if ($absolute) {
return preg_match("/^http:\/\/[a-zA-z0-9\/:_\-_\.,]+$/", $url);
return preg_match("/^(http|https|ftp):\/\/[a-z0-9\/:_\-_\.\?,~=#&]+$/i", $url);
}
else {
return preg_match("/^[a-zA-z0-9\/:_\-_\.,]+$/", $url);
return preg_match("/^[a-z0-9\/:_\-_\.,]+$/i", $url);
}
}