include ("hash.php"); require_once 'mobiledetect.php'; $detect = new Mobile_Detect; // Any mobile device (phones or tablets). $debug = ""; if (isset($_GET['page'])) { $page = makesafe($_GET['page']); } else { $page = "gallery"; } // overrule page if nft is set if (isset($_GET['nft'])) { $nft = makesafe($_GET['nft']); $page= "unlock"; } else { $nft = 2; } $message = ""; $active = []; $active[1] = false; $active[2] = false; $active[3] = false; $active[4] = false; $active[5] = false; $uploadOk = 0; $action = ""; $string = file_get_contents("links.json"); $json = json_decode($string,true); if(isset($_POST["submit"]) ) { $debug="submit"; $action = "upload"; $element = makesafe($_POST['element']); $link = makesafe($_POST['link']); $debug .= $link; $code = makesafe($_POST['code']); $allowed = false; if (is_numeric($element) && ($code == $hashes[$element] ) ) { $allowed = true; } if ($allowed) { // previously: used $active[] here $name = $element."-"; // .$code."-"; $target_dir = "uploads/"; $filename = str_replace(" ", "_", $name.basename($_FILES["fileToUpload"]["name"]) ); $target_file1 = $target_dir . $filename; $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file1,PATHINFO_EXTENSION)); $target_file2 = $target_dir . "upload".$element.".".$imageFileType; // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { $message = "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $message = "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { //$message = "Sorry, file already exists."; //$uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 5000000) { $message = "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg") { $message = "Only JPG, JPEG and PNG files are allowed. (not ".$imageFileType.")"; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { // $message = "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if ($code."" != "") { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file1)) { copy($target_file1, $target_file2); $message = "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded."; $json[$element]=array("nr"=>$element, "status"=>"unknown", "link" => $link, "code" => $code, "file" => $filename); $data = json_encode($json); $myfile = fopen("links.json", "w") or die("Try again later"); fwrite($myfile, $data); fclose($myfile); /* $to_email_address = "sveenhof@gmail.com"; $subject = "Element 0".$element; $message = "Upload from ".$_SERVER['REMOTE_ADDR']." is:".$_FILES["fileToUpload"]["name"]; mail($to_email_address,$subject,$message); */ } } else { //$message = "Sorry, there was an error uploading your file."; } } } else { $message = "Purchase the NFT to obtain the upload code for this spot"; $uploadOk = 0; } } function makesafe($hack) { $hack = htmlspecialchars($hack); $hack = strip_tags($hack); $hack = str_replace("select", "", $hack); $hack = str_replace("SELECT", "", $hack); $hack = str_replace("update", "", $hack); $hack = str_replace("UPDATE", "", $hack); $hack = str_replace("delete", "", $hack); $hack = str_replace("DELETE", "", $hack); $hack = str_replace("drop", "", $hack); $hack = str_replace("DROP", "", $hack); $hack = str_replace(";", "", $hack); $hack = str_replace("--", "", $hack); $hack = str_replace("\0", "", $hack); //Finish filtering $hack of html tags and dangerous funcs //Begin filtering $hack of non alphanumeric characters // $hack = preg_replace("/[^0-9a-z -#]/i",'', $hack); $hack = addslashes($hack); return $hack; } function doubledigits($arg) { if ($arg<10) { return "0".$arg; } else { return $arg; } } ?>
';
} else {
$str.= $linkname." >";
}
$str .= "";
}
$str .= "
LFG
— SNDRV (@sndrv) December 20, 2021
WAGMI !https://t.co/tUzN6snle0#NFTgalleryRun #NFT #AugmentedReality pic.twitter.com/ZTUnUiZ5Ub