From 6ec371bff3d3eda0c535fe773c292f66bd746a7a Mon Sep 17 00:00:00 2001 From: root Date: Sun, 7 Dec 2014 00:33:54 +0100 Subject: Bug fixed and added warning for HTTP status codes. --- down/http.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'down/http.php') diff --git a/down/http.php b/down/http.php index 5e0351d..cf2a302 100644 --- a/down/http.php +++ b/down/http.php @@ -1,6 +1,5 @@ =200 && $httpcode<400 ) - return true; - else - return false; + return 2; + else if ( $httpcode >= 400) + return $httpcode; + else + return 0; } function sanitizeUrl($url){ if ( ! preg_match("|^[a-zA-Z]+://|", $url) ) $url = "http://" . $url; - if ( preg_match("|^[a-zA-Z]+://.+\.[a-zA-Z]+(?/.*)|", $url, $match) ) - $url = str_replace($match["query"], "", $url); + if ( preg_match("|^(?[a-zA-Z]+://(.+\.[a-zA-Z]+){1,})/.*|", $url, $match) ) + $url = $match["host"]; return $url; } -- cgit v1.2.3