<?php require "db.php"; $data = $_POST; if( isset($data['do_login']) ) { $errors = array(); $user = R::findOne('users', 'login = ?', array($data['login'])); if($user) { if( password_verify( $data['password'], $user->password )) { //$SESSION['logged_user'] = $user; echo '<div style="color: green;">Ну все</div><hr>'; } else { $errors[] = 'pass no?'; } } else { $errors[] = 'no akk'; } } if( ! empty($errors) ) { echo '<div style="color: red;">'.array_shift($errors).'</div><hr>'; } ?> <form action="/login.php" method="POST"> <p> <p><strong>Login</strong>:</p> <input type="text" name="login" value="<?php echo $data['login']; ?>"> </p> <p> <p><strong>pass</strong>:</p> <input type="password" name="password"> </p> <p> <button type="submit" name="do_login">login</button> </p> </form> I write login where is not from a DB. writes no akk (login is not on the database), I write the login and the password is not correct where on the database. writes pass no (the password is not correct) I write the login and the password is correct. again writes pass no (password is not correct)
object (RedBeanPHP \ OODBBean) # 15 (10) {["properties": protected] => array (5) {["id"] => string (2) "20" ["login"] => string (5 ) "root1" ["password"] => string (30) "$ 2y $ 10 $ 6F ****************" ["pin"] => string (4) " 1234 "[" email "] => string (3)" 123 "} [" __info ": protected] => array (5) {[" type "] => string (5)" users "[" sys.id "] => string (2)" id "[" sys.orig "] => array (5) {[" id "] => string (2)" 20 "[" login "] => string (5) "root1" ["password"] => string (30) "$ 2y $ 10 $ 6 ****************" ["email"] => string (3) "123"} ["tainted"] => bool (false) ["changed"] => bool (false)} ["beanHelper": protected] => object (RedBeanPHP \ BeanHelper \ SimpleFacadeBeanHelper) # 11 (0) {} ["fetchType ": protected] => NULL [" withSql ": protected] => string (0)" "[" withParams ": protected] => array (0) {} [" aliasName ": protected] => NULL [" via ": protected] => NULL [" noLoad ": protected] => bool (false) [" all ": protected] => bool (false)}
this is code
var_dump($user);