use '?random=jpg' to get an URL of a random file (3)

This commit is contained in:
qkqpttgf 2020-03-09 19:09:12 +08:00 committed by GitHub
parent 57ead42c49
commit be51285dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -624,7 +624,7 @@ function main($path)
if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl'];
}
$tmp = array_values($tmp);
if (count($tmp)>0) return output($tmp[rand(0,count($tmp)-1)],200);
if (count($tmp)>0) return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]);
else return output('',404);
} else return output('',401);
}