Jump to content

File Overload


The Little Guy

Recommended Posts

You can't "take the load off"

what you have built to process will process it is that simple.

Solution?

Build better scripts.  Add more logic, scripts bog down the most on queries, and handling files the way around this is to simply write better queries and file handlers, don't use the * operator on a query, and limiting file sizes are two of the easiest ways to do it.

Link to comment
Share on other sites

The file:

<?php 
include'db.php';
session_start();
if(isset($_POST['login'])){
if(isset($_COOKIE['userName'])){
	$user = $_COOKIE['userName'];
}
if(isset($_POST['user'])){
	$user = $_POST['user'];
}
$sql = mysql_query("SELECT * FROM users WHERE user='".addslashes($user)."' AND pass='".base64_encode($_POST['pass'])."'")or die(mysql_error());
if(mysql_num_rows($sql) > 0){
	$row = mysql_fetch_array($sql);
	if($row['active'] == 'inactive'){
		$_SESSION['id'] = $row['id'];
		header('Location: process/getEmail.php');
		exit;
	}else{
		setcookie("userName", $row['user'], time()+60*60*24*3);
		$_SESSION['user'] = $row['user'];
		$_SESSION['first'] = $row['fname'];
		$_SESSION['last'] = $row['lname'];
		$_SESSION['id'] = $row['id'];
		$_SESSION['email'] = $row['email'];
		$_SESSION['sort_by'] = $row['sort_by'];
		$_SESSION['fpp'] = $row['files_per_page'];
		$_SESSION['group'] = $row['group'];
		$_SESSION['logged'] = TRUE;
		$date = date("Y-m-d H:i:s");
		$ip = $_SERVER['REMOTE_ADDR'];
		mysql_query("UPDATE users SET ip = '$ip', lastLog = '$date' WHERE id = '{$_SESSION['id']}'");
		header("Location: user.php");
		exit;
	}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TzFiles - Free Ultimate File Hosting</title>
<link rel="stylesheet" href="/design2/style2.css" />
<link rel="shortcut icon" href="/favicon.ico" />
<script type="text/javascript">
function uploading(){
document.getElementById('submit').value = 'Uploading...';
document.getElementById('submit').disabled = true;
}
function notUser(){
document.getElementById('notUser').innerHTML = '<input type="text" name="user" size="10" />';
}
var setintID;
function starttimer(){
setintID = setInterval('gettime()' , 1000);
}
function gettime(){
var ajaxRequest;
try{
	ajaxRequest = new XMLHttpRequest();
} catch (e){
	try{
		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try{
			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e){
			alert("Your Browser Doesn't support AJAX.");
			return false;
		}
	}
}
ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 4){
		document.getElementById('showSpace').innerHTML = ajaxRequest.responseText;
	}
}
ajaxRequest.open("GET", 'process/gTime.php', true);
ajaxRequest.send(null);
}
</script>
</head>
<body onload="starttimer();">
<div class="container">
	<div class="logo">
		<img align="left" src="/images/logo.gif" />
	</div>
	<div class="login">
		<?php if($_SESSION['logged']){
			echo '<h2>Welcome '.ucwords($_SESSION['first']).'!</h2>';
		}else{
		?>
			<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
				<?php
					if(isset($_COOKIE['userName'])){
						echo 'User Name: <span id="notUser"><a href="javascript:notUser();">'.$_COOKIE['userName'].'</a></span>';
					}else{
						echo 'User Name: <input type="text" name="user" size="10" />';
					}
				?>
				    
				Password: <input type="password" name="pass" size="10" />
				<input name="login" value="Sign In" type="submit" />
			</form>
		<?php } ?>
	</div>
	<div class="clear"> </div>
	<div class="bar">Now get <?php echo $total_space; ?>'s worth of file space! </div>
	<?php include 'nav.php'; ?>
	<div class="bar3"><span id="showSpace"></span> megabytes of free storage!</div>
	<div>
		<h3>About</h3>
		Online file storage is hard to come by with loads of space, but that has changed. We offer a whopping
		<?php echo $total_space; ?>'s of file storage for you to use how ever you want. You can modify many
		different aspects of your files, and new features are being added all the time. Not only can you store
		files, you can also share, and download files (Please read the <a href="tos.php">TOS</a>).
	</div>
	<div class="guestUploads">
		<h3>Latest Guest Images</h3>
		<?php
			$sql = mysql_query("SELECT * FROM guest_images ORDER BY id DESC LIMIT 3");
			echo'<table><tr>';
			while($row = mysql_fetch_array($sql)){
				echo '<td>
				<a href="guestImages/guestImage.php?imageID='.$row['id'].'">
					<img src="/'.$row['directory'].'/thumbs/'.$row['file'].'" />
				</a>
				</td>';
			}
			echo'</tr></table>';
		?>
		<div class="vSpaceHome"> </div>
		<div class="bar">Search Guest Images</div>
		<div class="newsContent">
			<form action="guestImages/search.php" method="get">
			<input type="text" size="30" name="q" />
			<input type="submit" name="submit" value="Search" />
			</form>
		</div>
		<div class="vSpaceHome"> </div>
		<div class="bar">Add your own images!</div>
		<div class="newsContent">
			<form action="guestImages/guestLoad.php" method="post" enctype="multipart/form-data">
			<p>File 1: <input name="file[]" type="file"></p>
			<p>File 2: <input name="file[]" type="file"></p>
			<p>Please be aware these image will be visible to anyone.</p>
			<input id="submit" onclick="uploading();" type="submit" name="submit" value="Upload Now!" />
			</form>
		</div>
	</div>  
	<div class="spaceHome"> </div>
	<div class="rightHome">
		<h3>News</h3>
		<?php
		$date = date("Y/m/d H:i:s");
		$sql = mysql_query("SELECT * FROM announcements WHERE date <= '$date' ORDER BY date DESC LIMIT 3")or die(mysql_error());
		while($row = mysql_fetch_array($sql)){
			$val = explode(' ',$row['date']);
			list($year, $month, $day) = explode('-',$val[0]);
			echo '<div class="bar">'.$month.'/'.$day.'/'.$year.'</div>';
			echo '<div class="newsContent"><strong>'.$row['title'].'</strong><br />'.$row['content'].'</div>';
			echo '<div class="vSpaceHome"> </div>';
		}
		?>
		<a href="allNews.php">Show All Announcements</a>
	</div>
	<div class="clear"> </div>
</div>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.