I have mysql connection and its working. Connection is done and mysql result its okay. Im trying to login my panel but everytime giving “password is incorrect”/Kullanıcı adınız veya şifreniz yanlış. How can i fix this?
if(@$_GET['selection'] == 'verification' )
{
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$tbl_name="kullanicilar";
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM kullanicilar WHERE kullaniciadi='$myusername' and sifre='$mypassword'";
$result=@mysql_query($sql);
$count=@mysql_num_rows($result);
if (@mysql_num_rows($result) != 0)
{
session_register("myusername");
session_register("mypassword");
header("location:index.php?page=giris&lang=tr&selection=verified");
}
else
{
echo "Kullanici adiniz veya sifreniz yanlis. <b>$count</b>";
}
}
You need to do a few things:
Use $count in the ‘if’ condition instead of calling mysql_num_rows function again. Each mysql function call is an expense you want to avoid.
Try the code by commenting “stripslashes” lines.
Echo and get the query. Then run the query directly without this script (like in SQLYog or in phpMyAdmin) and see if it gives you the result.