本文整理汇总了PHP中PageModel::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::insert方法的具体用法?PHP PageModel::insert怎么用?PHP PageModel::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: regsAction
public function regsAction()
{
$model = new PageModel();
if (isPost()) {
$regCode = $model->getRegCode(post('code'));
if ($regCode->id or true) {
// TODO забрати "OR true"
$data['nickname'] = post('nickname');
if (checkLenght(post('nickname'), 3, 16) && !$model->getUserByNickname(post('nickname'))) {
$data['nickname'] = post('nickname');
} else {
$this->view->error = 'Incorrect "Nickname" or exist';
}
if (checkEmail(post('email')) && !$model->getUserByEmail(post('email'))) {
$data['email'] = post('email');
} else {
$this->view->error = 'Incorrect "E-mail" or exist';
}
if (checkLenght(post('password'), 6, 20)) {
$data['password'] = md5(post('password'));
} else {
$this->view->error = 'Incorrect "Password"';
}
if (checkLenght(post('password_re'), 6, 20)) {
if (post('password') != post('password_re')) {
$this->view->error = 'Passwords do not match';
}
} else {
$this->view->error = 'Incorrect "Repeat password"';
}
if (post('rules') != 'yes') {
$this->view->error = 'You must agree to Rules';
}
if (post('terms') != 'yes') {
$this->view->error = 'You must accept Terms and Conditions';
}
//$data['referral'] = $regCode->uid; // TODO ref system
$data['dateLast'] = time();
$data['dateReg'] = time();
if (!$this->view->error) {
$uid = $model->insert('users', $data);
if ($uid) {
setSession('user', $uid, false);
//$model->deleteRegCode($regCode->id);
redirect(url($uid));
} else {
$this->view->error = 'Error Registration';
}
}
} else {
$this->view->error = 'Incorrect "Registration code"';
}
}
$code = Request::getUriOptions()[0];
if ($code) {
$_POST['code'] = $code;
}
$this->view->title = Lang::translate('REG_TITLE');
}