From 7c1299521f31d6eb733e29455ccad8c92cbc0a7b Mon Sep 17 00:00:00 2001 From: moehm Date: Mon, 28 Apr 2014 11:12:38 +0200 Subject: Unimportant changes #2 --- www/functions/func_upload.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'www/functions/func_upload.php') 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; + } +} -- cgit v1.2.3