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