Re: Userlogin system seems to override the if statement....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



did u give proper username and password to login with?

On 10/12/05, twistednetadmin <twistednetadmin@xxxxxxxxx> wrote:
> I'm new to this. So I used a tutorial to write this. But it shows "Login
> ok.
> Welcome" at once when the page loads. Here is the tutorial:
> http://www.ss32.x10hosting.com/ss32/files/PHP-logins.pdf
> <?php
> include ("DBconnection");
>
>
> session_start();
> $err = 0;
> echo $err; //just to check. Shows 0
> $sql_login = sprintf("SELECT 'name', 'pass' FROM DB
> WHERE 'name'='%s' AND 'pass'='%s'", @$_GET['name'],@md5($_GET['pass']));
> $login = mysql_query($sql_login) or die(mysql_error());
> if (mysql_num_rows($login) == 0) {
> $GLOBALS['MM_username'] == @$_GET['name'];
> echo $err; //just to check. Shows 0
> session_register("MM_username");
> echo $err; //just to check. Shows 0
> $err = 1;
>
>
> }
> echo $err; //just to check. Shows 1
> ?>
> <!-- Form -->
> <?php
> if ($err != 1) {
> if ($err == 2) { ?>
> There was an error processing your login.
> <?php } ?>
> <table>
> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="get">
>
> <tr>
> <td align="center" valign="middle" class="maintext">
> Login as:<input name="name">
> </td>
> </tr>
> <tr>
> <td align="center" valign="middle" class="maintext">
> Password:<input name="pass" type="password"><br>
> </td>
> </tr>
> <tr>
> <td align="center" valign="middle" class="maintext">
> <input type="image" src="images/login_btn.jpg" value="login"></td>
> </tr>
> </form>
> </table>
>
> <?php
> }else{
> ?>
> Login ok. Welcome <?php
> echo "<meta http-equiv=Refresh content=3;url=1stpage.php>";
> }
> ?>
>
> I don't get any further. I must be missing something, but what??
>
> Please help.
>
> -Tore W-
>
>

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux