Re: Again, and Again, and AGAIN!
| From: | pong-TC | Date: | Sun, 17 Mar 2002 04:53:06 +0000 |
| Subject: | Re: Again, and Again, and AGAIN! | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88801@lists.php.net to get a copy of this message | ||
ultimatezzz@hotmail.com writes:
>I'm using PHP 4.1.1 (for Windows). Here is *all* of my code.
>
><html>
><head>
><title>Administrative Log-In Page</title>
><meta http-equiv="Content-Type" content="text/html;
>charset=iso-8859-1">
></head>
>
><body bgcolor="#FFFFFF">
>Please enter your username and password below in the fields below.
><form method="post" action="<?php echo $PHP_SELF; ?>">
> Username:
> <input type="text" name="username" maxlength="255"
> value="<?php echo
>$HTTP_POST_VARS['username']; ?>">
> <br>
> Password:
> <input type="text" name="password" maxlength="8"
> value="<? echo
>$HTTP_POST_VARS['password']; ?>">
> <br>
> <input type="submit" name="login" value="Log In">
> <br>
> <br>
></form>
Hello Jason
If I were you, I would not use $HTTP_POST_VARS.. YOur form element like
this <input type="text" name="password" maxlength="8"> is good
enough. I
don't think you need this value="<? echo
>$HTTP_POST_VARS['password']; ?>". Also, make sure that echo $PHP_SELF
is output the form name or just put the form name directly. Anything else
is fine. Your isset condition should be provoked once clicked, and call
the insert function. It is very simple from my opinion. I use PHP on IIS
also.
Hope, this would help.
Pong
> <?php
> if (isset($login)) {
> insert();
> echo $login;
> }
>
> function insert() {
> $db = odbc_connect('IdentDatabase', 'root', '');
>
> if(!$db) {
> echo "An error has occured. Please <a
>href=\"mailto:drshim@alienmelon.com\">e-mail</a>
>the text below to
>me.<br><br>~~~~~~~<br>$PHP_ERROR<br>$db<br>~~~~~~~";
> }
>
> $SQLQuery = "SELECT fldID FROM tblUsers WHERE fldUsername = '$username'
>AND fldPassword = '$password'";
> $cursor = odbc_exec($db, $SQLQuery);
>
> if (!$cursor) {
> echo "An error has occured. Please <a
>href=\"mailto:drshim@alienmelon.com\">e-mail</a>
>the text below to
>me.<br><br>~~~~~~~~<br>" . odbc_errormsg($db) .
>"<br>~~~~~~~";
> }
> }
> ?>
></body>
></html>
>