Link to home
Start Free TrialLog in
Avatar of Qmez
QmezFlag for United States of America

asked on

HTML - Password Protect a Web Page ?

How can I password protect a web page that would reqire a user to key a given password to gain access to that page.....  The page is in HTML and I'm using Yahoo's SiteBuilder to contruct the page.  Also, what is a Good/Free HTML editor to use for a beginner
Avatar of jcott28
jcott28

Also, if you're using Yahoo Site builder already, just use it's HTML editor.

http://webhosting.yahoo.com/ps/sb/index.php
Do you know what the web server is? Apache? IIS?

Do you have access to the web server settings via a control panel or directly?

If Apache you can use htaccess or if IIS you can use Authentication is IIS.
You password protect a folder where the webpage is located by login to that folder.  That is the way it is done on a normal shared hosting server.  Yahoo may be the same or different.
You can use a javascript to password protect a page with a password. It's not ultra-secure, but it works. If you created a paga named:  "protected.htm" the password required for this script would be "protected"  (no quotes).  Just put this script on any page to show a password box.

The script assumes your pages are in teh same directory and ending in .htm. If it's .html or .php, change the

var suffix = ".htm" to var suffix = ".html", etc.

if your pages are in another directory, you can eliminate the ".htm" and the password will be the folder that is protected. Quick little script, but again ... not ultra-secure. .htaccess is much better.

<SCRIPT language=JavaScript>  
<!--  
var suffix = ".htm"  
var pass_msg = "Enter your password below to view your page.<P>";  
function go_there()  
{
location.href = "../" + document.pass_form.pass.value + suffix;
}
document.write('<br><form name="pass_form" onSubmit="go_there();return false">' + pass_msg + '<br><input type="password" name="pass" size="20" value="">' + '&nbsp;<input type="button" value="OK" OnClick="go_there()"></form>');  
// -->
</SCRIPT>

ASKER CERTIFIED SOLUTION
Avatar of BillDL
BillDL
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial