本文整理汇总了PHP中Validate::checkEquals方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::checkEquals方法的具体用法?PHP Validate::checkEquals怎么用?PHP Validate::checkEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validate
的用法示例。
在下文中一共展示了Validate::checkEquals方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
private function add()
{
if (isset($_POST['send'])) {
if (Validate::checkNull($_POST['admin_user'])) {
Tool::alertBack('警告:用户名不得为空!');
}
if (Validate::checkLength($_POST['admin_user'], 2, 'min')) {
Tool::alertBack('警告:用户名不得小于两位!');
}
if (Validate::checkLength($_POST['admin_user'], 20, 'max')) {
Tool::alertBack('警告:用户名不得大于20位!');
}
if (Validate::checkNull($_POST['admin_pass'])) {
Tool::alertBack('警告:密码不得为空!');
}
if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
Tool::alertBack('警告:密码不得小于六位!');
}
if (Validate::checkEquals($_POST['admin_pass'], $_POST['admin_notpass'])) {
Tool::alertBack('警告:密码和密码确认必须一致!');
}
$this->_model->admin_user = $_POST['admin_user'];
if ($this->_model->getOneManage()) {
Tool::alertBack('警告:此用户已被占用!');
}
$this->_model->admin_pass = sha1($_POST['admin_pass']);
$this->_model->level = $_POST['level'];
$this->_model->addManage() ? Tool::alertLocation('恭喜你,新增管理员成功!', 'manage.php?action=show') : Tool::alertBack('很遗憾,新增管理员失败!');
}
$this->_tpl->assign('add', true);
$this->_tpl->assign('title', '新增管理员');
$this->_tpl->assign('prev_url', PREV_URL);
$_level = new LevelModel();
$this->_tpl->assign('AllLevel', $_level->getAllLevel());
}
示例2: add
private function add()
{
if (isset($_POST['send'])) {
if (Validate::checkNull($_POST['admin_user'])) {
Tool::alertBack('username empty');
}
if (Validate::checkLength($_POST['admin_user'], 2, 'min')) {
Tool::alertBack('username less than 2');
}
if (Validate::checkLength($_POST['admin_user'], 20, 'max')) {
Tool::alertBack('username more than 20');
}
if (Validate::checkNull($_POST['admin_pass'])) {
Tool::alertBack('password empty');
}
if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
Tool::alertBack('password less than 6');
}
if (Validate::checkEquals($_POST['admin_pass'], $_POST['admin_notpass'])) {
Tool::alertBack('password not match');
}
$this->_model->admin_user = $_POST['admin_user'];
if ($this->_model->getOneManage()) {
Tool::alertBack('this username registered already');
}
$this->_model->admin_pass = md5($_POST['admin_pass']);
$this->_model->level = $_POST['level'];
$this->_model->addManage() ? Tool::alertLocation('Succeed', 'manage.php?action=show') : Tool::alertBack('Fail');
}
$this->_tpl->assign('add', true);
$this->_tpl->assign('title', 'Add New Administrator');
$this->_tpl->assign('prev_url', PREV_URL);
$_level = new LevelModel();
$this->_tpl->assign('AllLevel', $_level->getAllLevel());
}
示例3: add
private function add()
{
if (isset($_POST['send'])) {
if (Validate::checkNull($_POST['user'])) {
Tool::alertBack('警告:用户名不得为空!');
}
if (Validate::checkLength($_POST['user'], 2, 'min')) {
Tool::alertBack('警告:用户名长度不得小于两位!');
}
if (Validate::checkLength($_POST['user'], 20, 'max')) {
Tool::alertBack('警告:用户名长度不得大于二十位!');
}
if (Validate::checkLength($_POST['pass'], 6, 'min')) {
Tool::alertBack('警告:密码不得小于六位!');
}
if (Validate::checkEquals($_POST['pass'], $_POST['notpass'])) {
Tool::alertBack('警告:密码和确认密码不一致!');
}
if (Validate::checkNull($_POST['email'])) {
Tool::alertBack('警告:电子邮件不得为空!');
}
if (Validate::checkEmail($_POST['email'])) {
Tool::alertBack('警告:电子邮件格式不正确!');
}
if (!Validate::checkNull($_POST['question']) && !Validate::checkNull($_POST['answer'])) {
$this->_model->question = $_POST['question'];
$this->_model->answer = $_POST['answer'];
}
$this->_model->user = $_POST['user'];
$this->_model->pass = sha1($_POST['pass']);
$this->_model->email = $_POST['email'];
$this->_model->face = $_POST['face'];
$this->_model->state = $_POST['state'];
if ($this->_model->checkUser()) {
Tool::alertBack('警告:用户名重复!');
}
if ($this->_model->checkEmail()) {
Tool::alertBack('警告:邮件重复!');
}
if ($this->_model->addUser()) {
Tool::alertLocation('恭喜你,注册成功!', 'user.php?action=show');
} else {
Tool::alertBack('很遗憾,注册失败!');
}
}
$this->_tpl->assign('add', true);
$this->_tpl->assign('title', '新增会员');
$this->_tpl->assign('prev_url', PREV_URL);
$this->_tpl->assign('OptionFaceOne', range(1, 9));
$this->_tpl->assign('OptionFaceTwo', range(10, 24));
}
示例4: addComment
private function addComment()
{
if (isset($_POST['send'])) {
$_url = 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
if ($_url == PREV_URL) {
if (Validate::checkNull($_POST['content'])) {
Tool::alertBack('警告:评论内容不得为空!');
}
if (Validate::checkLength($_POST['content'], 255, 'max')) {
Tool::alertBack('警告:评论内容长度不得大于255位!');
}
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('警告:验证码必须是四位!');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('警告:验证码不正确!');
}
} else {
if (Validate::checkNull($_POST['content'])) {
Tool::alertClose('警告:评论内容不得为空!');
}
if (Validate::checkLength($_POST['content'], 255, 'max')) {
Tool::alertClose('警告:评论内容长度不得大于255位!');
}
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertClose('警告:验证码必须是四位!');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertClose('警告:验证码不正确!');
}
}
parent::__construct($this->_tpl, new CommentModel());
$_cookie = new Cookie('user');
if ($_cookie->getCookie()) {
$this->_model->user = $_cookie->getCookie();
} else {
$this->_model->user = '游客';
}
$this->_model->manner = $_POST['manner'];
$this->_model->content = $_POST['content'];
$this->_model->cid = $_GET['cid'];
$this->_model->addComment() ? Tool::alertLocation('评论添加成功,请等待管理员审核!', 'feedback.php?cid=' . $this->_model->cid) : Tool::alertLocation('评论添加失败,请重新添加!', 'feedback.php?cid=' . $this->_model->cid);
}
}
示例5: login
private function login()
{
if (isset($_POST['send'])) {
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('警告:验证码必须是四位!');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('警告:验证码不正确!');
}
if (Validate::checkNull($_POST['admin_user'])) {
Tool::alertBack('警告:用户名不得为空!');
}
if (Validate::checkLength($_POST['admin_user'], 2, 'min')) {
Tool::alertBack('警告:用户名不得小于两位!');
}
if (Validate::checkLength($_POST['admin_user'], 20, 'max')) {
Tool::alertBack('警告:用户名不得大于20位!');
}
if (Validate::checkNull($_POST['admin_pass'])) {
Tool::alertBack('警告:密码不得为空!');
}
if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
Tool::alertBack('警告:密码不得小于六位!');
}
$this->_model->admin_user = $_POST['admin_user'];
$this->_model->admin_pass = sha1($_POST['admin_pass']);
$this->_model->last_ip = $_SERVER["REMOTE_ADDR"];
$_login = $this->_model->getLoginManage();
if ($_login) {
$_preArr = explode(',', $_login->premission);
if (in_array('1', $_preArr)) {
$_SESSION['admin']['admin_user'] = $_login->admin_user;
$_SESSION['admin']['level_name'] = $_login->level_name;
$_SESSION['admin']['premission'] = $_preArr;
$this->_model->setLoginCount();
Tool::alertLocation(null, 'admin.php');
} else {
Tool::alertBack('警告:权限不够,您无法登录!');
}
} else {
Tool::alertBack('警告:用户名或密码错误!');
}
}
}
示例6: frontadd
private function frontadd()
{
if (isset($_POST['send'])) {
if (Validate::checkNull($_POST['webname'])) {
Tool::alertBack('警告:网站名称不得为空!');
}
if (Validate::checkLength($_POST['webname'], 20, 'max')) {
Tool::alertBack('警告:网站名称不得大于二十位!');
}
if (Validate::checkNull($_POST['weburl'])) {
Tool::alertBack('警告:网站地址不得为空!');
}
if (Validate::checkLength($_POST['webname'], 100, 'max')) {
Tool::alertBack('警告:网站地址不得大于一百位!');
}
if ($_POST['type'] == 2) {
if (Validate::checkNull($_POST['logourl'])) {
Tool::alertBack('警告:Logo地址不得为空!');
}
if (Validate::checkLength($_POST['logourl'], 100, 'max')) {
Tool::alertBack('警告:Logo地址不得大于一百位!');
}
}
if (Validate::checkLength($_POST['user'], 20, 'max')) {
Tool::alertBack('警告:站长名不得大于二十位!');
}
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('警告:验证码必须是四位!');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('警告:验证码不正确!');
}
$this->_model->webname = $_POST['webname'];
$this->_model->weburl = $_POST['weburl'];
$this->_model->logourl = $_POST['logourl'];
$this->_model->user = $_POST['user'];
$this->_model->type = $_POST['type'];
$this->_model->state = $_POST['state'];
$this->_model->addLink() ? Tool::alertClose('恭喜,申请友情链接成功!请等待管理员审核!') : Tool::alertBack('很遗憾,申请友情链接失败,请重试!');
}
$this->_tpl->assign('frontadd', true);
}
示例7: addComment
private function addComment()
{
if (isset($_POST['send'])) {
$_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
if ($_url == PREV_URL) {
if (Validate::checkNull($_POST['content'])) {
Tool::alertBack('content empty');
}
if (Validate::checkLength($_POST['content'], 255, 'max')) {
Tool::alertBack('content longer than 255');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('validate code must match');
}
} else {
if (Validate::checkNull($_POST['content'])) {
Tool::alertClose('content empty');
}
if (Validate::checkLength($_POST['content'], 255, 'max')) {
Tool::alertClose('content longer than 255');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertClose('validate code must match');
}
}
parent::__construct($this->_tpl, new CommentModel());
$_cookie = new Cookie('user');
if ($_cookie->getCookie()) {
$this->_model->user = $_cookie->getCookie();
} else {
$this->_model->user = 'Guest';
}
$this->_model->manner = $_POST['manner'];
$this->_model->content = $_POST['content'];
$this->_model->cid = $_GET['cid'];
$this->_model->addComment() ? Tool::alertLocation('succeed', 'feedback.php?cid=' . $this->_model->cid) : Tool::alertLocation('failed', 'feedback.php?cid=' . $this->_model->cid);
}
}
示例8: login
public function login()
{
if (isset($_POST['send'])) {
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('validation code must be 4');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('wrong validation code');
}
if (Validate::checkNull($_POST['admin_user'])) {
Tool::alertBack('username empty');
}
if (Validate::checkLength($_POST['admin_user'], 2, 'min')) {
Tool::alertBack('username less than 2');
}
if (Validate::checkLength($_POST['admin_user'], 20, 'max')) {
Tool::alertBack('username more than 20');
}
if (Validate::checkNull($_POST['admin_pass'])) {
Tool::alertBack('password empty');
}
if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
Tool::alertBack('password less than 6');
}
$this->_model->admin_user = $_POST['admin_user'];
$this->_model->admin_pass = md5($_POST['admin_pass']);
$_login = $this->_model->getLoginManage();
if ($_login) {
$_SESSION['admin']['admin_user'] = $_login->admin_user;
$_SESSION['admin']['level_name'] = $_login->level_name;
Tool::alertLocation(null, 'admin.php');
} else {
Tool::alertBack('username or password not right');
}
}
}
示例9: login
public function login()
{
if (isset($_POST['send'])) {
parent::__construct($this->_tpl, new UserModel());
if (Validate::checkNull($_POST['user'])) {
Tool::alertBack('警告:用户名不得为空!');
}
if (Validate::checkLength($_POST['user'], 2, 'min')) {
Tool::alertBack('警告:用户名长度不得小于两位!');
}
if (Validate::checkLength($_POST['user'], 20, 'max')) {
Tool::alertBack('警告:用户名长度不得大于二十位!');
}
if (Validate::checkLength($_POST['pass'], 6, 'min')) {
Tool::alertBack('警告:密码不得小于六位!');
}
if (Validate::checkLength($_POST['code'], 4, 'equals')) {
Tool::alertBack('警告:验证码必须是四位!');
}
if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
Tool::alertBack('警告:验证码不正确!');
}
$this->_model->user = $_POST['user'];
$this->_model->pass = sha1($_POST['pass']);
if (!!($_user = $this->_model->checkLogin())) {
$_cookie = new Cookie('user', $_user->user, $_POST['time']);
$_cookie->setCookie();
$_cookie = new Cookie('face', $_user->face, $_POST['time']);
$_cookie->setCookie();
$this->_model->id = $_user->id;
$this->_model->time = time();
$this->_model->setLaterUser();
Tool::alertLocation(null, './');
} else {
Tool::alertBack('警告:用户名或密码错误!');
}
}
$this->_tpl->assign('login', true);
}
示例10: check_data
private function check_data()
{
import("@.Tool.Validate");
//验证类
//数据验证
if (!Validate::checkNull($_POST['password_one']) || !Validate::checkNull($_POST['password_two'])) {
if (!Validate::checkEquals($_POST['password_one'], $_POST['password_two'])) {
$this->error('二次输入的密码不同');
}
}
if (!empty($_POST['email'])) {
if (!Validate::checkemail($_POST['email'])) {
$this->error('电子邮箱格式错误');
}
}
if (!empty($_POST['identity'])) {
//342401199201208174
if (!Validate::check_identity($_POST['identity'])) {
$this->error('证件格式错误');
}
}
}