URL Opening
| From: | Vivek | Date: | Sat, 19 Oct 2002 08:28:22 +0000 |
| Subject: | URL Opening | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120591@lists.php.net to get a copy of this message | ||
Hi Fellows,
Here is my script that authenticates user by a simple login page 7
validating user name and password from a mysql database/table. All I
wish is when a user is found Valid my script should open a page in the
browser without showing its URL in the address bar. E.g. If user is
authenticated he should be sent to "http://callmgmt.org/menu.htm" and if
he is not a valid user then he should be redirected to
"http://callmgmt.org/login.htm" without
showing menu.htm or login.htm in
the address bar. The address bar should show constantly only
"http://callmgmt.org" so that user does not know
to which page he is
redirected.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <head> <title>Login Page</title> <script
language="JavaScript">
<? require("libjs.js"); ?> </script> </head> <body>
<?php include("phpdbform_form.php");
mysql_connect("vivek", "callmgmt", "1") or die("Couldnt connect
to
database");
mysql_select_db(callmgmt) or die("Couldnt select database");
$result = mysql_query("SELECT username,userpw FROM
users ");
$row = mysql_fetch_array($result);
echo "<center>";
$form = new phpform("form1");
$form->add_textbox( "name", "<b> User Name </b>", 20, 20 );
$form->add_password( "passwd", "<b> Password </b>", 20, 20 );
//$form->fields["name"]->onblur = "TestLen(this,5,20);";
//$form->fields["passwd"]->onblur = "TestLen(this,4,10);";
$processed = $form->process();
$form->draw();
echo "</center>";
echo "<hr>";
// I put remarks so that can check if this script works without
importing form fields into variables.
// @reset( $HTTP_POST_VARS );
//while( $k = @each( $HTTP_POST_VARS ) )
//{
// echo $k[0] . " - " . $k[1] . "<br>";
//}
if ( $form1_name == $row[0] && $form1_passwd == $row[1])
// Here I wish to redirect the user to a Page
echo "<center> Matched </center>";
else
// Here I wish to redirect the user to the login page again
echo "<center> <big><font color = red> Incorrect User Name or
Password </font> </big></center>";
?>
</body>
</html>
Regards,
Vivek