| | |
How to Password protect files / sections on web page ?
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
0
#11 34 Days Ago
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<a href="faili/materiali/brosuras/maskesana.pdf" target="_blank" onclick="validate();">
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Sep 2009
Posts: 549
Reputation:
Solved Threads: 64
0
#12 34 Days Ago
Leave it, it wont work.Here is one more logic -
-redirect the user to another php page when he tries to download the pdf, adn check his username/password there.
-if username/password are right just get him back to the previous page or else directly exit or do whatever you wish.
-redirect the user to another php page when he tries to download the pdf, adn check his username/password there.
-if username/password are right just get him back to the previous page or else directly exit or do whatever you wish.
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
0
#13 33 Days Ago
There are 2 ways to securely do this. The first one is to make the download dir inaccessible without password (this is as said done in htaccess e.l. and not in you code). The other one is to put the file outside of you public_html-folder (http_root o.l. it might be called on a winserver) and use a script/program like php or C# to read the file and output it to the response-stream if the password is correct.
•
•
Join Date: Oct 2007
Posts: 37
Reputation:
Solved Threads: 0
0
#14 33 Days Ago
I found out about htaccess few hours ago. Now I know how can I password protect a single html page. which was one of the things I needed.
But how can I password protect single file or better yet <a href> tag ? I don't know much about php etc. so I wanted to ask in this forum for some help, maybe someone know some tutorials regarding this ..
But how can I password protect single file or better yet <a href> tag ? I don't know much about php etc. so I wanted to ask in this forum for some help, maybe someone know some tutorials regarding this ..
0
#15 33 Days Ago
•
•
•
•
I found out about htaccess few hours ago. Now I know how can I password protect a single html page. which was one of the things I needed.
But how can I password protect single file or better yet <a href> tag ? I don't know much about php etc. so I wanted to ask in this forum for some help, maybe someone know some tutorials regarding this ..
•
•
Join Date: Oct 2007
Posts: 37
Reputation:
Solved Threads: 0
0
#16 33 Days Ago
Thanks, everything works great, I don't know why, but somehow I imagined this would be much harder :p.
Got 1 question though:
when I clicked on .pdf link (without .htaccess) it opened in a new tab/window. Now when I have .htaccess, browser opens new tab and asks for authorization , which is all great, but if i press cancel I get Authorization Required error page. Is it possible to somehow get redirected back to the page from which I opened that .pdf instead of error page ?
Got 1 question though:
when I clicked on .pdf link (without .htaccess) it opened in a new tab/window. Now when I have .htaccess, browser opens new tab and asks for authorization , which is all great, but if i press cancel I get Authorization Required error page. Is it possible to somehow get redirected back to the page from which I opened that .pdf instead of error page ?
Last edited by wonderland; 33 Days Ago at 7:50 pm.
![]() |
Similar Threads
- From Web Page, Download a Folder containing Files To Client PC (VB.NET)
- listing files on web page (VB.NET)
- Password Protect (JavaScript / DHTML / AJAX)
- How do I Password protect a web-page (Windows NT / 2000 / XP)
- How do i Password protect all my asp.net pages on my website (ASP.NET)
- igoogle style window drag & drop in diferent sections of a web page (JavaScript / DHTML / AJAX)
- Code Snippet: PHP Session Management & Password Protect class (PHP)
- password protecting files on another HD (Windows NT / 2000 / XP)
- unable to load windows update web page (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: onClick code dont now how to use.
- Next Thread: Warning Message on Browser Close
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate automatically beta box bug calendar captcha cart checkbox child class column cookies createrange() css cursor decimal design dom download dropdown editor element engine enter error events explorer file focus form forms frameworks google gwt html htmlform ie8 iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jump listbox math matrixcaptcha menu microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent pdf php player post problem progressbar prototype rated rating regex runtime scale scroll search select session shopping size sql star starrating stars text textarea validation w3c web website window windowofwords windowsxp wysiwyg xml \n





