Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Simple login page question

LEGEND ,
May 18, 2008 May 18, 2008

Copy link to clipboard

Copied

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.
TOPICS
Server side applications

Views

219
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2008 May 19, 2008

Copy link to clipboard

Copied

LATEST
$_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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines