mirror of
https://github.com/c0de-archive/GAMA-Site.git
synced 2024-10-31 18:27:46 +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;
|
||||
}
|
||||
|
||||
function checkRemoteFile($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
// 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;
|
||||
}
|
||||
function checkRemoteFile($url){
|
||||
if (@file_get_contents($url)): return true;
|
||||
else: return false;
|
||||
endif;
|
||||
}
|
||||
|
||||
if(isset($_GET['l'])) { // if there is a link...
|
||||
|
Loading…
Reference in New Issue
Block a user