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


PHP Validate::checkNull方法代碼示例

本文整理匯總了PHP中Validate::checkNull方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validate::checkNull方法的具體用法?PHP Validate::checkNull怎麽用?PHP Validate::checkNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Validate的用法示例。


在下文中一共展示了Validate::checkNull方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: check_data

 private function check_data()
 {
     import("@.Tool.Validate");
     //驗證類
     //數據驗證
     if (Validate::checkNull($_POST['name']) || Validate::checkNull($_POST['content'])) {
         $this->error('請輸入對應內容');
     }
 }
開發者ID:cyndiWade,項目名稱:xintuo,代碼行數:9,代碼來源:NewsAction.class.php

示例4: index

 public function index()
 {
     if (!empty($this->oUser)) {
         $this->redirect('/User/user_list');
     }
     if ($this->isPost()) {
         $Users = D('Users');
         //用戶表模型
         import("@.Tool.Validate");
         //驗證類
         $account = $_POST['account'];
         //用戶賬號
         $password = $_POST['password'];
         //用戶密碼
         //數據過濾
         if (Validate::checkNull($account)) {
             $this->error('賬號不得為空');
         }
         if (Validate::checkNull($password)) {
             $this->error('密碼不得為空');
         }
         if (!Validate::check_string_num($account)) {
             $this->error('賬號密碼隻能輸入英文或數字');
         }
         //讀取用戶數據
         $user_info = $Users->get_user_info(array('account' => $account, 'type' => 0, 'status' => 0));
         //驗證用戶數據
         if (empty($user_info)) {
             $this->error('此用戶不存在!');
         } else {
             if (md5($password) != $user_info['password']) {
                 $this->error('密碼錯誤!');
             } else {
                 $tme_arr = array('id' => $user_info['id'], 'account' => $user_info['account'], 'name' => $user_info['name']);
                 $_SESSION['user_info'] = (object) $tme_arr;
                 //保存用戶信息
                 //更新用戶信息
                 $Users->up_login_info($user_info['id']);
                 $this->redirect('/System/index');
             }
         }
     }
     $this->display();
 }
開發者ID:cyndiWade,項目名稱:xintuo,代碼行數:44,代碼來源:LoginAction.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: reg

 private function reg()
 {
     if (isset($_POST['send'])) {
         parent::__construct($this->_tpl, new UserModel());
         if (Validate::checkNull($_POST['user'])) {
             Tool::alertBack('empty username');
         }
         if (Validate::checkLength($_POST['user'], 2, 'min')) {
             Tool::alertBack('username less than 2');
         }
         if (Validate::checkLength($_POST['user'], 20, 'max')) {
             Tool::alertBack('username more than 20');
         }
         if (Validate::checkLength($_POST['pass'], 6, 'min')) {
             Tool::alertBack('password less than 6');
         }
         $this->_model->user = $_POST['user'];
         $this->_model->pass = md5($_POST['pass']);
         $this->_model->email = $_POST['email'];
         $this->_model->face = $_POST['face'];
         $this->_model->state = 1;
         $this->_model->time = time();
         $this->_model->question = $_POST['question'];
         $this->_model->answer = $_POST['answer'];
         if ($this->_model->checkUser()) {
             Tool::alertBack('duplicate username');
         }
         if ($this->_model->checkEmail()) {
             Tool::alertBack('duplicate email address');
         }
         if ($this->_model->addUser()) {
             $_cookie = new Cookie('user', $this->_model->user, 0);
             $_cookie->setCookie();
             $_cookie = new Cookie('face', $this->_model->face, 0);
             $_cookie->setCookie();
             Tool::alertLocation('succeed', './');
         } else {
             Tool::alertBack('fail');
         }
     }
     $this->_tpl->assign('reg', true);
     $this->_tpl->assign('OptionFaceOne', range(1, 9));
     $this->_tpl->assign('OptionFaceTwo', range(10, 24));
 }
開發者ID:e0zhao02,項目名稱:sample_code,代碼行數:44,代碼來源:RegisterAction.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('警告:評論內容不得為空!');
             }
             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

示例8: add_question

 public function add_question()
 {
     if ($this->isPost()) {
         import("@.Tool.Validate");
         //驗證類
         $content = $_POST['content'];
         //提問內容
         //數據驗證
         if (Validate::checkNull($content)) {
             parent::callback(C('STATUS_OTHER'), '提問內容不得為空');
         }
         $Question = D('Question');
         $Question->content = $content;
         $Question->user_id = $this->oUser->id;
         $Question->time = time();
         $Question->add() ? parent::callback(C('STATUS_SUCCESS'), '提交成功,我們會盡快回複您。') : parent::callback(C('STATUS_UPDATE_DATA'), '提交失敗,請重新嘗試');
     }
     //$this->display('Login:add_question');
 }
開發者ID:cyndiWade,項目名稱:xintuo,代碼行數:19,代碼來源:ApiQuestionAction.class.php

示例9: 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

示例10: 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

示例11: update

 private function update()
 {
     if (isset($_POST['send'])) {
         if (Validate::checkNull($_POST['level_name'])) {
             Tool::alertBack('警告:等級名稱不得為空!');
         }
         if (Validate::checkLength($_POST['level_name'], 2, 'min')) {
             Tool::alertBack('警告:等級名稱不得小於兩位!');
         }
         if (Validate::checkLength($_POST['level_name'], 20, 'max')) {
             Tool::alertBack('警告:等級名稱不得大於20位!');
         }
         if (Validate::checkLength($_POST['level_info'], 200, 'max')) {
             Tool::alertBack('警告:等級描述不得大於200位!');
         }
         $this->_model->id = $_POST['id'];
         $this->_model->level_name = $_POST['level_name'];
         $this->_model->level_info = $_POST['level_info'];
         $this->_model->premission = implode(',', $_POST['premission']);
         $this->_model->updateLevel() ? Tool::alertLocation('恭喜你,修改等級成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,修改等級失敗!');
     }
     if (isset($_GET['id'])) {
         $_premission = new PremissionModel();
         $this->_tpl->assign('AllPremission', $_premission->getAllPremission());
         $this->_model->id = $_GET['id'];
         $_level = $this->_model->getOneLevel();
         is_object($_level) ? true : Tool::alertBack('等級傳值的id有誤!');
         $this->_tpl->assign('id', $_level->id);
         $this->_tpl->assign('level_name', $_level->level_name);
         $this->_tpl->assign('level_info', $_level->level_info);
         $this->_tpl->assign('prev_url', PREV_URL);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', '修改等級');
     } else {
         Tool::alertBack('非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:37,代碼來源:LevelAction.class.php

示例12: update

 private function update()
 {
     if (isset($_POST['send'])) {
         if (Validate::checkNull($_POST['name'])) {
             Tool::alertBack('警告:權限名稱不得為空!');
         }
         if (Validate::checkLength($_POST['name'], 2, 'min')) {
             Tool::alertBack('警告:權限名稱不得小於兩位!');
         }
         if (Validate::checkLength($_POST['name'], 100, 'max')) {
             Tool::alertBack('警告:權限名稱不得大於100位!');
         }
         if (Validate::checkLength($_POST['info'], 200, 'max')) {
             Tool::alertBack('警告:權限描述不得大於200位!');
         }
         $this->_model->id = $_POST['id'];
         $this->_model->name = $_POST['name'];
         $this->_model->info = $_POST['info'];
         $this->_model->updatePremission() ? Tool::alertLocation('恭喜你,修改權限成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,修改權限失敗!');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         $_premission = $this->_model->getOnePremission();
         if (!$_premission) {
             Tool::alertBack('警告:不存在此權限!');
         }
         $this->_tpl->assign('id', $_premission->id);
         $this->_tpl->assign('name', $_premission->name);
         $this->_tpl->assign('info', $_premission->info);
         $this->_tpl->assign('prev_url', PREV_URL);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', '修改權限');
     } else {
         Tool::alertBack('非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:36,代碼來源:PremissionAction.class.php

示例13: 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

示例14: update

 private function update()
 {
     if (isset($_POST['send'])) {
         if (Validate::checkNull($_POST['thumbnail'])) {
             Tool::alertBack('警告:輪播圖不得為空!');
         }
         if (Validate::checkNull($_POST['link'])) {
             Tool::alertBack('警告:鏈接不得為空!');
         }
         if (Validate::checkLength($_POST['title'], 20, 'max')) {
             Tool::alertBack('警告:標題不得大於20位!');
         }
         if (Validate::checkLength($_POST['info'], 200, 'max')) {
             Tool::alertBack('警告:簡介不得大於200位!');
         }
         $this->_model->id = $_POST['id'];
         $this->_model->link = $_POST['link'];
         $this->_model->thumbnail = $_POST['thumbnail'];
         $this->_model->info = $_POST['info'];
         $this->_model->title = $_POST['title'];
         $this->_model->state = $_POST['state'];
         $this->_model->updateRotatain() ? Tool::alertLocation('恭喜你,輪播器修改成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,輪播器修改失敗');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         $_rotatain = $this->_model->getOneRotatain();
         if (!$_rotatain) {
             Tool::alertBack('警告:不存在此輪播');
         }
         $this->_tpl->assign('id', $_rotatain->id);
         $this->_tpl->assign('titlec', $_rotatain->title);
         $this->_tpl->assign('thumbnail', $_rotatain->thumbnail);
         $this->_tpl->assign('info', $_rotatain->info);
         $this->_tpl->assign('link', $_rotatain->link);
         $this->_tpl->assign('prev_url', PREV_URL);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', '修改輪播器');
         if (empty($_rotatain->state)) {
             $this->_tpl->assign('right_state', 'checked="checked"');
         } else {
             $this->_tpl->assign('left_state', 'checked="checked"');
         }
     } else {
         Tool::alertBack('非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:46,代碼來源:RotatainAction.class.php

示例15: check_data

 private function check_data()
 {
     import("@.Tool.Validate");
     //驗證類
     //數據驗證
     if (Validate::checkNull($_POST['product_id'])) {
         $this->error('請選擇理財產品');
     }
 }
開發者ID:cyndiWade,項目名稱:xintuo,代碼行數:9,代碼來源:AdvertisementAction.class.php


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