No longer needed or used - all self contained

This commit is contained in:
alopexc0de 2013-02-09 19:41:40 -05:00
parent 9aaff349a3
commit 8f49e1c3bf
2 changed files with 0 additions and 238 deletions

View File

@ -1,142 +0,0 @@
<?php
$max_file_size="4096";
$file_uploads="1";
$websitename="UnPS-GAMA IMGShare Uploader";
$allow_types=array("jpg","gif","png","bmp","JPEG","JPG","GIF","PNG");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" type="image/ico" href="http://unps-gama.info/favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="http://unps-gama.info/favicon.ico" />
<style type="text/css">
body{
background-image:url('https://si0.twimg.com/profile_background_images/468495900/bg.gif');
font-family: Verdana, Arial, sans-serif;
font-size: 12pt;
color: #000000;
}
.message {
font-family: Verdana, Arial, sans-serif;
font-size: 11pt;
color: #000000;
background-color:#EBEBEB;
}
a:link, a:visited {
text-decoration:none;
color: #999999;
}
a:hover {
text-decoration:none;
color: #999999;
}
.table {
border-collapse:collapse;
border:1px solid #000000;
width:450px;
}
.table_header {
border:1px solid #000000;
background-color:#111111;
font-family: Verdana, Arial, sans-serif;
font-size: 11pt;
font-weight:bold;
color: #FFFFFF;
text-align:center;
padding:2px;
}
.upload_info {
border:1px solid #000000;
background-color:#EBEBEB;
font-family: Verdana, Arial, sans-serif;
font-size: 8pt;
color: #000000;
text-align:center;
padding:4px;
}
.table_body {
border:1px solid #000000;
background-color:#999999;
font-family: Verdana, Arial, sans-serif;
font-size: 10pt;
color: #000000;
padding:2px;
}
.table_footer {
border:1px solid #000000;
background-color:#111111;
text-align:center;
padding:2px;
}
input,select,textarea {
font-family: Verdana, Arial, sans-serif;
font-size: 10pt;
color: #000000;
background-color:#AFAEAE;
border:1px solid #000000;
}
.copyright {
border:0px;
font-family: Verdana, Arial, sans-serif;
font-size: 9pt;
color: #999999;
text-align:right;
}
form {
padding:0px;
margin:0px;
}
</style>
<title><?php echo $websitename; ?></title>
<body>
<div align="center"><a href="http://unps-gama.info/img/"><img src="http://unps-gama.info/upload/Pictures/header.png"></a></div><br />
<form action="upload.php" method="post" enctype="multipart/form-data" name="upload">
<table align="center" class="table">
<tr>
<td class="table_header" colspan="2"><b><?php echo $websitename; ?></b> </td>
</tr>
<tr>
<td colspan="2" class="upload_info">
<b>Allowed Types:</b> <?php echo implode($allow_types, ", "); ?><br />
<b>Max size per file:</b> <?php echo $max_file_size ?>kb.
</td>
</tr>
<?php For($i=0;$i <= $file_uploads-1;$i++) { ?>
<tr>
<td class="table_body" width="20%"><b>Select File:</b> </td>
<td class="table_body" width="80%"><input type="file" name="file" id="file" size="50" /></td>
</tr>
<tr>
<td class="table_body" width="20%"><b>Comment: </b></td>
<td class="table_body" width="80%"><input type="text" name="comment" id="comment" size="50" /></td>
</tr>
<?php } ?>
<tr>
<td colspan="2" align="center" class="table_footer">
<input type="hidden" name="submit" value="true" />
<input type="submit" value=" Upload File(s) " /> &nbsp;
<input type="reset" name="reset" value=" Reset Form " onclick="window.location.reload(true);" />
</td>
</tr>
</table>
</form>
<table class="table" style="border:0px;" align="center">
<tr>
<td><div class="copyright"><a href="index.php">UnPS-GAMA IMGShare</a></div></td>
</tr>
</table>
</body>
</html>

View File

@ -1,96 +0,0 @@
<?php
session_start(); // used later when login system is implemented
require('dbsettings.php'); // database of course
function sanatize($input){
if ($input == null) die("Sanatize() - No Input Provided, Aborting\r\n<br>");
$output = strip_tags($input);
$output = stripslashes($output);
$output = mysql_real_escape_string($output);
$output = strtolower($output);
return $output;
}
function cln_file_name($string) {
$cln_filename_find=array("/\.[^\.]+$/", "/[^\d\w\s-]/", "/\s\s+/", "/[-]+/", "/[_]+/");
$cln_filename_repl=array("", ""," ", "-", "_");
$string=preg_replace($cln_filename_find, $cln_filename_repl, $string);
return trim($string);
}
function get_ext($name) {
$name = substr(strrchr($key, "."), 1);
return $name;
}
$location = 'Pictures'; // set upload location - static directory
$extensions = array('png', 'gif', 'jpg', 'jpeg', 'bmp'); // allowed extensions
echo '
<html>
<link rel="shortcut icon" type="image/ico" href="http://unps-gama.info/favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="http://unps-gama.info/favicon.ico" />
<body background="https://si0.twimg.com/profile_background_images/468495900/bg.gif" text="greem" link="red" vlink="purple">
<div align="center">
<a href="http://unps-gama.info/img/">
<img src="http://unps-gama.info/upload/Pictures/header.png" alt="To UnPS-GAMA" title="To Home" />
</a><br>';
if(!isset($_POST['submit'])) die("You didn't upload anything"); // check if submit has been posted if not then we know no upload is coming
if(!isset($_POST['comment'])){ // check to see if there was a comment, if not print no comment
$comment = "No Comment";
}else{
$comment = $_POST['comment'];
}
if(!isset($_SESSION['myusername'])){ // used later when login system is implemented allow anonymous uploads
$username = 'Anonymous Coward'; // a little joke that stems from /.
}else{
$username = $_SESSION['myusername']; // username is username
}
$name = $_FILES["file"]["name"]; // shorten these array parts to variables
$type = $_FILES["file"]["type"];
$size = ($_FILES["file"]["size"] / 1024); // get size of file in Kb
$time = date("d/j/y - g:i:s a"); // current date - time
$name = cln_file_name($name);
$type = sanatize($type); // people can spoof their mime types to have bad stuff in them - it's a stretch but better safe than sorry
$size = sanatize($size); // just in case the size is not mysql safe clean it anyways
$comment = sanatize($comment); // clean comment as it's user entered data
$size = round($size, 2)." Kb"; // shorten size to #.## instead of longer
$file_ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
if(!in_array($file_ext, $extensions))die("Wrong or no file extension"); // stop the upload if it's wrong
$name = rand().".".$file_ext;
if (($_FILES["file"]["size"] < 400000000)){
if ($_FILES["file"]["error"] > 0){
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}else{
if (file_exists("Pictures/" . $name)){
echo $name." already exists. ";
}else{
if(preg_match('/php/i', $name) || preg_match('/phtml/i', $name) || preg_match('/htaccess/i', $name)){
echo $name." is not allowed, sorry about that...";
}else{
$sql="INSERT INTO $tbl_name (name, location, type, size, time, comment, username) VALUES ('$name', '$location', '$type', '$size', '$time', '$comment', '$username')";
$result=mysql_query($sql);
if($result){
move_uploaded_file($_FILES["file"]["tmp_name"], "Pictures/" . $name);
echo "Stored at: <a href='http://img.unps-gama.info/?img=$name' target='_$name'>". $name."</a>";
}else {
echo "There was a problem trying to upload your file - Could be a database error";
}
}
}
}
}else{
die("File too big!");
}
echo '
</div>
</body>
</html>
';
?>