hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : PHP exceeding site quota
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

PHP exceeding site quota

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-07-2002, 10:52 PM
jaschwa jaschwa is offline
Junior Guru Wannabe
 
Join Date: Jan 2001
Location: Jacksonville, FL
Posts: 50

PHP exceeding site quota


I have a customer that allows visitors to contribute text files to his site. The problem is that the PHP program he uses adds the file even if the site's quota has been exceeded. The fragment of code in use is:

if($filename = fopen("./unapproved/$filename", "w")) {
fputs($filename, $filebody);
fclose($filename);
}

First, is there a way I can have him modify this so that it operates within the limitations of the quota system?

Second, is there a way to compress/decompress the files on the fly?

Thanks

__________________
Jeff Schwandt (jaschwa@realm-net.com)
Realm-Net Hosting (www.realm-net.com)
"Affordable web sites for you and your business."

Reply With Quote


Sponsored Links
  #2  
Old 09-08-2002, 01:05 AM
mind21_98 mind21_98 is offline
Web Hosting Master
 
Join Date: Dec 2000
Location: San Diego, CA
Posts: 1,571
Unfortunately, PHP runs as 'nobody', so unless Apache 2.0 becomes more widely used, that will be a limitation you will have to live with.

__________________
-Mooneer
Thoughtbug Software: Hosting shouldn't require any thought.
Legitimate host? Support the Code of Ethical Conduct

Reply With Quote
  #3  
Old 09-09-2002, 11:24 AM
OldOne OldOne is offline
WHT Addict
 
Join Date: Sep 2002
Posts: 167
I am afraid, you will not be able to put limitations in his code.

Reply With Quote
Sponsored Links
  #4  
Old 09-09-2002, 01:22 PM
CChard CChard is offline
WHT Addict
 
Join Date: Mar 2002
Posts: 123
You can always ask him not to use it, and suggest a new one.

__________________
www.atlanticrail.com

Reply With Quote
  #5  
Old 09-11-2002, 10:38 AM
jaschwa jaschwa is offline
Junior Guru Wannabe
 
Join Date: Jan 2001
Location: Jacksonville, FL
Posts: 50
What about using Zlib? According to http://www.php.net/manual/en/ref.zlib.php, it sounds like he could still use fopen function with the special prefix 'zlib://' to open the file and it would be gzipped on the fly.

__________________
Jeff Schwandt (jaschwa@realm-net.com)
Realm-Net Hosting (www.realm-net.com)
"Affordable web sites for you and your business."

Reply With Quote
  #6  
Old 09-11-2002, 01:50 PM
Alturus Alturus is offline
Newbie
 
Join Date: Aug 2002
Location: Canada
Posts: 22
Why not read the files in the directory, add up the sizes of the files, and if it's over a certain number, say 10 megs, it won't let you add it.

I use a similar scheme at http://supratest.ue3.net

When a user submits a photo, the size/name/etc gets recorded in the DB. A cumulative total of file sizes is kept and if they exceed 10 megs, then they get a message stating they're over their quota when they try and upload another file.

% of quota used is also displayed in their user-control section.

As I said, another non-DB way of doing this would be to read a directory, load the file sizes in an array, and add them up. If you do this as a 'check' before uploading the file, then depending on the size, they'll either be allowed to upload it, or denied.


Last edited by Alturus; 09-11-2002 at 01:55 PM.
Reply With Quote
  #7  
Old 09-14-2002, 03:25 PM
Chr1s Chr1s is offline
Junior Guru Wannabe
 
Join Date: Sep 2002
Location: Canada
Posts: 35
he could also just make store them inside mysql it wouldnt eat up all his hard drive space

Reply With Quote
  #8  
Old 09-15-2002, 08:21 PM
jaschwa jaschwa is offline
Junior Guru Wannabe
 
Join Date: Jan 2001
Location: Jacksonville, FL
Posts: 50
Thanks for the suggestions. I don't know who build the program he's using, but it doesn't keep track of file sizes.

I run a du command on his site and also checked his files in the other locations on the RaQ, and they total less than 50MB. Either the RaQ4 has problems adding or it uses an inefficient cluster size since most of the files are 1K or less. Keeping the textual data in the database would also prevent this type of inefficient disk space usage. Does mySQL have a string datatype capable of fields greater than 255?

__________________
Jeff Schwandt (jaschwa@realm-net.com)
Realm-Net Hosting (www.realm-net.com)
"Affordable web sites for you and your business."

Reply With Quote
  #9  
Old 09-15-2002, 09:40 PM
Chr1s Chr1s is offline
Junior Guru Wannabe
 
Join Date: Sep 2002
Location: Canada
Posts: 35
TEXT can hold a huge amount.. more than 255 chars..

__________________
EZScripts - Quality PHP Scripts, Low Price (includes Custom Scripting on request.)
http://www.EZScripts.net/

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Google Offers 15GB of Free Storage Across Cloud Services Web Hosting News 2013-05-13 15:00:03
Velocity Technology Solutions Acquires UK Web Host velos-IT Web Hosting News 2013-03-27 15:52:22
State of Oklahoma Drops Bribery Charges Against Windstream Communications Web Hosting News 2012-12-20 11:07:43
Web Hosting Talk Message Board Back Online Following DDoS Attack Web Hosting News 2012-09-12 11:59:42
Federal Government Increases Data Center Closures by More Than 200 Web Hosting News 2012-01-05 16:07:00


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?