(am verificat si in phpAdmin);
Dar la logare imi apare ca nu exista in baza de date;cod "login.php":
Cod: Selectaţi tot
<?php
function confirma($nume,$parola){
$t=0;
$conn=null;
$conn=mysql_connect('localhost','root','');
mysql_select_db('utilizatori');
$sql=null;
$sql="select `parola` from `utiliz` where `nume`='.$nume.' ";
$rez=null;
$rez=mysql_query($sql,$conn);
if(mysql_num_rows($rez)!=0){
$par=null;
$par=mysql_fetch_assoc($rez);
if($par['parola']==$parola)
$t=1;
}
return $t;
}
function arataLogarea(){
$t=0;
if(isset($_SESSION['nume']) && isset($_SESSION['parola'])){
$f=null;
$f=confirma($_SESSION['nume'],$_SESSION['parola']);
if($f==1)
$t=1;
}
return $t;
}
function LogheazaSauNu(){
$t=null;
$rezult=null;
$t=arataLogarea();
if($t!=1){
$rezult='
<a href="register.php">inregistrare</a><br>
logare:<br>
<form method="post" action= '.$_SERVER['PHP_SELF'].' >
NUME:<br>
<input type="text" value="" name="nume"><br>
PAROLA:<br>
<input type="text" value="" name="parola"><br>
<input type="submit" value="trimite" name="log"><br>
<input type="reset" value="sterge">
</form>';
if(isset($_POST['nume']) && isset($_POST['parola'])){
$f=null;
$m=$_POST['nume'];
$n=$_POST['parola'];
$f=confirma($m,$n);
if($f==1){
$rezult.='bine ai venit';
$_SESSION['nume']=$_POST['nume'];
$_SESSION['parola']=$_POST['parola'];
echo'<a href="logout.php">iesire</a>';
}else echo'nu exista';
}
}return $rezult;
}
$logat=LogheazaSauNu();
?>