Re: Log in feature for existing webpage

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thank you kindly, Ron.

However, I seem to be on the wrong track. No page has the extension php.
(all htm). Experiments with php failed.

In the meantime I found the script below, which works.
Disadvantage is, that in MS Internet Explorer 7, the protection
(beveiliging, in Dutch), has to be set on "Normal". (low).
Is there any script which offers the same function, whithout this problem?

Thank you in advance,
Eef

ALTERNATIVE SCRIPT

<script>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');
location.href='p_agenda.htm';
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</script>
<p><a href="help-inloggen.htm">Help Inloggen</a></p>
<center>
<form>
<p><input type="button" value="Enter Protected Area" onclick="passWord()">
</p>
</form>
</center>

"Ronx" <ronx917@xxxxxxxxxxx> schreef in bericht
news:ODS%23E5HvHHA.4648@xxxxxxxxxxxxxxxxxxxxxxx
What should be written where at the end it says:
"This is the protected page. Your private content goes here"?


The content for the page.

The script goes at the top of every page you wish to be protected
(immediately after the <body> tag).

Replace
<p>This is the protected page. Your private content goes here.</p>

with the normal page content (that lying between <body> and </body>)
The page must be named with a .php extension.


You could also replace action="<?php echo $_SERVER['PHP_SELF']; ?>" with
action="pagename.php" where pagename.php is the name of the page - the
form should submit to the same page.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp

FrontPage Support: http://www.frontpagemvps.com/




"Eef" <HounietNoSpam@xxxxxxxxx> wrote in message
news:uCVofyAvHHA.3444@xxxxxxxxxxxxxxxxxxxx:

I tried the script suggested by Chris Leeds (see below)
The form appears all right, but then I get the message :"Can't find
webpage"
What should be written where at the end it says: "This is the protected
page. Your private content goes here"?

(My host does support FP-Server extensions, but NOT at the same time the
protecting a subsite or page.)

EARLIER TEXT

if you only need one user name and password here's a nice simple script
example:
http://www.totallyphp.co.uk/scripts/password_protect_a_page.htm
if you need the users to all have a UN/PW then you're getting into a
situation where you'll need a database, sign-up system, password
retrieval
system, etc.

HTH

--
Chris Leeds

CODE

<?php// Define your username and password$username = "someuser";$password
=
"somepassword";if ($_POST['txtUsername'] != $username ||
$_POST['txtPassword'] != $password) {?><h1>Login</h1><form name="form"
method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><label
for="txtUsername">Username:</label> <br /><input type="text"
title="Enter
your Username" name="txtUsername" /></p> <p><label
for="txtpassword">Password:</label> <br /><input type="password"
title="Enter your password" name="txtPassword" /></p> <p><input
type="submit" name="Submit" value="Login" /></p></form><?php}else
{?><p>This
is the protected page. Your private content goes here.</p><?php}?>

Eef



.



Relevant Pages