Log in feature for existing webpage

E

Eef

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
 
R

Ronx

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/




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
 
E

Eef

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 said:
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/




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
 
T

Thomas A. Rowe

Anyone can do a view source and set the password.

Your PHP script must be run from a web server that supports PHP and all pages to be protected must
have .php extensions. This applies to all server-side script, such as ASP, ASP.net, PHP, CFM, etc.)

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================


Eef said:
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 said:
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 said:
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
 
R

Ronx

Do not use that script - it is useless since viewing source will reveal
the password.

If you must use JavaScript, see
http://www.rxs-enterprises.org/tests/jspass/ for a couple of better
methods, neither of which are secure.

Better, if you have FrontPage extensions and your host permits subwebs
with unique permissions see:

http://support.microsoft.com/default.aspx?scid=kb;en-us;301554 (FP2000)
http://support.microsoft.com/default.aspx?scid=kb;en-us;825451 (FP2003)

If your host supports server side scripting (php, asp, asp.NET, Perl/CGI
etc.) then this is the best way to go. Chris Leeds posted a PHP
solution which has failed for you.
--
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/




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 said:
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/




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
 
E

Eef

Thank you once again, Ron.

My host does not support FrontPage extensions completely.
That is why I look for alternatives.

Eef.

Ronx said:
Do not use that script - it is useless since viewing source will reveal
the password.

If you must use JavaScript, see
http://www.rxs-enterprises.org/tests/jspass/ for a couple of better
methods, neither of which are secure.

Better, if you have FrontPage extensions and your host permits subwebs
with unique permissions see:

http://support.microsoft.com/default.aspx?scid=kb;en-us;301554 (FP2000)
http://support.microsoft.com/default.aspx?scid=kb;en-us;825451 (FP2003)

If your host supports server side scripting (php, asp, asp.NET, Perl/CGI
etc.) then this is the best way to go. Chris Leeds posted a PHP solution
which has failed for you.
--
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/




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 said:
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/





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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top