当前位置: 首页>>代码示例>>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;未经允许,请勿转载。