Initial Commit

This commit is contained in:
Joe Gandy 2016-04-30 01:01:04 +01:00
parent 9b067efd80
commit dafe258965
8 changed files with 192 additions and 0 deletions

21
u/config.php Normal file
View File

@ -0,0 +1,21 @@
<?php
return array(
/* This is a secure key that only you should know, an added layer of security for the image upload */
'secure_key' => 'somerandomlongstringoftextforkey',
/* This is the url your output will be, usually http://www.domain.com/u/, also going to this url will be the gallery page */
'output_url' => 'http://example.com/u/',
/* This is a redirect url if the script is accessed directly */
'redirect_url' => 'http://example.com/',
/* This is a list of IPs that can access the gallery page (Leave empty for universal access) */
'allowed_ips' => array('192.168.0.0', '0.0.0.0'),
/* Page title of the gallery page */
'page_title' => 'My Upload Site',
/* Heading text at the top of the gallery page */
'heading_text' => 'Uploading Site',
);

35
u/css/main.css Normal file
View File

@ -0,0 +1,35 @@
.main_container {
text-align: center;
}
.main_slider {
width:100%;
height:100%;
}
.main_slider div {
width:100%;
}
.main_slider div img{
display:block;
margin: 0 auto;
max-width:100%;
max-height:100%;
}
.slick-arrow{
position:absolute;
top:50%;
z-index:100;
padding:5px;
height:50px;
width:50px;
}
.slick-next{
position:absolute;
top:50%;
right:0;
z-index:100;
}

45
u/gallery.php Normal file
View File

@ -0,0 +1,45 @@
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="https://cdn.datatables.net/1.10.9/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.5.7/slick.css"/>
<link href="css/main.css" rel="stylesheet" type="text/css"/>
<title>Joe - Uploads</title>
</head>
<body>
<?php if($_SERVER['REMOTE_ADDR'] == "5.179.100.252"){?>
<?php
$ignore = Array("index.php", "js", "css", ".", "..", "gallery.php", "img");
$files1 = scandir(".");
?>
<a href="/">Back to homepage</a>
<br>
<div class="main_slider">
<?php foreach($files1 as $file){
if(!in_array($file, $ignore)){?>
<div>
<a href="http://jiy.io/<?php echo($file);?>" target="_blank"><img data-u="image" src="http://jiy.io/<?php echo($file);?>" /></a>
</div>
<?php } }?>
</div>
<?php }?>
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.5.7/slick.min.js"></script>
<script>
$(document).ready(function(){
$('.main_slider').slick({});
$(".slick-prev").text("<<");
$(".slick-next").text(">>");
});
</script>
<script src="js/main.js" type="text/javascript"></script>
</body>
</html>

BIN
u/img/a02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
u/img/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

64
u/index.php Normal file
View File

@ -0,0 +1,64 @@
<?php $config = include('config.php'); ?>
<html>
<head>
<link href="css/main.css" rel="stylesheet" type="text/css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="https://cdn.datatables.net/1.10.9/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css"/>
<title><?php echo $config['page_title'];?></title>
</head>
<body style="overflow:hidden;">
<div class="container main_container">
<h3><b><?php echo $config['heading_text'];?><br></b></h3>
<?php
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$bytes = disk_free_space("/");
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
echo "Free space: ";
echo sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . ' / ';
$bytes = disk_total_space("/");
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
echo sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . '<br />';
?>
<br>
<?php if(empty($config['allowed_ips']) || in_array($_SERVER['REMOTE_ADDR'], $config['allowed_ips'])){?>
<?php
$ignore = Array("index.php", "js", "css", ".", "..", "gallery.php", "img", "upload.php");
$files1 = scandir(".");
?>
<!--<a href="gallery.php">View full gallery</a>-->
<br>
<table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>FileName</th>
<th>Size (Bytes)</th>
<th>Date</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<?php foreach($files1 as $file){
if(!in_array($file, $ignore)){?>
<tr>
<td><a target="_blank" href="http://jiy.io/<?php echo($file);?>"><?php echo($file);?></a></td>
<td><?php echo filesize($file);?></td>
<td><?php echo date ("d M Y H:i", filemtime($file))?></td>
<td><?php echo pathinfo($file, PATHINFO_EXTENSION);?></td>
</tr>
<?php } }?>
</tbody>
</table>
<?php }?>
</div>
<script src="//code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.9/js/dataTables.bootstrap.min.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
</body>
</html>

3
u/js/main.js Normal file
View File

@ -0,0 +1,3 @@
$(document).ready(function() {
$('#example').DataTable();
} );

24
upload.php Normal file
View File

@ -0,0 +1,24 @@
<?php
$config = include('config.php');
$key = $config['secure_key'];
$uploadhost = $config['output_url'];
$redirect = $config['redirect_url'];
if ($_SERVER["REQUEST_URI"] == "/robot.txt") { die("User-agent: *\nDisallow: /"); }
if (isset($_POST['key'])) {
if ($_POST['key'] == $key) {
$target = getcwd() . "/u/" . $_POST['name'] . "." . end(explode(".", $_FILES["d"]["name"]));
if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
echo $uploadhost . end(explode("/u/", $target));
} else {
echo "Sorry, there was a problem uploading your file.";
}
} else {
header('Location: '.$redirect);
}
} else {
header('Location: '.$redirect);
}
?>