You are here: Re: if AND « PHP Programming Language « IT news, forums, messages
Re: if AND

Posted by Johannes on 05/20/07 14:47

On 20 mei, 16:35, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Johannes wrote:
> > Hey guys,
>
> > I'm building a login script using an active or inactive state, but
> > when i check for this state it just simply skips to the incorrect
> > login. It looks like the If ... AND ... part isn't working. Can
> > anybody give me a hand with this problem?
>
> > here's the code I use:
>
> > <?php
> > include("connect.php");
> > session_start();
>
> > if (!empty($_POST)){
> > $query = "SELECT * FROM KLANT
> > WHERE Email='".$_POST["Email"]."'
> > AND Wachtwoord='".$_POST["Wachtwoord"]." ' ";
> > $result=mysql_query($query) or die("FOUT : " . MySQL_error());
>
> > if ((Status=="actief") AND (MySQL_num_rows($result) >0)){
> > $username=$_POST["Email"];
> > $wachtwoord=$_POST["Wachtwoord"];
> > session_register("username");
> > session_register("wachtwoord");
> > mysql_fetch_row($result);
> > header("Location: winkel.php");
> > exit();
> > }
> > elseif ((Status=="inactief") AND (MySQL_num_rows($result) >0)){
> > $tekst="Uw account staat momenteel op niet-actief<br>
> > Neem a.u.b. contact op met de winkel";
> > die($tekst);
> > }else{
> > $tekst="U hebt geen geldige combinatie van e-mailadres en
> > wachtwoord opgegeven. Maak een keuze: <br>
> > <a href=\ 'inloggen.php\'>Opnieuw inloggen</a><br>
> > <a href=\ 'aanmelden.php\'>Hier registreren</a><br>";
> > die($tekst);
> > }}
> > ?>
>
> Where are you getting Status? Are you depending on register_globals to
> be set on? If so, this is a "very bad thing".
>
> Also, session_register is similar in that it requires register_globals
> to be on.
>
> Rather, you should be using the $_SESSION array.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Status is a textfield in a table in a database. The connection to this
database is made in connect.php. I changed the register_globals to
$_SESSION, but it didn't fix the AND problem i`m afraid..

 

Navigation:

[Reply to this 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

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