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


PHP Validate::checkLength方法代碼示例

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


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

示例1: update

 private function update()
 {
     if (isset($_POST['send'])) {
         $this->_model->id = $_POST['id'];
         if (trim($_POST['admin_pass']) == '') {
             $this->_model->admin_pass = $_POST['pass'];
         } else {
             if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
                 Tool::alertBack('password less than 6');
             }
             $this->_model->admin_pass = md5($_POST['admin_pass']);
         }
         $this->_model->level = $_POST['level'];
         $this->_model->updateManage() ? Tool::alertLocation('Succeed', $_POST['prev_url']) : Tool::alertBack('You did not make any change. please click return to list');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         is_object($this->_model->getOneManage()) ? true : Tool::alertBack('wrong id');
         $this->_tpl->assign('id', $this->_model->getOneManage()->id);
         $this->_tpl->assign('level', $this->_model->getOneManage()->level);
         $this->_tpl->assign('admin_user', $this->_model->getOneManage()->admin_user);
         $this->_tpl->assign('admin_pass', $this->_model->getOneManage()->admin_pass);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', 'Update Existing Administrator');
         $this->_tpl->assign('prev_url', PREV_URL);
         $_level = new LevelModel();
         $this->_tpl->assign('AllLevel', $_level->getAllLevel());
     } else {
         Tool::alertBack('illegal act');
     }
 }
開發者ID:e0zhao02,項目名稱:sample_code,代碼行數:31,代碼來源:ManageAction.class.php

