rendered paste body<?
error_reporting(E_ALL);
$page = '::Monostorm.com:: Upload';
require_once('require.php');
if ( !isset( $_SESSION['username']) ) {
$error = 'You Are NOT Logged In, In Order To Upload You Must Be, Log In <a href="login.php">Here</a>';
$disabled = '1';
}
if ( isset($_SESSION['username'])) {
$result = mysql_query("SELECT * from user where username='$_SESSION[username]'") or die(mysql_error());
$row = mysql_fetch_array( $result );
if ( $row['access'] == '1') {
$error = 'Click <a href="activate.php">Here</a> To Enable Your Ability To Upload';
$disabled = '1';
}
// Set basic upload Options
$max = '10485760';
$extensions = array( 'jpg','png','gif','doc','txt','pdf');
if ( isset( $_POST['submit'])) {
$file_name = $_FILES['userfile']['name'];
$file_ext = explode( '.' , $file_name );
$file_ext = $file_ext[1];
if ( $_FILES['userfile']['size'] > $max) { die('File Is Too Big'); }
if (!in_array($file_ext, $extensions)) { $error = "Sorry, That File Type Is Not Aloud"; }
if ( $_FILES['userfile']['name'] == "") { $error = "Invalid File Name Specified"; }
if (!isset($error)) {
$d = $_SESSION['username'];
$e = $_FILES['userfile']['name'];
$d = "upload/$d/$e" ;
$filename = $_FILES['userfile']['tmp_name'];
if ( move_uploaded_file( $filename, $d) ) { echo "$e was successfully uploaded.\n"; }
}
else {
$error = "$error ( $_FILES[userfile][error] )";
}
}
}
// End of
?>
<!-- Page Content -->
<div class="content">
<? if (isset($error)) { echo "$error <br><br>"; }
?>
<form method="POST" enctype="multipart/form-data" >
Upload File:
<input type="file" name="userfile" <? if (isset($disabled)) { echo "disabled='$disabled'"; } ?>><br><br>
<input type="submit" value="Upload!" name="submit" <? if (isset($disabled)) { echo "disabled='$disabled'"; } ?> ></form>
<br>
<? $filelist = "";
if ( isset($_SESSION['username'])) { if ( $row['access'] >= '2') {
?>
<hr width=70%>
My Files:
<?
if ( $filelist != "" ) { echo "<br> $filelist"; }
else { echo "<a href=/upload/$_SESSION[username] >Click here to view your files</a>"; }
?>
<hr width=70%>
Allowed File Formats Are: .Jpg, .png, .gif, .doc, .txt., .pdf With a Max File Size Of 10 mb <br /> For Additonal Formats Contact Me Or Post On Forum
<? } }?>
</div>
<!-- End Of Content -->
<? require_once('require2.php');?>