本文整理匯總了PHP中models\User::countUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::countUser方法的具體用法?PHP User::countUser怎麽用?PHP User::countUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::countUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loggedIn
public function loggedIn()
{
$req = $this->app->request();
foreach (User::showUserByEmail($req->post('email')) as $row) {
$stored_email = $row['u_email'];
$stored_user_id = $row['user_id'];
$stored_level = $row['level'];
$stored_password = $row['u_password'];
}
if (User::countUser($req->post('email'))->fetchColumn() == 1 && Bcrypt::check($req->post('password'), $stored_password) === true) {
$_SESSION['emailAdmin'] = $stored_email;
$_SESSION['idAdmin'] = $stored_user_id;
$_SESSION['levelAdmin'] = $stored_level;
parent::redirectTo('indexAdmin');
} else {
$this->app->flash('error', "Email or Password doesn't match");
$this->app->flash('tmpEmail', $req->post('email'));
parent::redirectTo('loginAdmin');
}
}
示例2: flashAny
public function flashAny($init, $id = null)
{
$req = $this->app->request();
self::$errors = array();
$idData = explode('/', $_SERVER['REQUEST_URI']);
$idAny = end($idData);
if (filter_var($idAny, FILTER_VALIDATE_INT) === false) {
if (User::countUser($req->post('email'))->fetchColumn() == 1) {
self::$errors[] = 'Email sudah terdaftar';
}
}
if (count(self::$errors) > 0) {
$this->app->flash('errors', self::$errors);
$this->app->flash('tmpEmail', self::$tmpEmail);
if ($init == 'add') {
parent::redirectTo('addUser');
} else {
self::$url = $this->app->urlFor('editUser', array('id' => $id));
$this->app->redirect(self::$url);
}
}
}