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

Your name:

Reply:


Posted by cc on 10/12/05 16:57

did u give proper username and password to login with?

On 10/12/05, twistednetadmin <twistednetadmin@gmail.com> 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-
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация