How to limit access to a file to certain users

Links for php scripts

Moderators: macek, egami, gesf

Post Reply
Oromian
New php-forum User
New php-forum User
Posts: 38
Joined: Fri Apr 04, 2003 2:44 pm
Location: Canada
Contact:

Post by Oromian » Fri Apr 04, 2003 3:14 pm

Use a database.

Register them and on the download page, insert a query to a database that says they visited or downloaded. If the number limited is reached, then you can have php display an error messege.

That's the least complicated way to do it i think.

MithikoS
New php-forum User
New php-forum User
Posts: 8
Joined: Sun May 11, 2003 7:56 pm
Location: London

Post by MithikoS » Sun May 11, 2003 8:04 pm

use mysql... (Database)

When the user upload the file, write in the db the name of the file and the user...

Now.. if the user want to download this file.. check first the db and then.. give access to the user to download this file

And something else... you can change the showing link.
How.. use md5

when you storage the file in the db... use the md5 fuction (encode)

and do the opposite when you grand the access :)
gl

User avatar
lacroix13
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Aug 22, 2002 1:07 am

i had the same problem

Post by lacroix13 » Fri May 23, 2003 5:19 am

i had the same problem and finaly i solved it.you must use a database or something to keep track of the owner of the file.you can use htaccess to protect the files.php will not interact with htaccess, i mean it will work when working with tose files.
when you upload, upload in the directory protected by htaccess.when you download, use the example in the php manual(chm form) from "header" function.

if you still can't figure it out, i'll give you exactly the scripts :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests