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


PHP safe_replace函數代碼示例

本文整理匯總了PHP中safe_replace函數的典型用法代碼示例。如果您正苦於以下問題:PHP safe_replace函數的具體用法?PHP safe_replace怎麽用?PHP safe_replace使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: check

 public function check()
 {
     if (!is_login()) {
         $this->error("您還沒有登陸", U("User/login"));
     }
     /***接受代碼 */
     $code = I('post.couponid');
     $code = safe_replace($code);
     //過濾
     $fcoupon = M("fcoupon");
     $id = $fcoupon->where("code='{$code}' ")->getfield("id");
     /***獲取優惠券id,優惠券存在 */
     if (isset($id)) {
         $member = D("member");
         $uid = $member->uid();
         $coupon = M("UserCoupon");
         /***用戶優惠券存在 */
         if ($coupon->where("uid='{$uid}'and couponid='{$id}' and status='1'")->select()) {
             $data["info"] = "該優惠券可以使用";
             $data["msg"] = "yes";
             $data["status"] = "1";
             $this->ajaxreturn($data);
         } else {
             $data["info"] = "該優惠券已使用或未領取";
             $data["msg"] = "no";
             $data["status"] = "1";
             $this->ajaxreturn($data);
         }
     } else {
         $data["info"] = "查詢不到該優惠券";
         $data["msg"] = "out of date";
         $data["status"] = "1";
         $this->ajaxreturn($data);
     }
 }
開發者ID:gitchenze,項目名稱:soloshop,代碼行數:35,代碼來源:FcouponController.class.php

示例2: keyword

	function keyword ($field, $value) {
		//獲取post過來的關鍵字,關鍵字用空格或者‘,’分割的
		$data = array();
		$data = split('[ ,]', $value);
		//加載關鍵字的數據模型
		$keyword_db = pc_base::load_model('keyword_model');
		$keyword_data_db = pc_base::load_model('keyword_data_model');
		pc_base::load_sys_func('iconv');
		if (is_array($data) && !empty($data)) {
			$siteid = get_siteid();
			foreach ($data as $v) {
				$v = defined('IN_ADMIN') ? $v : safe_replace(addslashes($v));
				$v = str_replace(array('//','#','.'),' ',$v);
				if (!$r = $keyword_db->get_one(array('keyword'=>$v, 'siteid'=>$siteid))) {
					$letters = gbk_to_pinyin($v);
					$letter = strtolower(implode('', $letters));
					$tagid = $keyword_db->insert(array('keyword'=>$v, 'siteid'=>$siteid, 'pinyin'=>$letter, 'videonum'=>1), true);
				} else {
					$keyword_db->update(array('videonum'=>'+=1'), array('id'=>$r['id']));
					$tagid = $r['id'];
				}
				$contentid = $this->id.'-'.$this->modelid;
				if (!$keyword_data_db->get_one(array('tagid'=>$tagid, 'siteid'=>$siteid, 'contentid'=>$contentid))) {
					$keyword_data_db->insert(array('tagid'=>$tagid, 'siteid'=>$siteid, 'contentid'=>$contentid));
				}
				unset($contentid, $tagid, $letters);
			}
		}
		return $value;
	}
開發者ID:panhongsheng,項目名稱:zl_cms,代碼行數:30,代碼來源:content_update.class.php

示例3: lists

 /**
  * 按照模型搜索
  */
 public function lists()
 {
     $tag = safe_replace(addslashes($_GET['tag']));
     $keyword_data_db = pc_base::load_model('keyword_data_model');
     //獲取標簽id
     $r = $this->keyword_db->get_one(array('keyword' => $tag, 'siteid' => $this->siteid), 'id');
     if (!$r['id']) {
         showmessage('不存在此關鍵字!');
     }
     $tagid = intval($r['id']);
     $page = max($_GET['page'], 1);
     $pagesize = 20;
     $where = '`tagid`=\'' . $tagid . '\' AND `siteid`=' . $this->siteid;
     $infos = $keyword_data_db->listinfo($where, '`id` DESC', $page, $pagesize);
     $pages = $keyword_data_db->pages;
     $total = $keyword_data_db->number;
     if (is_array($infos)) {
         $datas = array();
         foreach ($infos as $info) {
             list($contentid, $modelid) = explode('-', $info['contentid']);
             $this->db->set_model($modelid);
             $res = $this->db->get_one(array('id' => $contentid), 'title, description, url, inputtime, style');
             $res['title'] = str_replace($tag, '<font color="#f00">' . $tag . '</font>', $res['title']);
             $res['description'] = str_replace($tag, '<font color="#f00">' . $tag . '</font>', $res['description']);
             $datas[] = $res;
         }
     }
     $SEO = seo($siteid, '', $tag);
     include template('content', 'tag_list');
 }
開發者ID:shenhua4286,項目名稱:gxw,代碼行數:33,代碼來源:tag.php

示例4: __construct

 public function __construct()
 {
     $this->commentid = isset($_GET['commentid']) && trim(urldecode($_GET['commentid'])) ? trim(urldecode($_GET['commentid'])) : $this->_show_msg(L('illegal_parameters'));
     $this->commentid = safe_replace($this->commentid);
     $this->format = isset($_GET['format']) ? $_GET['format'] : '';
     list($this->applications, $this->contentid) = decode_commentid($this->commentid);
 }
開發者ID:hubs,項目名稱:yuncms,代碼行數:7,代碼來源:IndexController.php

示例5: get_cookie

 public static function get_cookie($var, $default = '')
 {
     $var = CS_Cookie_Prefix . $var;
     $value = isset($_COOKIE[$var]) ? sys_auth($_COOKIE[$var], 'D', $var . CS_Encryption_Key) : $default;
     $value = safe_replace($value);
     return $value;
 }
開發者ID:djqhuan,項目名稱:CSCMS-v4.0-UTF8,代碼行數:7,代碼來源:Cookie.php

示例6: reg

 public function reg()
 {
     if (isset($_POST['submit-1'])) {
         $username = safe_replace($_POST['username']);
         if ($username != $_POST['username'] || empty($username)) {
             _message("用戶名格式錯誤!");
         }
         if (_strlen($username) > 15) {
             _message("用戶名長度為2-15個字符,1個漢字等於2個字符!");
         }
         $password1 = $_POST['password'];
         $password2 = $_POST['pwdconfirm'];
         if (empty($password2) || $password1 != $password2) {
             _message("2次密碼不一致!");
         }
         if (!_checkemail($_POST['email'])) {
             _message("郵箱格式錯誤!");
         }
         $pmid = isset($_POST['mid']) ? intval($_POST['mid']) : 0;
         $password = md5($password2);
         $addtime = time();
         $ip = _get_ip();
         $this->db->Query("INSERT INTO `@#_admin` (`mid`, `username`, `userpass`, `useremail`, `addtime`, `logintime`, `loginip`) VALUES ('{$pmid}', '{$username}', '{$password}', '{$_POST['email']}','{$addtime}','0','{$ip}')");
         if ($this->db->affected_rows()) {
             $path = WEB_PATH . '/' . ROUTE_M . '/user/lists';
             _message("添加管理員成功!", $path);
         } else {
             _message("添加管理員失敗!");
         }
     }
     include $this->tpl(ROUTE_M, 'user.reg');
 }
開發者ID:haidao17,項目名稱:backend,代碼行數:32,代碼來源:user.action.php

示例7: index

 public function index()
 {
     if (IS_POST) {
         //頁麵上通過表單選擇在線支付類型,支付寶為alipay 財付通為tenpay
         /* 支付設置 */
         $payment = array('tenpay' => array('key' => C('TENPAYKEY'), 'partner' => C('TENPAYPARTNER')), 'alipay' => array('email' => C('ALIPAYEMAIL'), 'key' => C('ALIPAYKEY'), 'partner' => C('ALIPAYPARTNER')), 'palpay' => array('business' => C('PALPAYPARTNER')), 'yeepay' => array('key' => C('YEEPAYPARTNER'), 'partner' => C('YEEPAYKEY')), 'kuaiqian' => array('key' => C('KUAIQIANPARTNER'), 'partner' => C('KUAIQIANKEY')), 'unionpay' => array('key' => C('UNIONPARTNER'), 'partner' => C('UNIONKEY')));
         $paytype = safe_replace(I('post.paytype'));
         $pay = new \Think\Pay($paytype, $payment[$paytype]);
         if (!empty($_POST['orderid'])) {
             $order_no = safe_replace(I('post.orderid'));
             $info = M("order")->where("tag='{$order_no}'")->find();
             $money = $info['total_money'];
             $body = C('SITENAME') . "訂單支付";
             //商品描述
             $title = C('SITENAME') . "訂單支付";
             //設置商品名稱
         }
         $vo = new \Think\Pay\PayVo();
         $vo->setBody($body)->setFee($money)->setOrderNo($order_no)->setTitle($title)->setCallback("Home/Pay/success")->setUrl(U("Home/Pay/over"))->setParam(array('order_id' => $order_no));
         echo $pay->buildRequestForm($vo);
     } else {
         $this->meta_title = '支付訂單';
         //在此之前goods1的業務訂單已經生成,狀態為等待支付
         $id = safe_replace(I("get.orderid"));
         $order = D("order");
         $this->assign('codeid', $id);
         $total = $order->where("orderid='{$id}'")->getField('total_money');
         $this->assign('goodprice', $total);
         $this->display();
     }
 }
