1
Fork 0

removed the old one, and rewrote auto to be self contained and much more lightweight

This commit is contained in:
Jake Howard 2015-06-28 16:51:53 +01:00
parent 2a578b1ac0
commit a18f1bba61
2 changed files with 48 additions and 22 deletions

View file

@ -1,22 +0,0 @@
<?php
require "property-manager.php"; // Initialise properties
require "file-information.php";
$properties = load_properties();
$file_name = $_GET[$properties["file QS"]] or die("No querystring given.");
if (file_exists($file_name)) {$GLOBALS["file"] = generate_file_object($file_name);}
else {die("File '$file_name' does not exist!");}
header("Content Type: text/html");
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $properties["auto title"] . " for " . $file["name"];?></title>
<link rel=stylesheet type=text/css href="style.css"/>
<?php yandex_meta($properties["yandex transparency"]) ?></head>
<body><center>
<h1>File Auto Downloader</h1><p>The file you requested will begin to download automatically. If it doesnt, click the link below.</p>
<?php echo "<a id='downloadButton' href='./downloads/" . $file["file name"] . "' download='" . $file["file name"] . "'>Click here to download file</a>";?>
</center><script>document.getElementById('downloadButton').click();</script>
</body>
</html>

48
auto-downloader.php Normal file
View file

@ -0,0 +1,48 @@
<?php
$QS = $_SERVER["QUERY_STRING"];
$QSEscaped = htmlentities($QS);
header("content-type: text/html");
?>
<html><head><title>Auto Download Manager Lite</title><style>
footer {
position: absolute;
bottom:0;
width:100%;
text-align:center;
font-size: large;
}
#downloadLink {
background-color: black;
color: white;
}
body {
text-align: center;
margin: 0;
padding-top: 75px;
}
p {
padding: 5px;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head><body>
<?php if (!file_exists($QS) and strlen($QS) >= 1) { ?>
<h1>404 - File does not exist</h1>
<p>The file you requested for download does not exist. Please check the URL and try again.</p>
<?php echo "<p>Requested File: {$QSEscaped}</p>"; ?>
<?php } elseif (strlen($QS) >= 1) { ?>
<h1>Downloading File: <?php echo $QSEscaped; ?></h1>
<p>Your file will be automitically downloaded in a second, if it doesnt for some reason, click the link below to manually download it.</p>
<?php echo "<a class='btn btn-default' id='downloadLink' href='{$QSEscaped}' download='{$QSEscaped}'>Click here to manually download file</a>"?>
<script>//document.getElementById("downloadLink").click();</script>
<?php } else { ?>
<h1>Querystring Error</h1>
<p>There is an error with the provided querystring <?php echo $QSEscaped; ?>. Please try again.</p>
<?php } ?>
<footer>Auto Download Manager Lite powered by <a href="//theorangeone.net">TheOrangeOne</a></footer>
</body></html>