<?php ob_start(); ?><html><head><title>~:: MadBananas ::~</title></head><body><?php include('../main_2007header.php'); ?> <?phpif(isset($_COOKIE['username']) && isset($_COOKIE['sapwad'])){check_user_id($_COOKIE['username'], $_COOKIE['sapwad']);if(!file_exists($_FILES['file']['tmp_name'])){ header("Location: /art/");}else{$uname = $_COOKIE['username'];$uname = mysql_real_escape_string($uname);$um = find_uid($uname);if($level_is != 1){$date_now = date('Y-m-d');$get_number = mysql_query("SELECT * FROM art WHERE author='$um' && date_submitted LIKE '$date_now%'");$count_it = mysql_num_rows($get_number);if($count_it >= 2){echo "It looks like you have already submitted 2 submissions today. Why don't you lay off the submission submitting and wait 'til tomorrow.";include("../main_2007footer.php");exit;}}function timeLeft($author){ $author = mysql_real_escape_string($author); $bn = mysql_query("SELECT * FROM banned_users WHERE username='jokes_$author'"); $qur = mysql_fetch_array($bn); $theTime = $qur['endtime'];$now = time();$timeLeft = $theTime-$now;if($timeLeft > 0){$days = floor($timeLeft/60/60/24);$hours = $timeLeft/60/60%24;$mins = $timeLeft/60%60;$secs = $timeLeft%60;$theText = '<span class="banage">';$theText .= $days . " Days";$theText .= ", " .$hours . " Hours";if($mins != 0){$theText .= ", " .$mins . " Minutes";}if($secs != 0){$theText .= ", " .$secs . " Seconds";}$theText .= '</span>';echo "You are currently banned because you or your submission has done something against the rules. You have $theText left before you are unbanned and are able to upload again. Do not try to get around the ban by create secondary accounts. If we find out you have been getting around this ban, all of your accounts will be deleted. If this spree continues, your IP will be banned from the site.<br><Br><font color=\"#E7BB10\">Reason for Ban: </font> - {$qur['message']} ";include("../main_2007footer.php");exit;}else{$qur = mysql_query("DELETE FROM banned_users WHERE username = 'art_$author'");}} timeLeft($_COOKIE['username']);/////////////////////////////////////////////////////// ICON \\\\\\\\\\\\\\\\\\\\\\\\\if(is_uploaded_file($_FILES['icon']['tmp_name'])){ $maxwidth = 46; // Max width allowed for avatars $maxheight = 46; // Max height allowed for avatars $minwidth = 10; $minheight = 10; $allowed_ext = array('jpg','jpeg','gif','pjpeg'); // Let's make this rather cheat-proof then, shall we? $exp = explode('?', $_FILES['icon']['name']); $exp = explode('.', $exp[0]); $extension = array_pop($exp); if(!in_array($extension, $allowed_ext)) { echo "The file you uploaded can only have the following extensions: ".$allowed_ext; include ('../main_2007footer.php'); exit; } $imginfo = getimagesize($_FILES['icon']['tmp_name']); if($imginfo[0] > $maxwidth || $imginfo[1] > $maxheight) { echo "The icon you uploaded must be no more than ".$maxwidth."x".$maxheight.". Your file was ".$imginfo[0].'x'.$imginfo[1]; include ('../main_2007footer.php'); exit; } if($imginfo[0] < $minwidth || $imginfo[1] < $minheight) { echo 'The icon you uploaded must be no less than '.$minwidth.'x'.$minheight.'. Your file was '.$imginfo[0].'x'.$imginfo[1]; include ('../main_2007footer.php'); exit; }}else{$type = $_POST['type']; $filename4 = 'movie_icon.gif';}//////////////////////////////////////////$uploaddir = $_SERVER['DOCUMENT_ROOT'] . '/art/view'; $allowed_ext = array('jpg','jpeg','gif','pjpeg','png'); $max_size = "2097152"; /// in Bytes$max_height = "2000"; $max_width = "2000"; $this_file = $_FILES['file']['tmp_name'];$name = htmlentities($_POST['name'], ENT_QUOTES);$check = mysql_num_rows(mysql_query("SELECT * FROM art WHERE name = '$name'"));///// Get the extensions allowed (.swf) and put them into effect///// ///// This really isn't needed, but It will be used for other portals like the movie portal and what-not$extension = pathinfo($_FILES['file']['name']);$extension = $extension['extension']; if (in_array($extension, $allow_paths)) { $ok = "1"; }if ($ok == "1") { if($_FILES['file']['size'] > $max_size){ echo "File size is too big! It can only be 2MB. Your's was" . $_FILES['file']['size'] / 1000000 . ""; include ('../main_2007footer.php'); exit; } if ($width && $height){ if($width > $max_width || $height > $max_height){ echo "File height and/or width are too big! Width and Height can only be 2000 pixels. Your file was $width x $height"; include ('../main_2007footer.php'); exit; } } if($check > 0){ echo 'Error! Please name your artwork something else, because "<strong>' . $name . '</strong>" has already been taken. <a href="javascript:history.back();">Go back</a>'; include('../main_2007footer.php'); exit(); } $file_size = $_FILES['file']['size']; $date_today = date('m/d/y');$comment = $_POST['comments'];$comment = htmlentities($comment, ENT_QUOTES);$comment = trim($comment);$description = $_POST['description'];$description = htmlentities($description, ENT_QUOTES);$width = $_POST['width'];$height = $_POST['height'];$credits = $_POST['credits'];$name = mysql_real_escape_string($name);$comment = ($comment);$comment = mysql_real_escape_string($comment);$description = mysql_real_escape_string($description);$credits = mysql_real_escape_string($credits);$uname = $_COOKIE['username'];$get_uid = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username='$uname'"));$author = $get_uid['id'];$name = ($name);$comment = $comment;$description = ($description);$query = "INSERT INTO art (name, author, comment, description, date_submitted, width, height, credits, icon, filesize, date_today) VALUES ('$name', '$author', '$comment', '$description', NOW(), '$width', '$height', '$credits', '$type','$filename4', '$file_size', '$date_today')"; $result = mysql_query($query); $result = mysql_query("SELECT * FROM art WHERE name='$name'"); $row = mysql_fetch_array($result); $id = $row['id']; $id = mysql_real_escape_string($id); $uploaddir = $_SERVER['DOCUMENT_ROOT'] . '/art/view'; $path = $uploaddir; $path .= "/"; $path .= $id; $path .= "_"; $filename = trim($filename); $filename = strtolower(str_replace(' ','_',$_FILES['file']['name'])); $filename = strip_tags($filename); $filename = str_replace("'",'',$filename); $filename = str_replace('"','',$filename); $path .= $filename; move_uploaded_file($_FILES['file']['tmp_name'], $path) or die('Upload failed!'); if(is_uploaded_file($_FILES['icon']['tmp_name'])){ $newid = $_SERVER['DOCUMENT_ROOT']."/art/icon/"; $newid .= $id.'_icon'; $extension1 = pathinfo($_FILES['icon']['name']); $extension1 = $extension1['extension']; $newid .= '.'.$extension1; $filepath = $_SERVER['DOCUMENT_ROOT']."/art/icon/".$id.'_icon.'.$extension1; move_uploaded_file($_FILES['icon']['tmp_name'], $filepath); $extension = pathinfo($_FILES['icon']['name']); $extension = $extension['extension']; $filename4 = $id.'_icon.'.$extension; }/////////////////$id = mysql_real_escape_string($id);$filename = $id.'_'.$filename;$query = "UPDATE art SET filename='$filename', icon='$filename4' WHERE id='$id'";$result = mysql_query($query) or die ('Error3! <b>' . mysql_error() . '</b>');mysql_query("UPDATE users SET money = money+2 WHERE id=$author");mysql_query("UPDATE bank SET valut = vault-2 WHERE id=$author");////////////////////$pg = '/art/'.$id;header("Location: $pg");echo "<center>File uploaded successfully! It can be found <a href=\"/art/$id\">Right Here</a></center>";echo '<br /><br />';}else{echo "Incorrect file extension! You must use either .gif, .jpg, .jpeg, .pjpeg, or .png <br><br>".$extension1;}}}else{ echo 'You need to <a href="/mad/login.php">login</a> first before you can upload content!';}include('../main_2007footer.php');?>