本文整理汇总了PHP中DbManager::is_user_in_database方法的典型用法代码示例。如果您正苦于以下问题:PHP DbManager::is_user_in_database方法的具体用法?PHP DbManager::is_user_in_database怎么用?PHP DbManager::is_user_in_database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbManager
的用法示例。
在下文中一共展示了DbManager::is_user_in_database方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DbManager
include_once 'utils/include_smarty.php';
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'POST') {
$process_form = false;
$name = null;
$password = null;
$email = null;
if (isset($_POST['name'], $_POST['password'])) {
$name = $_POST['name'];
$password = $_POST['password'];
$email = $_POST['email'];
$process_form = true;
}
if ($process_form == true) {
$dbManager = new DbManager();
if ($dbManager->is_user_in_database($name)) {
$message[] = new Message("User with such name already exists", Message::INFO);
$smarty->assign('message', $message);
$smarty->display('create_user.tpl');
} else {
$dbManager->add_user($name, $password, $email);
$message[] = new Message("You have successfully created new user", Message::SUCCESS);
$smarty->assign('message', $message);
$smarty->assign('title', 'Index page');
set_redirect_header("index.php");
$smarty->display('index.tpl');
}
}
} else {
$smarty->assign('title', 'Create user');
$smarty->display('create_user.tpl');