I am making the following code PHP
public function Login($uname,$umail,$upass)
{
try
{
$stmt = $this->conn->prepare("SELECT usersid, user, email, password FROM user WHERE user=:uname OR email=:umail");
$stmt->bindparam(":uname", $uname);
$stmt->bindparam(":umail", $umail);
$stmt->execute();
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
if($stmt->rowCount() == 1)
{
if(password_verify($upass, $userRow['password']))
{
$_SESSION['user_session'] = $userRow['usersid'];
return true;
}
else
{
return false;
}
}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}
PHP INDEX
session_start();
require_once("class.user.php");
$login = new USER();
if($login->is_loggedin()!="")
{
$login->redirect('home.php');
}
if(isset($_POST['btn-login']))
{
$uname = strip_tags($_POST['txt_uname_email']);
$umail = strip_tags($_POST['txt_uname_email']);
$upass = strip_tags($_POST['txt_password']);
if($login->Login($uname,$umail,$upass))
{
$login->redirect('home.php');
}
else
{
$error = "Sem Autenticação ";
}
}
HTML INDEX
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="style.css" type="text/css"/>
</head>
<body>
<div class="signin-form">
<div class="container">
<form class="form-signin" method="post" id="login-form">
<h2 class="form-signin-heading">Access Painel</h2><hr />
<div id="error">
<?php
if(isset($error))
{
?>
<div class="alert alert-danger">
<i class="glyphicon glyphicon-warning-sign"></i> <?php echo $error; ?> !
</div>
<?php
}
?>
</div>
<div class="form-group">
<input type="text" class="form-control" name="txt_uname_email" placeholder="Usuário ou Email" required />
<span id="check-e"></span>
</div>
<div class="form-group">
<input type="password" class="form-control" name="txt_password" placeholder="Senha" />
</div>
<hr />
<div class="form-group">
<button type="submit" name="btn-login" class="btn btn-default">
<i class="glyphicon glyphicon-log-in"></i> Login
</button>
</div>
<br />
<label><a href="sign-up.php">Registrar</a></label>
</form>
</div>
</div>
</body>
</html>
But it is not logging in, all information is going to the Login function, making a var_dump it goes up to $ userRow = $ stmt-> fetch (PDO :: FETCH_ASSOC); with all the information. What I think is crashing is password_verify.