Solved

Password protected HTML page

Posted on 1998-11-01
9
142 Views
Last Modified: 2010-04-09
I want to restrict some pages on my web-site to users with a login and a password (much like the way I need to punch in my login name and password to use my Expert-Exchange account). How can I do this? Which tools do I need? Can this be done by HTML only?
0
Comment
Question by:shlomoy
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 4

Expert Comment

by:rafistern
ID: 1839334
You can do this by restricting access to the page on the server.

However what you can do with HTML only is:

<form name="theForm">
<input type="password" name="pwd">
<input type="button" value="Enter" onclick="location.href='document.theForm.pwd.value'+'.html'">
</form>

The name of the page is the password. Only someone who knows the password can find the page. Alternatively use the password as the name of the folder.
0
 
LVL 8

Author Comment

by:shlomoy
ID: 1839335
thing is - viewing the source code of the page reveiles the password and all...
0
 
LVL 4

Expert Comment

by:rafistern
ID: 1839336
No it doesn't.

The page contains the above script only. The name of the page is not included in the page at all.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 84

Expert Comment

by:ozo
ID: 1839337
No, it doesn't.  the source code doesn't show what you input in the fform.
On the other hand, knowing the password, you could go directly to the document, making the form superfluous.
0
 
LVL 4

Expert Comment

by:rafistern
ID: 1839338
OK here is something even smarter:
Have the form take you to a page that contains a meta-refresh / location.href= or even better a location.replace that will take you to your off-bounds page.

Thus the new page:

<head>
<script>
if(location.replace)
  location.replace("theRealPage.html);
else
  location.href=("theRealPage.html);
</script>
</head>

 The advantages now are:
1. you can change the name of this page whenever you like without upsetting links or anything else.
2. a casual passer-by cannot see the password by reading the URL.

The location.replace is the best but not supported by all browsers (javascript 1.1 supported by NS3+, IE4+).


0
 
LVL 1

Expert Comment

by:rajgn
ID: 1839339
shlomoy:

Do you want to use Javascript where when a link to password protected file is clicked, a small new window pops up asking for password/username. If only when they are correct, it'll load the new page in the main window. By the way, where are yoou storing user anme and  passwords(I mean are you using any database?)
0
 
LVL 1

Expert Comment

by:Jason_G
ID: 1839340
Hi shlomoy,
Here are various sites that detail how to password protect your pages.
http://www.wsabstract.com/script/cut34.htm
http://www.5k.com/support/password.html 
http://lonestar.texas.net/~krigoni/frames/passw.html 
http://ag.arizona.edu/ecat/web/password-protect.html 
http://www.oz.net/jbrady/thegenie/java/cgpwdexample1.html 
http://www.irn.pdx.edu/~kerlinb/spin/passprotect.html 

I hope this helps.

Enjoy, and happy programming!

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, http://scholars.com 
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
0
 
LVL 8

Author Comment

by:shlomoy
ID: 1839341
Jason_G - Thanks for your help (big help) if you will address your comment as an answer - I'll grant you the points. :-)

The rest of you guys - 10x for the tips, but Jason_G here offered some sites with some variety of solutions and/or implementations.
0
 
LVL 1

Accepted Solution

by:
Jason_G earned 100 total points
ID: 1839342
Hi Shlomoy,
Thanks, I'm glad they helped you!<grin>

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, http://scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
html input 8 42
Asp in server side with Mssql Server 7 4 27
Word, Excel, Access icons 4 17
send email part1 9 23
This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question