owo-uploader
This commit is contained in:
commit
393255258f
|
@ -0,0 +1,4 @@
|
||||||
|
<a href='../o_submit.php'>Submit a image</a>
|
||||||
|
<h3><br></h3>
|
||||||
|
<a href='../o'>Submitted images</a> -
|
||||||
|
<a href='../ou'>Used images</a>
|
|
@ -0,0 +1,31 @@
|
||||||
|
<style>
|
||||||
|
body, a {
|
||||||
|
color: #AEA;
|
||||||
|
background: #111213;
|
||||||
|
font-family: monospace;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
img[src*="/icons/"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background: #AEA;
|
||||||
|
color: #111213;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>OwO Tower <span id='subim'>please enable javascript</span></h1>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
if (window.location.href.slice(-3) == 'ou/') {
|
||||||
|
document.getElementById('subim').innerHTML = 'used images';
|
||||||
|
} else {
|
||||||
|
document.getElementById('subim').innerHTML = 'submitted images';
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
HeaderName ../header.html
|
||||||
|
ReadmeName ../footer.html
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<div class="list-group-item"><form action="u.php" method="post" enctype="multipart/form-data">
|
||||||
|
Select image to upload:
|
||||||
|
<input type="file" name="file" id="file" class="btn btn-upload"><input type="submit" class="btn btn-primary" value="Upload Image" name="submit">
|
||||||
|
</form>
|
|
@ -0,0 +1,2 @@
|
||||||
|
HeaderName ../header.html
|
||||||
|
ReadmeName ../footer.html
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
$target_dir = "o/";
|
||||||
|
$target_file = $target_dir . basename($_FILES["file"]["name"]);
|
||||||
|
$uploadOk = 1;
|
||||||
|
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||||
|
$target_file = $target_dir . substr(md5_file($_FILES['file']['tmp_name']), 1, 6) . "." . $imageFileType;
|
||||||
|
// Check if image file is a actual image or fake image
|
||||||
|
if(isset($_POST["submit"])) {
|
||||||
|
$check = getimagesize($_FILES["file"]["tmp_name"]);
|
||||||
|
if($check !== false) {
|
||||||
|
$uploadOk = 1;
|
||||||
|
} else {
|
||||||
|
echo "File appears to be missing";
|
||||||
|
$uploadOk = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check if file already exists
|
||||||
|
if (file_exists($target_file)) {
|
||||||
|
echo "Whoops! someone already uploaded that, " . $target_file;
|
||||||
|
$uploadOk = 0;
|
||||||
|
}
|
||||||
|
// Check file size
|
||||||
|
if ($_FILES["file"]["size"] > 6000000) {
|
||||||
|
echo "Sorry, your file is too large. (maximum size allowed 6mb)";
|
||||||
|
$uploadOk = 0;
|
||||||
|
}
|
||||||
|
// Allow certain file formats
|
||||||
|
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
|
||||||
|
&& $imageFileType != "gif"
|
||||||
|
&& $imageFileType != "ico"
|
||||||
|
&& $imageFileType != "tif"
|
||||||
|
&& $imageFileType != "tiff" ) {
|
||||||
|
echo "Sorry, only image files are allowed.";
|
||||||
|
$uploadOk = 0;
|
||||||
|
}
|
||||||
|
// Check if $uploadOk is set to 0 by an error
|
||||||
|
if ($uploadOk == 0) {
|
||||||
|
echo "Sorry, your file was not uploaded for an unknown reason.";
|
||||||
|
// if everything is ok, try to upload file
|
||||||
|
} else {
|
||||||
|
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
|
||||||
|
echo "http://" . $_SERVER['HTTP_HOST'] . "/" . $target_file;
|
||||||
|
} else {
|
||||||
|
echo "Sorry, there was an error uploading your file.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
Loading…
Reference in New Issue