本文整理匯總了PHP中CommonAction::checkField方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonAction::checkField方法的具體用法?PHP CommonAction::checkField怎麽用?PHP CommonAction::checkField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonAction
的用法示例。
在下文中一共展示了CommonAction::checkField方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: editDetails
public function editDetails()
{
$objLinkTxt = M('linktxt');
$id = intval($_GET['id']);
if ($_POST) {
$POST = deep_htmlspecialchars($_POST);
parent::checkField('link_name', $POST['link_name'], 'require', '友情鏈接名稱不能為空');
parent::checkField('link_url', $POST['link_url'], 'require', '友情鏈接地址不能為空');
parent::checkField('explain', $POST['explain'], 'require', '友情鏈接備注不能為空');
$data = array();
$data['id'] = $POST['id'];
$data['link_name'] = $POST['link_name'];
$data['status'] = $POST['status'];
$data['link_url'] = $POST['link_url'];
$data['explain'] = $POST['explain'];
$result = $objLinkTxt->data($data)->save();
if ($result) {
$this->success('修改成功', U(GROUP_NAME . '/Link/detailslist'));
} else {
$this->error('修改失敗');
}
} else {
$data = $objLinkTxt->where('id=' . $id)->find();
$data = deep_htmlspecialchars_decode($data);
$this->assign('data', $data);
$this->display();
}
}
示例2: editAdmin
public function editAdmin()
{
$objAdmin = M('admin');
$id = intval($_GET['id']);
if ($_POST) {
$POST = deep_htmlspecialchars($_POST);
parent::checkField('password', $POST['password'], 'require', '舊密碼不能為空');
parent::checkField('newpassword', $POST['newpassword'], 'require', '新密碼不能為空');
$password = $objAdmin->where('id=' . $POST['id'])->find();
if ($password['password'] != md5($POST['password'])) {
$this->error('舊密碼不正確,請重試');
}
$result = $objAdmin->where('id=' . $POST['id'])->save(array('id' => $POST['ID'], 'password' => md5($POST['newpassword'])));
if ($result) {
$this->success('密碼修改成功', U(APP_NAME . '/Admin/adminlist'));
} else {
$this->error('密碼修改失敗');
}
} else {
$data = $objAdmin->where(array('id' => $id))->find();
$data = deep_htmlspecialchars_decode($data);
$this->assign('data', $data);
$this->display();
}
}
示例3: handleReg
public function handleReg()
{
if (!IS_POST) {
parent::error404();
}
$POST = deep_htmlspecialchars_decode($_POST);
parent::checkField('username', $POST['username'], 'require', '用戶名不能為空');
parent::checkField('username', $POST['username'], 'twomore', '用戶名在2-14個字符');
parent::checkField('email', $POST['email'], 'require', '郵箱不能為空');
parent::checkField('email', $POST['email'], 'email', '郵箱格式不對');
parent::checkField('password', $POST['password'], 'require', '密碼不能為空');
parent::checkField('password', $POST['password'], 'password', '密碼隻能在6-20個字符');
parent::checkField('repassword', $POST['repassword'], 'require', '確認密碼不能為空');
if ($POST['password'] != $POST['repassword']) {
$this->error('前後密碼不一致');
}
parent::checkField('verify', $POST['verify'], 'require', '驗證碼不能為空');
if (md5($POST['verify']) != $_SESSION['verify']) {
$this->error('驗證碼不正確');
}
$objUser = M('user');
$data = array();
$data['username'] = $POST['username'];
$data['email'] = $POST['email'];
$data['password'] = md5($POST['password']);
$data['reg_time'] = time();
$data['login_ip'] = get_client_ip();
$result = $objUser->data($data)->add();
if ($result) {
$this->success('恭喜你,注冊成功', U(APP_NAME . '/Login/index'));
} else {
$this->error('注冊失敗,請稍後再試');
}
}
示例4: singleEdit
public function singleEdit()
{
$id = intval($_GET['id']);
$objSingle = M('single');
if (IS_POST) {
$POST = deep_htmlspecialchars($_POST);
parent::checkField('title', $POST['title'], 'require', '單頁標題不能為空');
parent::checkField('content', $POST['content'], 'require', '內容不能為空');
$data = array();
$data['id'] = $POST['id'];
$data['title'] = $POST['title'];
$data['status'] = $POST['status'];
$data['content'] = $POST['content'];
$result = $objSingle->save($data);
if ($result) {
$this->success('修改成功...', U(APP_NAME . '/Single/singlelist'));
} else {
$this->error('修改失敗,請稍後再試');
}
} else {
$data = $objSingle->where('id=' . $id)->find();
$data = deep_htmlspecialchars_decode($data);
$this->assign('data', $data);
$this->display();
}
}
示例5: runAddDetails
public function runAddDetails()
{
$db = M('discuss');
parent::checkField('discuss_name', deep_htmlspecialchars($_POST['discuss_name']), 'require', '圖文名稱不能為空');
parent::checkField('content', deep_htmlspecialchars($_POST['content']), 'require', '內容不能為空');
$data = array();
$data['discuss_name'] = I('discuss_name');
$data['sort_id'] = I('parent_id');
$data['status'] = I('status');
$data['author'] = I('author');
$data['add_time'] = time();
$data['content'] = I('content');
if ($db->data($data)->add()) {
$this->success('添加成功', U(GROUP_NAME . '/Discuss/detailslist'));
} else {
$this->error('添加失敗');
}
}
示例6: addLetter
public function addLetter()
{
parent::isLogin();
//登錄判斷
$userId = intval($_GET['user_id']);
$objLetter = M('letter');
$objUser = M('user');
if (IS_POST) {
$POST = deep_htmlspecialchars($_POST);
parent::checkField('username', $POST['username'], 'require', '私信的用戶名不能為空!');
parent::checkField('title', $POST['title'], 'require', '私信標題不能為空');
parent::checkField('content', $POST['content'], 'require', '私信內容不能為空');
$result = $objUser->where(array('username' => $POST['username']))->field('id,username')->find();
if (!$result) {
$this->error('私信的用戶不存在!');
}
if ($result['id'] == $_SESSION['uid']) {
$this->error('不能跟自己私信!');
}
$data = array();
$data['send_uid'] = $POST['uid'];
$data['receive_uid'] = $result['id'];
$data['receive_user'] = $POST['username'];
$data['send_user'] = $POST['send_user'];
$data['title'] = $POST['title'];
$data['content'] = $POST['content'];
$data['time'] = time();
$result2 = $objLetter->add($data);
if ($result2) {
$this->success('發送私信成功');
} else {
$this->error('發送私信失敗,請稍後再試!');
}
} else {
$username = $objUser->where('id=' . $userId)->getField('username');
$this->assign('username', $username);
$this->display();
}
}
示例7: editDetails
public function editDetails()
{
if ($_POST) {
$id = I('id', 0, 'intval');
$db = M('ad');
parent::checkField('ad_name', deep_htmlspecialchars($_POST['ad_name']), 'require', '廣告名稱不能為空');
//parent::checkField('content', deep_htmlspecialchars($_POST['content']), 'require', '內容不能為空');
$data = array();
$data['id'] = $id;
$data['ad_name'] = I('ad_name');
$data['sort_id'] = I('parent_id');
$data['status'] = I('status');
$data['ad_pic'] = I('ad_pic');
$data['ad_url'] = I('ad_url');
$data['ad_explain'] = I('ad_explain');
$data['start_time'] = strtotime(I('start_time'));
$data['end_time'] = strtotime(I('end_time'));
if ($db->data($data)->save()) {
$this->success('修改成功', U(GROUP_NAME . '/Ad/detailslist'));
} else {
$this->error('修改失敗');
}
} else {
$id = I('id', 0, 'intval');
$this->assign('id', $id);
$data = M('ad')->where(array('id' => $id))->find();
$this->assign('data', $data);
import('Class.Category', './');
//引入無限極分類
$sortList = M('ad_sort')->select();
//先把廣告分類讀出來
$sortList = Category::unlimitedForLevel($sortList, ' ');
//組合子分類與父分類
$this->assign('sortList', $sortList);
//把分類分配過去
$this->display();
}
}
示例8: handleEditAsk
public function handleEditAsk()
{
if (!IS_POST) {
parent::error404();
}
$POST = deep_htmlspecialchars($_POST);
parent::checkField('title', $POST['title'], 'require', '標題不能為空');
if ($POST['sort_id'] == 0) {
$this->error('請選擇分類');
}
if ($POST['reward'] == -1) {
$this->error('請選擇懸賞金幣');
}
parent::checkField('content', $POST['content'], 'require', '內容不能為空');
$objAsk = M('ask');
$data = array();
$data['id'] = $POST['aid'];
$data['ask_name'] = $POST['title'];
$data['uid'] = $POST['uid'];
$data['sort_id'] = $POST['sort_id'];
$data['reward'] = $POST['reward'];
$data['content'] = $POST['content'];
$result = $objAsk->data($data)->save();
if ($result) {
$this->success('修改問題成功...', U(APP_NAME . '/List/detail', array('id' => $POST['aid'])));
} else {
$this->error('修改問題失敗,請稍後再試..');
}
}