Waiting for the payment into escrow

Php hash comparar contraseña mysql

Published on the June 13, 2018 in IT & Programming

About this project

Open

Cifre una contraseña con el siguiente codigo: $pass = htmlentities(addslashes($_POST['password']));   
$passHash = password_hash($pass, Password_bcrypt);

el proyecto es php mvc con mysql

la base de datos se llama solucion

create table `fallas` (
  `id` int(11) not null,
  `nombre` varchar(100) not null default '0',
  `tipo` varchar(50) not null default '0',
  `descripcion` varchar(50) not null,
  `pagina` varchar(60) not null
) ;

alter table `fallas`
  add primary key (`id`);

alter table `fallas`
  modify `id` int(11) not null auto_increment;

create table `logeo` (
  `id` int(11) not null,
  `pass` varchar(200) not null default '0',
  `usuario` varchar(60) not null default '0'
) ;

alter table `logeo`
  add primary key (`id`);

alter table `logeo`
  modify `id` int(11) not null auto_increment;

en el controlador modifique la funcion que hace el login

public function login()
{
    $solucion = new solucion();
    if (isset($_post["login"]) && isset($_post["password"]))
    {
        $login = htmlentities(addslashes($_post["login"]));
        $password = htmlentities(addslashes($_post["password"]));
        $solucion = $this->model->logeo($login, $password);
        $pass= $this->model->getpass();
        if (password_verify($password, $pass)&&$solucion == 1)
        {
            setcookie('usuario', $login, time() + 3600);
            session_start();
            $_session["usuario"] = $login;
            header("location: view/header.php");
            header("Location: view/solucion/solucion.php");
            header("Location: view/Footer.php");
        }
    }
    header('Location: index.php');
    return;
}

en el modelo hago una consulta para traer el hash almacenado en pass

public function Logeo($login) {
        try {
            $sql = "SELECT pass FROM logeo WHERE usuario = :login";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindValue(":login", $login);
            $resultado->execute();
            $numero_registro = $resultado->rowCount();
            if ($numero_registro != 0) {
                return 1;
            }
            $this->res = $resultado->fetch(PDO::FETCH_ASSOC);
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
   
  public function getpass(){
    return $this->res['pass'];
   
}

cuando hago el login el formulario borra los datos y no se verifica la contraseña ingresada

Category IT & Programming
Subcategory Web development
What is the scope of the project? Small change or bug
Is this a project or a position? Long-term position
I currently have Not applicable
Required availability Part time
Experience in this type of projects Yes (I have managed this kind of project before)
Roles needed Developer

Project duration 1 to 3 months

Skills needed

Other projects posted by I. R.