function ProcessLogin($user, $dblink) { $login = filter::filter_email($user); if ($login != FALSE) { if ($stm = $dblink->prepare("SELECT email, pass FROM users WHERE email=?")) { $stm->execute(array($login)); $row = $stm->fetch(); $stm = NULL; $uname = $row['email']; $hash = $row['pass']; } if ($uname == $login) { if (password_verify($_POST['password'], $hash)) { $_SESSION['email'] = $login; //login::log_enter($dblink); } else { $mesg = "Wrong password"; } } else { $mesg = "Wrong login"; } } else { $mesg = "Login is not valid"; } return $mesg; }
public function getInfo($user, $dblink) { if (!isset($user)) { header("location: index.php"); exit; } $uiname = filter::filter_email($user); if ($stm = $dblink->prepare("SELECT * FROM users WHERE email = ?")) { $stm->execute(array($uiname)); $out = $stm->fetch(); $stm = NULL; } if ($out['id'] == '') { session_destroy(); header("location: index.php"); exit; } return $out; }