Created
January 27, 2016 04:02
-
-
Save joshtwo/a3658adeb3fb97f2f17a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>File Upload</title> | |
</head> | |
<style> | |
/* I have no creative ideas for how to style this */ | |
body { | |
text-align: center; | |
} | |
input[type=text] { | |
width: 40%; | |
} | |
</style> | |
<body> | |
<h1>File Upload</h1> | |
<?php | |
if ($_POST['submit']) | |
{ | |
// I don't care how big the file is, what type is it, anything | |
// I just want that bastard in the right directory | |
if ($_POST['password'] != "********") | |
echo "Faggot, that is not the fucking password. Who ARE you?"; | |
else { | |
//echo "Here's a little friendly debug info: <code>" . print_r($_FILES, true) . "</code><br>"; | |
$fileName = $_FILES['upload']['name']; | |
if ($_FILES['upload']['size'] == 0) | |
echo "You didn't upload shit, partner."; | |
else if ($_FILES['upload']['error'] == UPLOAD_ERR_INI_SIZE) | |
echo "The fucker's too big, champ. Stop trying to deep dick my server's hard drive. Keep it under " . ini_get('upload_max_filesize') ."."; | |
else if ($_FILES['upload']['error'] == UPLOAD_ERR_CANT_WRITE) | |
echo "I couldn't even write the little niggie to the hard drive. Better tell Josh to fix some permissions."; | |
else if ($_FILES['upload']['error'] != 0) | |
echo "Shit went wrong. Don't ask me why. It just did."; | |
else { | |
// time to make magic happen | |
$fileName = preg_replace('/.php$/', '.php.txt', $fileName); // mo being a nigger | |
move_uploaded_file($_FILES['upload']['tmp_name'], './uploads/'. $fileName); | |
chmod($_FILES['upload']['name'], 0444); | |
echo 'Hold onto this url: <input onclick="this.select()" type="text" value="http://joshtwo.me/uploads/'. $fileName . '"><br>'; | |
echo 'If your ass would like to upload another, click <a href="upload-file.php">here</a>.'; | |
} | |
} | |
} | |
else | |
{ | |
?> | |
<p>So you wanna upload something, eh? Okay, take a gander at this bastard right down here for me. | |
<form enctype="multipart/form-data" action="upload-file.php" method="POST"> | |
<label>File: <input type="file" name="upload"></label><br> | |
<label>Password: <input type="password" name="password"></label><br> | |
<input type="submit" name="submit"> | |
</form> | |
<?php | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment