Hi,
I have a login page which is supposed to authenticate a user.
<input type="text" name="felhasznalo" size="20">
<input type="password" name="jelszo" size="20">
<input type="submit" name="submit" value=http://www.phpbuilder.com/board/archive/index.php/"Bejelentkez閟">
So the variable $felhasznalo will store the USERNAME while $jelszo will store the PASSWORD.
I have two tables in my database which are in connection with authentication as not all the users have their own passwords but according to the group they belong to.
Here is my query which is supposed to find one matching row if the user enter a correct password.
The table TANSZEKI_DOLGOZO stores the USERS and their USERLEVEL, the table JELSZO the USERLEVEL (STATUSZ) and the PASSWORDS. AZONOSITO = LOGINNAME, STATUSZ = USERLEVEL and JELSZO = PASSWORD.
$query = "select distinct tanszeki_dolgozo.azonosito,
jelszo.statusz,jelszo.jelszo
from tanszeki_dolgozo,jelszo
where (tanszeki_dolgozo.statusz = jelszo.statusz) &&
(tanszeki_dolgozo.azonosito ='$felhasznalo' && jelszo.jelszo = '$jelszo')" ;
$result = mysql_query($query,$db) ;
if (!$result)
{
echo "<h4>Hiba az azonos韙?閟 jelsz?ellen鮮z閟閚閘!</h4>" ;
}
$num = mysql_num_rows($result) ;
if ($num == 1)
{
$adat = mysql_fetch_array($result,0) ;
session_start() ;
$szint = $adat["statusz"] ;
session_register("szint") ;
if ($felhasznalo == "admin")
{
header("Location: admin_menu.php") ;
}
else
if ($felhasznalo == "dolg")
{
$user = $adat["azonosito"] ;
session_register("user") ;
header("Location: dolg_menu.php") ;
}
}
else
{
header("Location: login.php") ;
}
I have a login page which is supposed to authenticate a user.
<input type="text" name="felhasznalo" size="20">
<input type="password" name="jelszo" size="20">
<input type="submit" name="submit" value=http://www.phpbuilder.com/board/archive/index.php/"Bejelentkez閟">
So the variable $felhasznalo will store the USERNAME while $jelszo will store the PASSWORD.
I have two tables in my database which are in connection with authentication as not all the users have their own passwords but according to the group they belong to.
Here is my query which is supposed to find one matching row if the user enter a correct password.
The table TANSZEKI_DOLGOZO stores the USERS and their USERLEVEL, the table JELSZO the USERLEVEL (STATUSZ) and the PASSWORDS. AZONOSITO = LOGINNAME, STATUSZ = USERLEVEL and JELSZO = PASSWORD.
$query = "select distinct tanszeki_dolgozo.azonosito,
jelszo.statusz,jelszo.jelszo
from tanszeki_dolgozo,jelszo
where (tanszeki_dolgozo.statusz = jelszo.statusz) &&
(tanszeki_dolgozo.azonosito ='$felhasznalo' && jelszo.jelszo = '$jelszo')" ;
$result = mysql_query($query,$db) ;
if (!$result)
{
echo "<h4>Hiba az azonos韙?閟 jelsz?ellen鮮z閟閚閘!</h4>" ;
}
$num = mysql_num_rows($result) ;
if ($num == 1)
{
$adat = mysql_fetch_array($result,0) ;
session_start() ;
$szint = $adat["statusz"] ;
session_register("szint") ;
if ($felhasznalo == "admin")
{
header("Location: admin_menu.php") ;
}
else
if ($felhasznalo == "dolg")
{
$user = $adat["azonosito"] ;
session_register("user") ;
header("Location: dolg_menu.php") ;
}
}
else
{
header("Location: login.php") ;
}