diff options
Diffstat (limited to 'www/functions/func_upload.php')
| -rwxr-xr-x | www/functions/func_upload.php | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/www/functions/func_upload.php b/www/functions/func_upload.php index f4f9b82..6f39ad3 100755 --- a/www/functions/func_upload.php +++ b/www/functions/func_upload.php @@ -175,18 +175,19 @@ function upload($path){ //not used atm -//function web_upload($db){ -// $url = $_POST["url"]; +function web_upload($db){ + $url = $_POST["url"]; // if(!preg_match("/^((https?|ftp)?://|www\.|ftp\.)?([-a-z0-9+&@#/%?=~_|!:,.;]+\.)+[a-z]{2}[a-z]*/i", $url)){ -// echo "no hyperlink"; -// return false; -// } -// if(!preg_match("/^[a-zA-Z]+://", $url){ -// $url = "http://".$url; -// } -// $file = file_get_contents($url); -// if(!$file){ -// echo "Couldn't download ".$url; -// return false; -// } -//} + if(!preg_match("/^((https?|ftp)://|www\.|ftp\.)([-a-z0-9+&@#/%?=~_|!:,.;]+\.)+[a-z]{2}[a-z]*/i", $url)){ + echo "no hyperlink"; + return false; + } + if(!preg_match("/^[a-zA-Z]+://", $url){ + $url = "http://".$url; + } + $file = file_get_contents($url); + if(!$file){ + echo "Couldn't download ".$url; + return false; + } +} |