開發者ID:gitchenze,項目名稱:soloshop,代碼行數:31,代碼來源:PayController.class.php

示例8: search

 public function search()
 {
     $title = safe_replace($_GET['title']);
     if (CHARSET == 'gbk') {
         $title = iconv('utf-8', 'gbk', $title);
     }
     $where = '`status`=21';
     if ($title) {
         $where .= ' AND `title` LIKE \'%' . $title . '%\'';
     }
     $userupload = intval($_GET['userupload']);
     if ($userupload) {
         $where .= ' AND `userupload`=1';
     }
     $page = $_GET['page'];
     $pagesize = 6;
     $infos = $this->db->listinfo($where, 'videoid DESC', $page, $pagesize);
     $number = $this->db->number;
     $pages = $this->pages($number, $page, $pagesize, 4, 'get_videoes');
     if (is_array($infos) && !empty($infos)) {
         $html = '';
         foreach ($infos as $info) {
             $html .= '<li><div class="w9"><a href="javascript:void(0);" onclick="a_click(this);" title="' . $info['title'] . '" data-vid="' . $info['vid'] . '" ><span></span><img src="' . $info['picpath'] . '" width="90" height="51" /></a><p>' . str_cut($info['title'], 18) . '</p></div></li>';
         }
     }
     $data['pages'] = $pages;
     $data['html'] = $html;
     if (CHARSET == 'gbk') {
         $data = array_iconv($data, 'gbk', 'utf-8');
     }
     exit(json_encode($data));
 }
開發者ID:baowzh,項目名稱:renfang,代碼行數:32,代碼來源:video_for_ck.php

示例9: tag

 public function tag()
 {
     $search = $this->segment_array();
     array_shift($search);
     array_shift($search);
     array_shift($search);
     $search = implode('/', $search);
     if (!$search) {
         _message("輸入搜索關鍵字");
     }
     $search = urldecode($search);
     $search = safe_replace($search);
     if (!_is_utf8($search)) {
         $search = iconv("GBK", "UTF-8", $search);
     }
     $mysql_model = System::load_sys_class('model');
     $search = str_ireplace("union", '', $search);
     $search = str_ireplace("select", '', $search);
     $search = str_ireplace("delete", '', $search);
     $search = str_ireplace("update", '', $search);
     $search = str_ireplace("/**/", '', $search);
     $title = $search . ' - ' . _cfg('web_name');
     $shoplist = $mysql_model->GetList("select title,thumb,id,sid,zongrenshu,canyurenshu,shenyurenshu,money from `@#_shoplist` WHERE shenyurenshu !=0 and `title` LIKE '%" . $search . "%' order by shenyurenshu desc");
     $list = count($shoplist);
     include templates("search", "search");
 }
開發者ID:shuay,項目名稱:projectYG,代碼行數:26,代碼來源:index.action.php

