|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
how do i password protect files on web page I am making a small project on php and want some help in it. How do i exactly password protect the files i upload. I mean i want to upload some content and want it to be accessible to users of the site, but they should not be able to download if they are not registered, that is they must have password to download. |
#2
| |||
| |||
Re: how do i password protect files on web page On click to download the file, direct it to a function which will check for password. The function should look somewhat like this; Code: function check(){ var realPassword = 'check'; var password = prompt('Enter the password',''); if(password !=' ' && password !=null) { if(password != realPassword) { alert("Download not accessible"); } } else{ alert("Enter the password"); return false; } } Last edited by MindSpace : 05-11-2009 at 10:59 AM. |
#3
| |||
| |||
Re: how do i password protect files on web page well i tried doing what you said, with the html redirect to a page with a validation check by the code you gave, but this is not much help. I am wondering,. is there any way by which i could just password protect my file itself? Last edited by AARON Carter : 05-11-2009 at 11:06 AM. |
#4
| |||
| |||
Re: how do i password protect files on web page I was thinking of just that, so to password protect the file itself, what you can do is use the .htaccess. First make a file named htpasswd and store the username and password there like this; username:12querry34. Keep this file in the folder that is accesible on web. Now make a htaccess file which will be something like this; Code: AuthUserFile /usr/local/safe/protect/.htpasswd AuthGroupFile /dev/null AuthName PasswordProtect AuthType Basic require user username |
![]() |
|
Tags: download, html, password |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Password protect files/folders on android and computer | TomHi | Tips & Tweaks | 1 | 01-10-2011 11:44 PM |
How do I password protect my files and folders in Windows | Altair Creed | Technology & Internet | 7 | 05-04-2010 04:31 PM |
How to protect password? | Otilio | Windows Software | 3 | 21-11-2009 05:12 PM |
How to protect text files with password? | Level8 | Operating Systems | 3 | 20-11-2009 12:09 PM |
How to create password protect RAR files | TechBook | Windows Software | 2 | 06-03-2009 03:14 PM |