Programming Theory
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesProgramming Theory

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old August 5th, 2005, 06:00 PM
phpee phpee is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 phpee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
files for individual users

I am going to be starting a project for my boss. What he wants is an area on the company website that clients can go and download there reports. I was thinking that the best way to do this, since every clients information is confidential, would be to create a user authentication system based on a mysql table holding their usernames and passwords. In addition to that I would create many other tables, one table for each company and their reports. Thus having a one to many relationship. I do not know if I should md5() the passwords? Or if the one to many relationship is a good idea? Moreover the files would be in PDF format and would have to either be stored in the tables or as i have heard it is possible, to put them in a directory which is password protected and link to them from the tables in the database, but i do not know what that means. I could really use some advice from the Gurus out there.

Thanks.

Reply With Quote
  #2  
Old August 5th, 2005, 06:43 PM
phpee phpee is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 phpee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: files for individual users

bump

Reply With Quote
  #3  
Old August 8th, 2005, 08:15 AM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,729 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 1 h 32 m 7 sec
Reputation Power: 6
RE: files for individual users

Quote:
I do not know if I should md5() the passwords?
- Yes, or any other means of encryption.

As for the one to many DB design - I would really have to see the whole DB design to give an opinion.

Something to also keep in mind - PHP can generate pdf files dynamically fro the reports.

Reference:
http://www.php.net/manual/en/ref.pdf.php

Reply With Quote
  #4  
Old August 11th, 2005, 10:14 AM
ShogunWarrior ShogunWarrior is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Dublin,Ireland
Posts: 63 ShogunWarrior User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m
Reputation Power: 2
RE: files for individual users

Definitely use md5() or sha1().

Encryption is good, but one-way message digest is better. (md5/sha1)

I wouldn't use a table for each client, surely you can just use one table called "users" with fields like:
"user_id,client_id,user_name,date_added,email,etc.. ."
Then you have a table called clients like:
"client_id,date_added,client_name,job_specs,main_em ail,etc.."
And a table for all the files:
"file_id,client_id,file_name"

Then, to display all the files for a client you can use something like:
php Code:
Original - php Code
  1.  
  2. $client_id=$_SESSION['client_id'];
  3. $SQL="SELECT * FROM files WHERE client_id='$client_id'";


The best way to allow users to download files is either to stream the files out from a PHP file. That way the URL of the file will read something like "download.php" instead of "files/reports/report2.pdf", that way people won't know where the file is located.

But of course that isn't enough just to hide a file.
I think (but haven't tested) putting a .htaccess file in the files folder and in it only allowing access to the files from the local address.
Something like:
Deny:all
Allow:127.0.0.1


That probably isn't valid because I haven't used many .htaccess files.

So, in theory because your "download.php" file will be reading the file from the server and streaming it to the user, I think that the .htaccess will allow it, but will stop users accessing it directly.

Hope that helps, and hope it works. If you need the download streaming page then you can e-mail me. DavidDoranMedia[AT]gmail.com

-SW

Reply With Quote
  #5  
Old August 13th, 2005, 08:35 PM
phpee phpee is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 phpee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: files for individual users

Hey thanks a lot man, that is a great explanation. As to help with streaming the files, i will try and get back to you if i get stuck.
Cheers

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > files for individual users


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT