當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validate::checkEquals方法代碼示例

本文整理匯總了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());
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:35,代碼來源:ManageAction.class.php

示例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());
 }
開發者ID:e0zhao02,項目名稱:sample_code,代碼行數:35,代碼來源:ManageAction.class.php

示例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));
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:51,代碼來源:UserAction.class.php

示例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);
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:44,代碼來源:FeedBackAction.class.php

示例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('警告:用戶名或密碼錯誤!');
         }
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:44,代碼來源:LoginAction.class.php

示例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);
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:42,代碼來源:FriendLinkAction.class.php

示例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);
     }
 }
開發者ID:e0zhao02,項目名稱:sample_code,代碼行數:38,代碼來源:FeedBackAction.class.php

示例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');
         }
     }
 }
開發者ID:e0zhao02,項目名稱:sample_code,代碼行數:36,代碼來源:LoginAction.class.php

示例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);
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:39,代碼來源:RegisterAction.class.php

示例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('證件格式錯誤');
         }
     }
 }
開發者ID:cyndiWade,項目名稱:xintuo,代碼行數:22,代碼來源:UserAction.class.php


注:本文中的Validate::checkEquals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。