Jump to content

How does it work...?


keturahuriel

Recommended Posts

Ok, this site gave me some code to password protect a page, and I don't know what to do with it though... the instructions the site gave were really confusing..._______________________________________This goes in the top of the actual page I think.

</head><script LANGUAGE="JavaScript" SRC="http://www.kkgaara.890m.com/password.js"></SCRIPT><body>

Or does this?

<!--//// Password Protection//// This code is free to be used as long as these// credits are left intact and included with the script://// Original code created by:// S. Scott Brady, Copyright © 1998// [url="http://www.sbrady.com/"]http://www.sbrady.com/[/url]// webmaster at sbrady dot com//Hide from old browsersvar password = prompt("Enter your password","");if (password == "shukakupwnsgaara") {alert("Password accepted! Loading page...");document.write("<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">	<head>		<link rel="stylesheet" href="layout.css" type="text/css" media="screen" />		<link rel="shortcut icon" href="favicon.ico" />		<title>Members only home</title>		<meta name="keywords" content="" />		<meta name="description" content="" />	</head>	

And this goes below the html or body tags I think.

		}else {alert("" +password+ " is an Invalid Password! Access denied...");document.write("<p><b>You have entered an invalid password. ");document.write("Access to the document is denied.</b></p>");}

Link to comment
Share on other sites

I don't recommend using this for two reasons:1. People can deactivate javascript and see the page anyways.2. People can read the source code and see the password.If you want a password protected page I recommend a server-side language like PHP.

Link to comment
Share on other sites

you can either go to the apache website or google it. I personally never use .htaccess for password protecting anything. It's better to use a server-side language like PHP or even ASP if you must.(if your server doesn't have PHP, then move to a different one because PHP is free, so there's really no reason to NOT have it. Xtreemhost is a good, free PHP host).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...