本文整理匯總了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');