Re: .htaccess - Still asking for login information although already sent through address bar
| From: | PHP Webmaster | Date: | Mon, 06 Oct 2003 19:44:52 +0000 |
| Subject: | Re: .htaccess - Still asking for login information although already sent through address bar | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165238@lists.php.net to get a copy of this message | ||
"Jason Wong" <php-general@gremlins.biz> wrote in message
news:200310070040.16382.php-general@gremlins.biz...
> On Tuesday 07 October 2003 00:32, PHP Webmaster wrote:
>
> > If I use my login form, the login box pops up only once. If I copy the
text
> > from the address bar (generated by the form) and paste it into the
address
> > bar (after restarting the browser) the logon box does not appear.
>
> Perhaps you could show some code?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> A reverend wanted to telephone another reverend. He told the operator,
> "This is a parson to parson call."
> */
Sure,
This is the code for the login form: (login_form.html)
<html>
<head>
<title>Control Panel Login</title>
</head>
<body>
<form name="cp_login" method="post" action="login_process.php">
<p>Domain Name: <input type="text" name="domain"
size="20"><br>
Username: <input type="text" name="username"
size="10"><br>
Password: <input type="password" name="password"
size="10"><br>
<input type="submit" name="cp_login" value="Login to Control
Panel"></p>
</form>
</body>
</html>
This is the code for the login processor file: (login_process.php)
<?php
$cp_login = $HTTP_POST_VARS["cp_login"];
$domain = $HTTP_POST_VARS["domain"];
$username = $HTTP_POST_VARS["username"];
$password = $HTTP_POST_VARS["password"];
if ($cp_login) {
if (!$domain || !$username || !$password) {
echo "<p><strong>Error:</strong><br>One or more form fields have been
left
blank.<br>";
echo "Please use your browsers' back button and fill in all form
fields.</p>";
exit;
}
else {
$redirect_url = "https://" . $username . ":" .
$password . "@" . $domain .
":2083/frontend/x/index.html";
header("Location: $redirect_url");
exit;
}
}
else {
header("Location: login_form.html");
exit;
}
?>
I know that there is no username/password validation code inside the
login_process.php file, but this is not my priority at the moment.