示例10: album_list

 public function album_list()
 {
     $search = array();
     if (isset($_GET['search'])) {
         if ($_GET['start_time'] && !is_numeric($_GET['start_time'])) {
             $search['_string'] = "uploadtime >= " . strtotime($_GET['start_time']);
         }
         if ($_GET['end_time'] && !is_numeric($_GET['end_time'])) {
             if (isset($search['_string'])) {
                 $search['_string'] .= " and uploadtime <= " . strtotime($_GET['end_time']);
             } else {
                 $search['uploadtime'] = array('lt', strtotime($_GET['end_time']));
             }
         }
         if ($_GET['filename']) {
             $search['name'] = array('like', "%" . safe_replace($_GET['filename']) . "%");
         }
     }
     if (isset($_GET['CKEditor'])) {
         $data = $this->db->attachment_list($search, "id desc", '32');
         $this->assign('attachs', $data['data']);
         $this->assign('pages', $data['pages']);
         $this->display("album_for_ckeditor");
     } else {
         $data = $this->db->attachment_list($search);
         $this->assign('attachs', $data['data']);
         $this->assign('pages', $data['pages']);
         $this->assign('params', explode(',', $_GET['args']));
         $this->display();
     }
 }
開發者ID:9618211,項目名稱:TP-Admin-V2.0,代碼行數:31,代碼來源:AttachmentController.class.php

示例11: add

 public function add()
 {
     if (isset($_POST['dosubmit'])) {
         $_POST['link']['addtime'] = SYS_TIME;
         $_POST['link']['siteid'] = $this->get_siteid();
         if (empty($_POST['link']['name'])) {
             showmessage(L('sitename_noempty'), HTTP_REFERER);
         } else {
             $_POST['link']['name'] = safe_replace($_POST['link']['name']);
         }
         if ($_POST['link']['logo']) {
             $_POST['link']['logo'] = safe_replace($_POST['link']['logo']);
         }
         $data = new_addslashes($_POST['link']);
         $linkid = $this->db->insert($data, true);
         if (!$linkid) {
             return FALSE;
         }
         $siteid = $this->get_siteid();
         //更新附件狀態
         if (pc_base::load_config('system', 'attachment_stat') & $_POST['link']['logo']) {
             $this->attachment_db = pc_base::load_model('attachment_model');
             $this->attachment_db->api_update($_POST['link']['logo'], 'link-' . $linkid, 1);
         }
         showmessage(L('operation_success'), HTTP_REFERER, '', 'add');
     } else {
         $show_validator = $show_scroll = $show_header = true;
         pc_base::load_sys_class('form', '', 0);
         $siteid = $this->get_siteid();
         $types = $this->db2->get_types($siteid);
         //print_r($types);exit;
         include $this->admin_tpl('link_add');
     }
 }
開發者ID:ahmatjan,項目名稱:huluphp,代碼行數:34,代碼來源:link.php

示例12: lottery_shop_json

 public function lottery_shop_json()
 {
     if (!isset($_GET['gid'])) {
         echo json_encode(array("error" => '1'));
         return;
         exit;
     }
     $gid = trim($_GET['gid']);
     $times = (int) System::load_sys_config('system', 'goods_end_time');
     if (!$times) {
         $times = 1;
     }
     $db = System::load_sys_class('model');
     $gid = safe_replace($gid);
     $gid = str_ireplace("select", "", $gid);
     $gid = str_ireplace("union", "", $gid);
     $gid = str_ireplace("'", "", $gid);
     $gid = str_ireplace("%27", "", $gid);
     $gid = trim($gid, ',');
     if (!$gid) {
         $info = $db->GetOne("select qishu,xsjx_time,id,zongrenshu,thumb,title,q_uid,q_user,q_user_code,q_end_time from `@#_shoplist` where `q_showtime` = 'Y' order by `q_end_time` ASC");
     } else {
         $infos = $db->GetList("select  qishu,xsjx_time,id,zongrenshu,thumb,title,q_uid,q_user,q_user_code,q_end_time from `@#_shoplist` where `q_showtime` = 'Y' order by `q_end_time` ASC limit 0,4");
         $gid = @explode('_', $gid);
         $info = false;
         foreach ($infos as $infov) {
             if (!in_array($infov['id'], $gid)) {
                 $info = $infov;
                 break;
             }
         }
     }
     if (!$info) {
         echo json_encode(array("error" => '1'));
         return;
         exit;
     }
     if ($info['xsjx_time']) {
         $info['q_end_time'] = $info['q_end_time'] + $times;
     }
     System::load_sys_fun("user");
     $user = unserialize($info['q_user']);
     $user = get_user_name($info['q_uid'], "username");
     $uid = $info['q_uid'];
     $upload = G_UPLOAD_PATH;
     $q_time = substr($info['q_end_time'], 0, 10);
     if ($q_time <= time()) {
         $db->Query("update `@#_shoplist` SET `q_showtime` = 'N' where `id` = '{$info['id']}' and `q_showtime` = 'Y' and `q_uid` is not null");
         echo json_encode(array("error" => '-1'));
         return;
         exit;
     }
     $user_shop_number = $db->GetOne("select sum(gonumber) as gonumber from `@#_member_go_record` where `uid`= '{$uid}' and `shopid` = '{$info['id']}' and `shopqishu` = '{$info['qishu']}'");
     $user_shop_number = $user_shop_number['gonumber'];
     $times = $q_time - time();
     echo json_encode(array("error" => "0", "user_shop_number" => "{$user_shop_number}", "user" => "{$user}", "zongrenshu" => $info['zongrenshu'], "q_user_code" => $info['q_user_code'], "qishu" => $info['qishu'], "upload" => $upload, "thumb" => $info['thumb'], "id" => $info['id'], "uid" => "{$uid}", "title" => $info['title'], "user" => $user, "times" => $times));
     exit;
 }