示例2: update

 private function update()
 {
     if (isset($_POST['send'])) {
         $this->_model->id = $_POST['id'];
         if (trim($_POST['admin_pass']) == '') {
             $this->_model->admin_pass = $_POST['pass'];
         } else {
             if (Validate::checkLength($_POST['admin_pass'], 6, 'min')) {
                 Tool::alertBack('警告:密碼不得小於六位!');
             }
             $this->_model->admin_pass = sha1($_POST['admin_pass']);
         }
         $this->_model->level = $_POST['level'];
         $this->_model->updateManage() ? Tool::alertLocation('恭喜你,修改管理員成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,修改管理員失敗!');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         $_manage = $this->_model->getOneManage();
         is_object($_manage) ? true : Tool::alertBack('管理員傳值的id有誤!');
         $this->_tpl->assign('id', $_manage->id);
         $this->_tpl->assign('level', $_manage->level);
         $this->_tpl->assign('admin_user', $_manage->admin_user);
         $this->_tpl->assign('admin_pass', $_manage->admin_pass);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', '修改管理員');
         $this->_tpl->assign('prev_url', PREV_URL);
         $_level = new LevelModel();
         $this->_tpl->assign('AllLevel', $_level->getAllLevel());
     } else {
         Tool::alertBack('非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:32,代碼來源:ManageAction.class.php

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

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

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

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

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

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

示例11: setAdd

 private function setAdd()
 {
     if (Validate::checkNull($_POST['title'])) {
         Tool::alertBack('警告:標題不得為空!');
     }
     if (Validate::checkLength($_POST['title'], 2, 'min')) {
         Tool::alertBack('警告:標題不得小於兩位!');
     }
     if (Validate::checkLength($_POST['title'], 20, 'max')) {
         Tool::alertBack('警告:標題不得大於20位!');
     }
     if (Validate::checkLength($_POST['info'], 200, 'max')) {
         Tool::alertBack('警告:描述不得大於200位!');
     }
     $this->_model->title = $_POST['title'];
     $this->_model->info = $_POST['info'];
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:17,代碼來源:VoteAction.class.php

示例12: update

 private function update()
 {
     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('警告:站長名不得大於二十位!');
         }
         $this->_model->id = $_POST['id'];
         $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->updateLink() ? Tool::alertLocation('恭喜,修改友情鏈接成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,修改友情鏈接失敗,請重試!');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         $_link = $this->_model->getOneLink();
         if (!$_link) {
             Tool::alertBack('警告:不存在此鏈接!');
         }
         $this->_tpl->assign('id', $_link->id);
         $this->_tpl->assign('webname', $_link->webname);
         $this->_tpl->assign('weburl', $_link->weburl);
         $this->_tpl->assign('logourl', $_link->logourl);
         $this->_tpl->assign('user', $_link->user);
         $this->_tpl->assign('state', $_link->state);
         if ($_link->type == 1) {
             $this->_tpl->assign('text_type', 'checked="checkecd"');
             $this->_tpl->assign('logo', 'display:none');
         } elseif ($_link->type == 2) {
             $this->_tpl->assign('logo_type', 'checked="checkecd"');
             $this->_tpl->assign('logo', 'display:block');
         }
         $this->_tpl->assign('prev_url', PREV_URL);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', '修改等級');
     } else {
         Tool::alertBack('非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:61,代碼來源:LinkAction.class.php

示例13: update

 private function update()
 {
     if (isset($_POST['send'])) {
         if (Validate::checkNull($_POST['title'])) {
             Tool::alertBack('警告:標題不得為空!');
         }
         if (Validate::checkLength($_POST['title'], 2, 'min')) {
             Tool::alertBack('警告:標題長度不得小於兩位!');
         }
         if (Validate::checkLength($_POST['title'], 20, 'max')) {
             Tool::alertBack('警告:標題長度不得大於二十位!');
         }
         if (Validate::checkNull($_POST['link'])) {
             Tool::alertBack('警告:鏈接不得為空!');
         }
         if ($_POST['type'] == '2' || $_POST['type'] == '3') {
             if (Validate::checkNull($_POST['thumbnail'])) {
                 Tool::alertBack('警告:廣告圖片不得為空!');
             }
         }
         if (Validate::checkLength($_POST['info'], 200, 'max')) {
             Tool::alertBack('警告:描述長度不得大於兩百位!');
         }
         $this->_model->id = $_POST['id'];
         $this->_model->title = $_POST['title'];
         $this->_model->type = $_POST['type'];
         $this->_model->thumbnail = $_POST['thumbnail'];
         $this->_model->link = $_POST['link'];
         $this->_model->info = $_POST['info'];
         $this->_model->state = $_POST['state'];
         $this->_model->updateAdver() ? Tool::alertLocation('恭喜,修改廣告成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,修改廣告失敗!');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         $_adver = $this->_model->getOneAdver();
         if (!$_adver) {
             Tool::alertBack('警告:不存在此廣告!');
         }
         $this->_tpl->assign('id', $_adver->id);
         $this->_tpl->assign('titlec', $_adver->title);
         $this->_tpl->assign('info', $_adver->info);
         $this->_tpl->assign('link', $_adver->link);
         $this->_tpl->assign('thumbnail', $_adver->thumbnail);
         $this->_tpl->assign('prev_url', PREV_URL);
         $this->_tpl->assign('update', true);
         $this->_tpl->assign('title', '修改廣告');
         switch ($_adver->type) {
             case 1:
                 $this->_tpl->assign('type1', 'checked="checked"');
                 $this->_tpl->assign('pic', 'style="display:none"');
                 break;
             case 2:
                 $this->_tpl->assign('type2', 'checked="checked"');
                 $this->_tpl->assign('pic', 'style="display:block"');
                 $this->_tpl->assign('up', "<input type=\"button\" value=\"上傳頭部廣告690x80\" onclick=\"centerWindow('../config/upfile.php?type=adver&size=690x80','upfile','400','100')\" />");
                 break;
             case 3:
                 $this->_tpl->assign('type3', 'checked="checked"');
                 $this->_tpl->assign('pic', 'style="display:block"');
                 $this->_tpl->assign('up', "<input type=\"button\" value=\"上傳側欄廣告270x200\" onclick=\"centerWindow('../config/upfile.php?type=adver&size=270x200','upfile','400','100')\" />");
                 break;
         }
         if (empty($_adver->state)) {
             $this->_tpl->assign('right_state', 'checked="checked"');
         } else {
             $this->_tpl->assign('left_state', 'checked="checked"');
         }
     } else {
         Tool::alertBack('非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:71,代碼來源:AdverAction.class.php

示例14: update

 private function update()
 {
     if (isset($_POST['send'])) {
         if (Validate::checkNull($_POST['pass'])) {
             $this->_model->pass = $_POST['ppass'];
         } else {
             if (Validate::checkLength($_POST['pass'], 6, 'min')) {
                 Tool::alertBack('警告:密碼不得小於六位!');
             }
             $this->_model->pass = sha1($_POST['pass']);
         }
         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->id = $_POST['id'];
         $this->_model->email = $_POST['email'];
         $this->_model->face = $_POST['face'];
         $this->_model->state = $_POST['state'];
         $this->_model->updateUser() ? Tool::alertLocation('恭喜你,修改成功!', $_POST['prev_url']) : Tool::alertBack('很遺憾,修改失敗!');
     }
     if (isset($_GET['id'])) {
         $this->_model->id = $_GET['id'];
         $_user = $this->_model->getOneUser();
         if ($_user) {
             $this->_tpl->assign('update', true);
             $this->_tpl->assign('title', '修改會員');
             $this->_tpl->assign('prev_url', PREV_URL);
             $this->_tpl->assign('id', $_user->id);
             $this->_tpl->assign('user', $_user->user);
             $this->_tpl->assign('email', $_user->email);
             $this->_tpl->assign('answer', $_user->answer);
             $this->_tpl->assign('facesrc', $_user->face);
             $this->_tpl->assign('pass', $_user->pass);
             $this->face($_user->face);
             $this->question($_user->question);
             $this->state($_user->state);
         } else {
             Tool::alertBack('警告:不存在此會員!');
         }
     } else {
         Tool::alertBack('警告:非法操作!');
     }
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:50,代碼來源:UserAction.class.php

示例15: getPost

 private function getPost()
 {
     if (Validate::checkNull($_POST['title'])) {
         Tool::alertBack('警告:標題不得為空!');
     }
     if (Validate::checkLength($_POST['title'], 2, 'min')) {
         Tool::alertBack('警告:標題長度不得小於兩位!');
     }
     if (Validate::checkLength($_POST['title'], 50, 'max')) {
         Tool::alertBack('警告:標題長度不得大於五十位!');
     }
     if (Validate::checkNull($_POST['nav'])) {
         Tool::alertBack('警告:必須選擇一個欄目!');
     }
     if (Validate::checkLength($_POST['tag'], 30, 'max')) {
         Tool::alertBack('警告:tag標簽長度不得大於三十位!');
     }
     if (Validate::checkLength($_POST['keyword'], 30, 'max')) {
         Tool::alertBack('警告:關鍵字長度不得大於三十位!');
     }
     if (Validate::checkLength($_POST['source'], 20, 'max')) {
         Tool::alertBack('警告:文章來源長度不得大於二十位!');
     }
     if (Validate::checkLength($_POST['author'], 10, 'max')) {
         Tool::alertBack('警告:作者長度不得大於十位!');
     }
     if (Validate::checkLength($_POST['info'], 200, 'max')) {
         Tool::alertBack('警告:內容摘要不得大於兩百位!');
     }
     if (Validate::checkNull($_POST['content'])) {
         Tool::alertBack('警告:詳細內容不得為空!');
     }
     if (Validate::checkNum($_POST['count'])) {
         Tool::alertBack('警告:瀏覽次數必須是數字!');
     }
     if (Validate::checkNum($_POST['gold'])) {
         Tool::alertBack('警告:消費金幣必須是數字!');
     }
     if (isset($_POST['attr'])) {
         $this->_model->attr = implode(',', $_POST['attr']);
     } else {
         $this->_model->attr = '無';
     }
     $this->_model->title = $_POST['title'];
     $this->_model->nav = $_POST['nav'];
     $this->_model->info = $_POST['info'];
     $this->_model->source = $_POST['source'];
     $this->_model->author = $_POST['author'];
     $this->_model->keyword = $_POST['keyword'];
     $this->_model->thumbnail = $_POST['thumbnail'];
     $this->_model->tag = $_POST['tag'];
     $this->_model->content = $_POST['content'];
     $this->_model->commend = $_POST['commend'];
     $this->_model->count = $_POST['count'];
     $this->_model->gold = $_POST['gold'];
     $this->_model->color = $_POST['color'];
     $this->_model->sort = $_POST['sort'];
     $this->_model->readlimit = $_POST['readlimit'];
 }
開發者ID:denson7,項目名稱:phpstudy,代碼行數:59,代碼來源:ContentAction.class.php


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