0

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>";
        }
    }
4

1 回答 1

0

你需要做几件事:

  1. 在 'if' 条件中使用 $count 而不是再次调用 mysql_num_rows 函数。每个 mysql 函数调用都是您要避免的费用。

  2. 通过注释“stripslashes”行来尝试代码。

  3. 回显并获取查询。然后在没有这个脚本的情况下直接运行查询(比如在 SQLYog 或 phpMyAdmin 中),看看它是否会给你结果。

于 2012-09-20T13:21:28.733 回答