im silly
This commit is contained in:
parent
af520d265d
commit
26cb9e0b8f
@ -47,22 +47,19 @@ if (!isZipFile($map["name"])) {
|
||||
die();
|
||||
}
|
||||
|
||||
$fileHash = null;
|
||||
try {
|
||||
$fileHash = hash_file("sha256", $file); // the hash of the file
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
$exists = false;
|
||||
if ($fileHash != null) {
|
||||
foreach (scandir($target_dir) as $file) { // scan the maps directory for a file with the same hash
|
||||
if ($file == "." || $file == "..") { // ignore the . and .. files
|
||||
continue;
|
||||
}
|
||||
if (hash_file("sha256", $target_dir . $file) == $fileHash) {
|
||||
$mapId = pathinfo($file, PATHINFO_FILENAME);
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($exists) { // if the file already exists, redirect to the existing file
|
||||
header("Location: /?map=https://wip.fascinated.cc/maps/" . $mapId . ".zip");
|
||||
|
Reference in New Issue
Block a user