Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Authentification

Status
Not open for further replies.

SirGalaahad

Programmer
Apr 9, 2001
3
DE
Hello!

We have a server with a lot of pdf-files. We want that the users authentificate before downloading files. Until now we lock our directories with php and the webserver apache : .htaccess, .htpasswd... After sign_up with php the php script appends the Username and Password at the .htpasswd file.
But this has some disadvantages (for example the login window cant be formatted and so on). And we have a coldfusion server license now, too.

We want now s.th. like the following:

1. User log on (coldfusion and database)
2. User clicks on link to download protected pdf-file
3. cfm-script sends Username and Password to apache webserver which uses .htpasswd to authentificate User

But much better would be that coldfusion controls the access to directories (for example in combination with session managment).

If you know a totally different approach to my problem, tell me, please!

Thanks in advance
Rene Guenther
 
Hey Rene,

If it were me, I would maintain a listing of files either in a database or dynamically populated by <cfdirectory>. I would then present this list to the user with links to each of the files. This link would go to a single .cfm page which would check their session and authenticate them if necessary. This page would then read in the file from the local server with <cffile> and then return it via <cfcontent>. This way, the visitor never sees the location of the actual files. They only see a link to the main page and it returns the file for them. You could then even remove the file directory from the webserver config so it was impossible to view them via a direct url.

Good luck,
GJ
 
GunJack,

Do you need to read the file in with <cffile> or can you simply go straight for the <cfoutput>? If you must have a <cffile> (and the input is an image), how do you tell cf to use the <cfoutput> the image? I've tried, but it says it needs a string as a filename for <cfoutput>.

Hope you can help. This is exactly the problem I'll be dealing with next week!

Thanks in advance,

Tanny
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top