本文整理汇总了PHP中DbManager::get_user_by_id_if_password_is_correct方法的典型用法代码示例。如果您正苦于以下问题:PHP DbManager::get_user_by_id_if_password_is_correct方法的具体用法?PHP DbManager::get_user_by_id_if_password_is_correct怎么用?PHP DbManager::get_user_by_id_if_password_is_correct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbManager
的用法示例。
在下文中一共展示了DbManager::get_user_by_id_if_password_is_correct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
$old_password = null;
$new_password = null;
$user_id = null;
$email = null;
if (isset($_POST['user_id'], $_POST['name'], $_POST['old_password'], $_POST['new_password'])) {
$name = $_POST['name'];
$old_password = $_POST['old_password'];
$new_password = $_POST['new_password'];
$user_id = $_POST['user_id'];
if (isset($_POST['email'])) {
$email = $_POST['email'];
}
$process_form = true;
}
if ($process_form == true) {
if ($user = $dbManager->get_user_by_id_if_password_is_correct($user_id, $old_password)) {
$dbManager->update_user_info($user->getId(), $name, $new_password, $email);
if ($_SESSION['username'] == $user->getName()) {
login($name, $new_password);
}
$message[] = new Message("User info changed successfully.", Message::SUCCESS);
$smarty->assign('message', $message);
$smarty->assign('title', 'Index page');
set_redirect_header("index.php");
$smarty->display('index.tpl');
} else {
$message[] = new Message("Cannot change user info. Try again please.", Message::WARNING);
$user = $dbManager->get_user_by_id($user_id);
$user->setPassword(null);
$smarty->assign('user', $user);
$smarty->assign('message', $message);