login php

adirahman6 years ago

how create login with msql on traccar
i have my code not work

$email = $_POST['email'];
    $userpassword = $_POST['hashedpassword'];



    $sql = "select email,hashedpassword from users where email= '$email'  ";
    $result = mysqli_query($link,$sql);
    

    while($row = mysqli_fetch_array($result))
    {
        $data = $userpassword;
        $key = hexToStr($row['salt']);
        $hashed = hash_pbkdf2('sha1',$data, $key,1000,24,true);

        if (strToHex($hashed)==$row['hashedpassword']){
                        //session_start();
                        //$_SESSION['email'] = $email;
                    $_SESSION['hashedpassword'] = $userpassword; 
                    header('location:page.php');
                      }
    }