Skip to main content
Inspiring
May 19, 2008
Question

Simple login page question

  • May 19, 2008
  • 1 reply
  • 239 views
I'm trying to create a simple login using a form and php and am having
difficulty in troubleshooting - if someone could give me a little help,
I would greatly appreciate it.

Here is the code:

<?php

$error = FALSE;

if (isset($_POST['client_password']) && isset($_POST['client_username'])) {
if (($_POST['client_password'] == 'blah') &&
($_POST['client_username'] == 'blahblah')) {
header("Location=
http://homepage.mac.com/companyname/FileSharing44.html");
exit();
}
else {
$error = "<h2>You have entered an incorrect password/username.
Please try again.</h2>";
}
}

?>

(and in the document body)

<?php echo $error?$error:''; ?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form1
" id="form1">
<label for="client_name">Username<span class="required">*</span></label>
<input name="client_name" type="text" size="20" maxlength="50">

<label for="client_password">Password<span
class="required">*</span></label>
<input name="client_password" type="text" id="client_password"
size="20" maxlength="20">
<label for="send"></label>
<input class="login" type="submit" name="send" id="send" value="Log
In">
</form>

In testing this page in the browser:

1. When I enter the correct username and password, it just drops me back
into the login page.

2. When I enter the incorrect username and password, it drops me back
into the login page without the error message.

Thanks in advance.
This topic has been closed for replies.

1 reply

Inspiring
May 19, 2008
$_POST['client_username']
<input name="client_name"

Hmmmm.... 8)

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"Virginia Carter" <junebug64@citcom.net> wrote in message
news:g0qgnv$lgu$1@forums.macromedia.com...
> I'm trying to create a simple login using a form and php and am having
> difficulty in troubleshooting - if someone could give me a little help, I
> would greatly appreciate it.
>
> Here is the code:
>
> <?php
>
> $error = FALSE;
>
> if (isset($_POST['client_password']) && isset($_POST['client_username']))
> {
> if (($_POST['client_password'] == 'blah') &&
> ($_POST['client_username'] == 'blahblah')) {
> header("Location=
> http://homepage.mac.com/companyname/FileSharing44.html");
> exit();
> }
> else {
> $error = "<h2>You have entered an incorrect password/username.
> Please try again.</h2>";
> }
> }
>
> ?>
>
> (and in the document body)
>
> <?php echo $error?$error:''; ?>
> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"
> name="form1
> " id="form1">
> <label for="client_name">Username<span
> class="required">*</span></label>
> <input name="client_name" type="text" size="20" maxlength="50">
>
> <label for="client_password">Password<span
> class="required">*</span></label>
> <input name="client_password" type="text" id="client_password"
> size="20" maxlength="20">
> <label for="send"></label>
> <input class="login" type="submit" name="send" id="send" value="Log
> In">
> </form>
>
> In testing this page in the browser:
>
> 1. When I enter the correct username and password, it just drops me back
> into the login page.
>
> 2. When I enter the incorrect username and password, it drops me back into
> the login page without the error message.
>
> Thanks in advance.