<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
<title>UploadSet</title>
</head>
<body>
<table width="516" border="0" cellspacing="1" bgcolor="#333333">
<tr>
<td width="510" valign="top" bgcolor="#79715C"><img src="images/Banner1.jpg" width="510" height="100"></td>
</tr>
<tr>
<td align="center" bgcolor="#79715C"><div class="articletitle">:: Roman Empire File Uploading Service ::</div></td>
</tr>
<tr>
<td align="center" bgcolor="#79715C"> <?php
if(isset($HTTP_SESSION_VARS['username']) == $roman_user && isset($HTTP_SESSION_VARS['password']) == $roman_pass) { ?>
<table width="510" border="0" cellpadding="5" cellspacing="1" bgcolor="#000000">
<tr>
<td align="center" bgcolor="#000000"><strong>File Upload</strong><br>
<br>
<table width="90%" border="0" cellspacing="1">
<tr>
<td><span class="style2">Please review these rules before you upload your file.</span><br>
• Maximum File Size is 1 MB.<br>
• No media files.<br>
• No uploads that are just being used as image hosts for other websites.<br>
• Relevant files.<br>
• All files other than .gif, .jpg, .jpeg, or .png must be put inside a .zip file.<br>
• Please <a href="index.php?module=contact">contact</a> the webmaster for requests or suggestions for this area.</td>
</tr>
</table>
<br>
<form enctype="multipart/form-data" action="index.php?module=fileupload" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
<input name="userfile" type="file" class="uploadform">
<br>
<input name="upload" type="submit" class="formbutton" id="upload" value="Upload">
</form>
<?php
// if you need to put this back into action... // <?=$_SERVER['PHP_SELF'] and the the ? with the > :)
$upload_dir = 'userfiles/';
//SEPERATE THE EXTENTIONS WITH A "",. I.E: "GIF", "JPG", "BMP"....and so on
$allowed_extentions = array("gif", "jpg", "png", "jpeg", "zip");
//Check to make sure a file was selected.
//If selected - continue
if(!isset($_FILES['userfile'])) {
echo 'Please select the file you would like to upload. ';
} else {
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
//change image name to all lower case
$imgname = strtolower($_FILES['userfile']['name']);
/* This is the checking part, weather the extension of the file is
what is allwoed to be uploaded */
$full_path = $upload_dir . $imgname;
$extension = array_pop(explode(".", $full_path));
if (in_array($extension, $allowed_extentions) && $_FILES['userfile']['size'] <= 1048576) {
//remove all spaces from image name
$imgname = str_replace(" ","",$imgname);
//check to see if file already exists
//If not - copy file and continue. Otherwise error out
if (!file_exists($upload_dir . $imgname) && is_dir($upload_dir)) {
copy($_FILES['userfile']['tmp_name'],$upload_dir . $imgname);
echo 'Successfully uploaded your file.<br>
The location (URL) of the file should be,
with all lowercase letters,
and all spaces taken out,<br>
<a href="http://www.jhanson90.vzz.net/romanempire/userfiles/';echo $imgname;echo '">http://www.jhanson90.vzz.net/romanempire/userfiles/'.$imgname;echo '</a>';
} else {
echo 'Unable to upload your file, sorry.';
exit;
}
} else {
echo 'Sorry, you attempted to upload a file that is not allowed to be uploaded on this server.<br>';
echo "The maximum file size is 1 MegaByte (MB) or 1048576 KiloBytes (KB).<br>";
echo 'You may only upload files with these extensions:<br>';
$number_total = count($allowed_extentions);
for($i = 0; $i < $number_total; $i++)
{
echo $allowed_extentions[$i] . '<br>';
}
echo 'Please try again.';
}
}
}
?></td>
</tr>
</table>
<?php } else { ?>
<table width="510" border="0" cellpadding="5" cellspacing="1" bgcolor="#000000">
<tr>
<td align="center" bgcolor="#000000"><strong>Sorry.</strong><br>
<br>
You are not allowed to access this file.<br>
<br>
<a href="index.php?module=login">« Please Login </a> </td>
</tr>
</table>
<?php } ?></td>
</tr>
</table>
</body>
</html> |