i read this along time ago in a book.
the script page has the form and at the top, it checks if the fields are filled.
if they are, then it runs that part of the script to authenticate the user (the script is a login screen).
if the 2 fields (username AND password) were empty, then it displays the form.
and the action is ITSELF...
tricky... (was just learning php then...) but eventually, i ran the script and understood how it works.
PHP Code:
if (!$username) && (!password)
{
?>
<P><FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD=POST>
<P>username:<INPUT TYPE=text NAME=username VALUE="" SIZE=30></P>
<P>password:<INPUT TYPE=password NAME=password VALUE="" SIZE=30></P>
<P><INPUT TYPE=submit NAME=Submit VALUE="Submit">
</FORM></P>
<?php
}
elseif
{
//authenticate userinfo
.
.
.
if ($authenticated)
{
// set session info
.
.
.
header ("welcome_user.htm");
}
elseif
{
// display error message about bad userinfo
.
.
.
}
}
Bookmarks