The Little Guy Posted November 25, 2007 Share Posted November 25, 2007 Sometimes servers get overloaded with users, and stop responding. Can this happen with files? If so, how can I take a load off some files? Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/ Share on other sites More sharing options...
cooldude832 Posted November 25, 2007 Share Posted November 25, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/#findComment-398578 Share on other sites More sharing options...
The Little Guy Posted November 25, 2007 Author Share Posted November 25, 2007 this is in the file that I think is getting bogged down: <?php header('Content-type: image/jpeg'); if(!file_exists($_GET['filename'])) readfile("imageNotFound.jpg"); else readfile($_GET['filename']); ?> Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/#findComment-398580 Share on other sites More sharing options...
cooldude832 Posted November 25, 2007 Share Posted November 25, 2007 find a script that detects script times, there are a lot out there, and just log the time that certain portions take, and figure it out deffinetly. Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/#findComment-398581 Share on other sites More sharing options...
The Little Guy Posted November 25, 2007 Author Share Posted November 25, 2007 OK... Hmmm.... I ran the index page, and the whole source loads, but the page only shows the header of the page.?? http://tzfiles.com/ Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/#findComment-398582 Share on other sites More sharing options...
cooldude832 Posted November 25, 2007 Share Posted November 25, 2007 could it be your ajaxs, I don't know yuor php, but you are right a specific line is hanging up Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/#findComment-398583 Share on other sites More sharing options...
The Little Guy Posted November 25, 2007 Author Share Posted November 25, 2007 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> Quote Link to comment https://forums.phpfreaks.com/topic/78758-file-overload/#findComment-398588 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.