473,372 Members | 904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Protected File Downloads

Hi.

I'm looking for a way to allow users to download files, but what files
they see and can download need to be restricted to their username..

I will have a couple of users who will have full access, the others
need to see only the files I have allocated to them.

Can this be done ?

Any scripts available to do this ?

Thanks

May 30 '06 #1
2 1444
je***********@yahoo.com wrote:
Hi.

Hi,
I'm looking for a way to allow users to download files, but what files
they see and can download need to be restricted to their username..
If their username is a unix username (real user) than .htaccess could be of
use.
If the users are unrelated (eg Database-stored) to systemusers, you'll have
to use PHP to deliver the file.


I will have a couple of users who will have full access, the others
need to see only the files I have allocated to them.

Can this be done ?

Yes.

Just place the files in a directory where nobody can access them directly
via a http-request.
Let PHP, once you agreed that the user should be ok, read the file and give
it to the user.
So the PHP-user (on *nix often: apache, or nobody, or www-data) should of
course have read-right on all the files for this to work.
Any scripts available to do this ?
No idea. Quite basic stuff.
You can roll your own.
Have a look at www.php.net, and look for fopen() and the other
filefunctions.


Thanks


Good luck.

Regards,
Erwin Moller
May 30 '06 #2
Erwin Moller wrote:
je***********@yahoo.com wrote:

Hi.
Hi,

I'm looking for a way to allow users to download files, but what files
they see and can download need to be restricted to their username..

If their username is a unix username (real user) than .htaccess could be of
use.
If the users are unrelated (eg Database-stored) to systemusers, you'll have
to use PHP to deliver the file.


You don't have to be a unix username to be available in .htaccess. mod_auth
will handle non-unix names also. For a few files and a few users, this would be
pretty easy. But as the number of files and users increases, it can become more
difficult to administer.

How to set this up would be better asked in alt.apache.configuration.

I will have a couple of users who will have full access, the others
need to see only the files I have allocated to them.

Can this be done ?
Yes.

Just place the files in a directory where nobody can access them directly
via a http-request.
Let PHP, once you agreed that the user should be ok, read the file and give
it to the user.
So the PHP-user (on *nix often: apache, or nobody, or www-data) should of
course have read-right on all the files for this to work.


Yep, either place it before the website root directory or protect the directory
with .htaccess.

If it's going to be a lot of files with a lot of users, I would recommend
managing access in a database. By this I don't mean to use the database itself
to manage the security; rather use it in your PHP code to identify who can
access what).
Any scripts available to do this ?

No idea. Quite basic stuff.
You can roll your own.
Have a look at www.php.net, and look for fopen() and the other
filefunctions.


I agree. This is something that's just faster to write yourself than 1) Search
the internet, 2) Determine which is closest to your needs, 3) Understand the
code so that you can 4) Modify it to meet your exact needs.

Thanks

Good luck.

Regards,
Erwin Moller

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
10
by: StevePBurgess | last post by:
I would like to make my downloads section unbrowsable (to users) but accessible to scripts. Can I deliver a file to a browser without linking to it's URL so that I can deliver files...
3
by: Matthew Moran | last post by:
I am creating a series of downloadable articles, career tools, spreadsheets, etc. However, some of the content is for "registered" guest. The registrants are stored in a database and logon. I...
2
by: Rickard | last post by:
OK. I have the need on a form submit to pass the data to anther system that require a login and password only I want to automate the process in an server side asp file and then process the...
1
by: Jeff Cooper | last post by:
Hey there folks, I have a link on a page which I would like to point to string that's downloaded as a file -- a *.tab file to be exact. The link points to a file (download.aspx) which contains...
10
by: Atley | last post by:
I am trying to make sure that an MDB is not in use and then delete it. If it is in use, I want to automatically disconnect all the users and then delete the file. Any suggestions are welcome.
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
21
nathj
by: nathj | last post by:
Hi, I am currently working on a new site that offers various files for download. The file information is stored in a MySQL database and the page is produced in PHP depending on how the user got...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.