[ Aleksandar095 @ 02.07.2019. 10:52 ] @
Pozdrav, prvi put koristim password_hash i password_verify, pa imam probleme sa password_verify.
Ima li ko ideju kako da sredim ovaj login?

Code:

if(isset($_POST['submit']))
{
    $username = mysqli_real_escape_string($con, $_POST['username']);
    $password = mysqli_real_escape_string($con, $_POST['password']);

    $query = "SELECT * FROM `users` WHERE username='$username' and password='$password'";

    $result = mysqli_query($con, $query) or die(mysqli_error($con));
    //$count = mysqli_num_rows($result);
    $row = mysqli_fetch_assoc($result);

    if (!empty($row))
    {
        if(password_verify($password, $row['password']))
        {
            $_SESSION['id'] = $username;
            $ip = $_SERVER["REMOTE_ADDR"];
            $q = "UPDATE users SET ip='$ip' WHERE username='$username'";
            mysqli_query($con, $q);
            header('Location: index.php');
        }
        else
        {
            echo '<script language = "javascript">';
            echo "alert('Invalid Password.');window.location.href='login.php'";
            echo '</script>';
        }
    }
    else
    {
        echo '<script language = "javascript">';
        echo "alert('Something went wrong, Enter real data.');window.location.href='login.php'";
        echo '</script>';
    }
}
[ djoka_l @ 02.07.2019. 11:13 ] @
Ne mogu da odolim, ali greška se vidi iz aviona.
Šta si KONKRETNO uradio da rešiš problem. Da li očekuješ da će tvoje probleme sledećih 20 godina rešavati forumi?

http://www.catb.org/~esr/faqs/smart-questions.html
Citat:

Before asking a technical question by e-mail, or in a newsgroup, or on a website chat board, do the following:

1. Try to find an answer by searching the archives of the forum or mailing list you plan to post to.
2. Try to find an answer by searching the Web.
3. Try to find an answer by reading the manual.
4. Try to find an answer by reading a FAQ.
5. Try to find an answer by inspection or experimentation.
6. Try to find an answer by asking a skilled friend.
7. If you're a programmer, try to find an answer by reading the source code.


Preporučujem ti da prođeš korake 3, 5 i 7!
[ Predrag Supurovic @ 02.07.2019. 14:50 ] @
Probaj da iz SQL upita izbacis and password='$password'

Lozinka u tabeli ne treba da bude lozinka nego hash.