forked from YandolsZX/IcarusImeji
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							97 lines
						
					
					
						
							4.2 KiB
						
					
					
				
			
		
		
	
	
							97 lines
						
					
					
						
							4.2 KiB
						
					
					
				<?php
 | 
						|
//Imeji Uploader -- Secret Version v0.2 -- Based on Core v0.8c
 | 
						|
$target_dir = "private/";
 | 
						|
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
 | 
						|
$target_filenameonly = basename($_FILES["fileToUpload"]["name"]);
 | 
						|
$uploadOk = 1;
 | 
						|
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
 | 
						|
// Check authentication.
 | 
						|
if($_POST["authcode"] != 104616) {
 | 
						|
	echo "Authentication code not valid";
 | 
						|
	$uploadOk = 2;
 | 
						|
//	header('Location: ./uploadfailedr1.php');
 | 
						|
//	echo $_POST['name'];
 | 
						|
//	echo $_POST['authcode'];
 | 
						|
}
 | 
						|
/*
 | 
						|
// Check if image file is a actual image or fake image
 | 
						|
if(isset($_POST["submit"])) {
 | 
						|
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
 | 
						|
    if($check !== false) {
 | 
						|
        echo "File is an image - " . $check["mime"] . ".";
 | 
						|
        $uploadOk = 1;
 | 
						|
    } else {
 | 
						|
        echo "File is not an image.";
 | 
						|
        $uploadOk = 0;
 | 
						|
        header('Location: ./uploadfailed.php');
 | 
						|
    }
 | 
						|
}
 | 
						|
*/
 | 
						|
// Check if file already exists
 | 
						|
if (file_exists($target_file)) {
 | 
						|
    echo "Sorry, file already exists.";
 | 
						|
    $uploadOk = 0;
 | 
						|
    header('Location: ./uploadfailedr2.php');
 | 
						|
}
 | 
						|
// Check file size (Currently Max 6MB)
 | 
						|
if ($_FILES["fileToUpload"]["size"] > 6291456) {
 | 
						|
    echo "Sorry, your file is too large. (Max is 6MB)";
 | 
						|
    $uploadOk = 0;
 | 
						|
    header('Location: ./uploadfailedr2.php');
 | 
						|
}
 | 
						|
/*
 | 
						|
// Allow certain file formats
 | 
						|
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
 | 
						|
&& $imageFileType != "gif" && $imageFileType != "svg" ) {
 | 
						|
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
 | 
						|
    $uploadOk = 0;
 | 
						|
    header('Location: ./uploadfailed.php');
 | 
						|
}
 | 
						|
*/
 | 
						|
// Check if $uploadOk is set to 0 by an error
 | 
						|
if ($uploadOk == 0) {
 | 
						|
    echo "Sorry, your file could not be uploaded.";
 | 
						|
    header('Location: ./uploadfailedr2.php');
 | 
						|
// if everything is ok, try to upload file
 | 
						|
} else if ($uploadOk == 1) {
 | 
						|
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_';
 | 
						|
    $random_string_length = 12;
 | 
						|
    $randomFilename = '';
 | 
						|
    for ($i = 0; $i < $random_string_length; $i++) {
 | 
						|
      $randomFilename .= $characters[rand(0, strlen($characters) - 1)];
 | 
						|
    }
 | 
						|
    //$newfilename = time() . '_' . rand(1000000, 9999999) . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); --prior to v0.6b
 | 
						|
    //$newfilename = time() . '_' . rand(100, 999) . '_' . rand(100000000, 999999999) . '.' . end(explode(".",$_FILES["fileToUpload"]["name"])); --prior to v0.8
 | 
						|
    $newfilename = $randomFilename . '.' . end(explode(".",$_FILES["fileToUpload"]["name"]));
 | 
						|
    $newtarget = $target_dir . $newfilename;
 | 
						|
    //if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
 | 
						|
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $newtarget)) {
 | 
						|
        chmod("$newtarget", 0775); // Set read and write permissions if file
 | 
						|
        //echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
 | 
						|
        //header('Location: http://zxicar.us/imeji/private/' . $newfilename);
 | 
						|
        //echo "The file \"" . basename( $_FILES["fileToUpload"]["name"]) . "\" has been uploaded to <br /> http://zxicar.us/imeji/private/" . $newfilename;
 | 
						|
        $xmessage1 = 'The file "' . basename( $_FILES["fileToUpload"]["name"]) . '" has been uploaded to the following link: (you might wanna copy it)';
 | 
						|
        $xmessage2 = 'https://zxicar.us/imeji/private/' . $newfilename;
 | 
						|
        echo $xmessage1 . "<br />";
 | 
						|
        echo "<a><strong>".$xmessage2."</strong></a>";
 | 
						|
		//echo "<script type='text/javascript'>prompt('$xmessage1','$xmessage2');</script>";
 | 
						|
        //header('Location: ../imeji/' . $newtarget); --changed as of v0.7
 | 
						|
        //header('Location: http://zxicar.us/imeji/'.basename( $_FILES["fileToUpload"]["name"])); --changed as of v0.2
 | 
						|
    } else {
 | 
						|
        echo "Sorry, there was a problem uploading your file.";
 | 
						|
        header('Location: ./uploadfailedr2.php');
 | 
						|
    }
 | 
						|
} else if ($uploadOk == 2) {
 | 
						|
    echo "Authentication code is invalid.";
 | 
						|
    header('Location: ./uploadfailedr1.php');
 | 
						|
}
 | 
						|
?>
 | 
						|
<!DOCTYPE html>
 | 
						|
<html lang="en" class="no-js">
 | 
						|
<head>
 | 
						|
	<link rel="stylesheet" type="text/css" href="styler/normalize.css" />
 | 
						|
	<link rel="stylesheet" type="text/css" href="styler/demo_secret.css" />
 | 
						|
	<link rel="stylesheet" type="text/css" href="styler/component_secret.css" />
 | 
						|
	<link rel="stylesheet" type="text/css" href="styler/additional_secret.css" />
 | 
						|
</head>
 | 
						|
</html>
 |