Srodne teme
Kliknite za generisanje liste srodnih tema...
Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Password_verify... Pomoc

[es] :: PHP :: Password_verify... Pomoc

[ Pregleda: 786 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Aleksandar095
Aleksandar Milosevic
Krusevac

Član broj: 340421
Poruke: 4
141.101.104.*



Profil

icon Password_verify... Pomoc02.07.2019. u 10:52 - pre 58 meseci
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>';
    }
}
 
Odgovor na temu

djoka_l
Beograd

Član broj: 56075
Poruke: 3453

Jabber: djoka_l


+1462 Profil

icon Re: Password_verify... Pomoc02.07.2019. u 11:13 - pre 58 meseci
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!
 
Odgovor na temu

Predrag Supurovic
Pedja YT9TP
Užice

Član broj: 157129
Poruke: 6279

Sajt: pedja.supurovic.net


+1570 Profil

icon Re: Password_verify... Pomoc02.07.2019. u 14:50 - pre 58 meseci
Probaj da iz SQL upita izbacis and password='$password'

Lozinka u tabeli ne treba da bude lozinka nego hash.

 
Odgovor na temu

[es] :: PHP :: Password_verify... Pomoc

[ Pregleda: 786 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Srodne teme
Kliknite za generisanje liste srodnih tema...
Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.