mirror of
https://github.com/c0de-archive/GAMA-Site.git
synced 2024-12-22 17:42:40 +00:00
Changed checkRemoteFile function to be faster and smaller
This requires that links be public. Forum links appear not to work in testing.
This commit is contained in:
parent
b3d1dfc202
commit
33712de612
@ -45,19 +45,10 @@ function prepOutputText($text) { // Takes mysql string and makes it able to be u
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkRemoteFile($url)
|
function checkRemoteFile($url){
|
||||||
{
|
if (@file_get_contents($url)): return true;
|
||||||
$ch = curl_init();
|
else: return false;
|
||||||
curl_setopt($ch, CURLOPT_URL,$url);
|
endif;
|
||||||
// don't download content
|
|
||||||
curl_setopt($ch, CURLOPT_NOBODY, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
if(curl_exec($ch)!==FALSE){
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_GET['l'])) { // if there is a link...
|
if(isset($_GET['l'])) { // if there is a link...
|
||||||
|
Loading…
Reference in New Issue
Block a user