本文整理汇总了PHP中DBModel::existUser方法的典型用法代码示例。如果您正苦于以下问题:PHP DBModel::existUser方法的具体用法?PHP DBModel::existUser怎么用?PHP DBModel::existUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBModel
的用法示例。
在下文中一共展示了DBModel::existUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($year)
{
if (!isset($year)) {
$year = ContestModel::getCurrentYear();
}
$this->year = $year;
$cond['id'] = $year;
if (!DBModel::existUser('cernet_contest', $cond)) {
DBModel::insertDB('cernet_contest', $cond);
}
}
示例2: password_
public function password_()
{
eval(USER);
try {
$cond['username'] = session('username');
$cond['password'] = bassert($this, safepost('old_password'), Error('post'));
$data['password'] = bassert($this, safepost('new_password'), Error('post'));
$cond['password'] = encrypt($cond['password']);
$data['password'] = encrypt($data['password']);
$model = D('cernet_user');
if (DBModel::existUser('cernet_user', $cond)) {
DBModel::updateDB('cernet_user', $cond, $data);
} else {
$this->assign('jumpUrl', lastpage());
$this->error(Error('password'));
}
$this->success(Success('password', '__ROOT__'));
} catch (Exception $e) {
$this->error($e->getMessage(), lastpage());
}
}
示例3: nopassword_
/**
* Password find back handle function.
* Usertype: Student
*/
public function nopassword_()
{
try {
require 'powerdream/Common/Mail.class.php';
$cond['email'] = xassert(safepost('email'), Error('post'));
$random = rand(0, 100) . ' This is a salt.';
$pwd = substr(encrypt($random), 0, 8);
$data['password'] = encrypt($pwd);
if (!DBModel::existUser('cernet_user', $cond)) {
$this->error(Error('email'), lastpage());
} else {
DBModel::updateDB('cernet_user', $cond, $data);
$user = DBModel::selectDB('cernet_user', $cond);
$user = $user[0];
$mailto = $cond['email'];
$replace['[#password]'] = $pwd;
$replace['[#username]'] = $user['username'];
$content = Mail::contentTemplate('nopassword');
Mail::autosend($mailto, $content, $replace);
$this->success(Success('nopassword'), '__ROOT__');
}
} catch (Exception $e) {
bassert($this, false, $e->getMessage());
}
}
示例4: login_
public function login_()
{
try {
$cond["id"] = xassert(safepost("id"), Error("post"));
$pwd = xassert(safepost("password"), Error("post"));
$cond["password"] = $pwd;
if (!DBModel::existUser("admin_user", $cond)) {
throw new Exception(Error("login"));
}
session("usertype", "admin");
session("userid", $cond["id"]);
session("username", getNameById("admin_user", $cond["id"]));
// dump($_SESSION);
$config = C('TMPL_PARSE_STRING');
$root = $config['__ROOT__'];
header("Location: {$root}/Admin/index");
} catch (Exception $e) {
$this->assign('waitSecond', 3);
$this->error($e->getMessage(), lastpage());
}
}