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("connec t.php");
session_start() ;
if (!empty($_POST) ){
$query = "SELECT * FROM KLANT
WHERE Email='".$_POST["Email"]."'
AND Wachtwoord='".$ _POST["Wachtwoord "]." ' ";
$result=mysql_q uery($query) or die("FOUT : " . MySQL_error());
if ((Status=="acti ef") AND (MySQL_num_rows ($result) >0)){
$username=$_POS T["Email"];
$wachtwoord=$_P OST["Wachtwoord "];
session_registe r("username") ;
session_registe r("wachtwoord") ;
mysql_fetch_row ($result);
header("Locatio n: winkel.php");
exit();
}
elseif ((Status=="inac tief") 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);
}}
?>
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("connec t.php");
session_start() ;
if (!empty($_POST) ){
$query = "SELECT * FROM KLANT
WHERE Email='".$_POST["Email"]."'
AND Wachtwoord='".$ _POST["Wachtwoord "]." ' ";
$result=mysql_q uery($query) or die("FOUT : " . MySQL_error());
if ((Status=="acti ef") AND (MySQL_num_rows ($result) >0)){
$username=$_POS T["Email"];
$wachtwoord=$_P OST["Wachtwoord "];
session_registe r("username") ;
session_registe r("wachtwoord") ;
mysql_fetch_row ($result);
header("Locatio n: winkel.php");
exit();
}
elseif ((Status=="inac tief") 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);
}}
?>
Comment