"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to