開發者ID:think-css,項目名稱:yungou,代碼行數:58,代碼來源:getshop.action.php

示例13: login

 /**
  * 後台用戶登錄
  * @author 麥當苗兒 <zuojiazi@vip.qq.com>
  */
 public function login($username = null, $password = null, $verify = null)
 {
     if (IS_POST) {
         /* 檢測驗證碼 TODO: */
         // if(!check_verify($verify)){
         //  $this->error('驗證碼輸入錯誤!');
         // }
         $username = safe_replace($username);
         //過濾
         /* 調用UC登錄接口登錄 */
         $User = new UserApi();
         $uid = $User->login($username, $password);
         if (0 < $uid) {
             //UC登錄成功
             /* 登錄用戶 */
             $Member = D('Member');
             if ($Member->login($uid)) {
                 //登錄用戶
                 //TODO:跳轉到登錄前頁麵
                 $this->success('登錄成功!', U('Admin/Index/index'));
             } else {
                 $this->error($Member->getError());
             }
         } else {
             //登錄失敗
             switch ($uid) {
                 case -1:
                     $error = '用戶不存在或被禁用!';
                     break;
                     //係統級別禁用
                 //係統級別禁用
                 case -2:
                     $error = '密碼錯誤!';
                     break;
                 default:
                     $error = '未知錯誤!';
                     break;
                     // 0-接口參數錯誤(調試階段使用)
             }
             $this->error($error);
         }
     } else {
         if (is_login()) {
             $this->redirect('Index/index');
         } else {
             /* 讀取數據庫中的配置 */
             $config = S('DB_CONFIG_DATA');
             if (!$config) {
                 $config = D('Config')->lists();
                 S('DB_CONFIG_DATA', $config);
             }
             C($config);
             //添加配置
             $this->display();
         }
     }
 }
開發者ID:gitchenze,項目名稱:soloshop,代碼行數:61,代碼來源:PublicController.class.php

示例14: callback

 private function callback($msg, $url = '', $state = 0)
 {
     if ($this->model['setting']['member']['callback'] && function_exists($this->model['setting']['member']['callback'])) {
         eval($this->model['setting']['member']['callback'] . '("' . safe_replace($msg) . '", "' . safe_replace($url) . '", ' . $state . ');');
     } else {
         $this->msg($msg, $url, 1);
     }
     exit;
 }
開發者ID:rainbow88,項目名稱:hummel,代碼行數:9,代碼來源:ExtendController.php

示例15: __construct

	function __construct() {
		pc_base::load_app_func('global');
		pc_base::load_sys_class('format', '', 0);
		$this->commentid = isset($_GET['commentid']) && trim(urldecode($_GET['commentid'])) ? trim(urldecode($_GET['commentid'])) : $this->_show_msg(L('illegal_parameters'));
		$this->commentid = safe_replace($this->commentid);
		$this->format = isset($_GET['format']) ? $_GET['format'] : '';
		list($this->modules, $this->contentid, $this->siteid) = decode_commentid($this->commentid);
		define('SITEID', $this->siteid);
	}
開發者ID:hxzyzz,項目名稱:ddc,代碼行數:9,代碼來源:index.php


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