本文整理汇总了PHP中safe函数的典型用法代码示例。如果您正苦于以下问题:PHP safe函数的具体用法?PHP safe怎么用?PHP safe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lists
public function lists()
{
$top_more_button[] = array('title' => '导入数据', 'url' => U('import'));
$this->assign('top_more_button', $top_more_button);
$model = $this->getModel('credit_data');
$map['token'] = get_token();
if (!empty($_GET['uid'])) {
$uidArr = wp_explode($_GET['uid']);
$map['uid'] = array('in', $uidArr);
} elseif (!empty($_REQUEST['nickname'])) {
$map['uid'] = array('in', D('Common/User')->searchUser($_REQUEST['nickname']));
}
if (!isset($map['uid'])) {
$map['uid'] = array('exp', '>0');
}
if (!empty($_REQUEST['credit_name'])) {
$map['credit_name'] = safe($_REQUEST['credit_name']);
}
if (!empty($_REQUEST['start_time']) && !empty($_REQUEST['end_time'])) {
$map['cTime'] = array('between', '"' . intval($_REQUEST['start_time']) . ',' . intval($_REQUEST['start_time']) . '"');
} elseif (!empty($_REQUEST['start_time'])) {
$map['cTime'] = array('egt', intval($_REQUEST['start_time']));
} elseif (!empty($_REQUEST['end_time'])) {
$map['cTime'] = array('elt', intval($_REQUEST['end_time']));
}
session('common_condition', $map);
$list_data = $this->_get_model_list($model);
foreach ($list_data['list_data'] as &$vo) {
$vo['uid'] = get_nickname($vo['uid']);
}
$this->assign($list_data);
// dump($list_data);
$this->display();
}
示例2: InsertProducts
public static function InsertProducts($ProductsObject)
{
$DataBaseHelper = new DataAccessHelper();
$sql = "INSERT INTO `product` (`product_id`,`product_details_url`) VALUES ('" . NULL . "','" . safe($ProductsObject->product_details_url) . "')";
echo $sql . "<br/>";
return $DataBaseHelper->ExecuteInsertReturnID($sql);
}
示例3: _dealWeixinPost
private function _dealWeixinPost()
{
$content = wp_file_get_contents('php://input');
vendor('WXBiz.wxBizMsgCrypt');
$this->sReqTimeStamp = I('get.timestamp');
$this->sReqNonce = I('get.nonce');
$this->sEncryptMsg = I('get.msg_signature');
$this->wxcpt = new \WXBizMsgCrypt('weiphp', '0c79e1fa963cd80cc0be99b20a18faeb', 'wx2685aca90abe2895');
$sMsg = "";
// 解析之后的明文
$errCode = $this->wxcpt->DecryptMsg($this->sEncryptMsg, $this->sReqTimeStamp, $this->sReqNonce, $content, $sMsg);
if ($errCode != 0) {
addWeixinLog($_GET, "DecryptMsg Error: " . $errCode);
return false;
} else {
// 解密成功,sMsg即为xml格式的明文
$content = $sMsg;
}
$data = new \SimpleXMLElement($content);
// $data || die ( '参数获取失败' );
foreach ($data as $key => $value) {
$this->data[$key] = safe(strval($value));
}
return $data;
}
示例4: doLogin
public function doLogin()
{
$email = safe($_POST['email']);
$password = safe($_POST['password']);
$remember = 1;
if (empty($email) || empty($password)) {
// $this->redirect(U('w3g/Public/login'), 3, '用户名和密码不能为空');
echo '用户名或密码不能为空';
exit;
}
if (!isValidEmail($email)) {
// $this->redirect(U('w3g/Public/login'), 3, 'Email格式错误,请重新输入');
echo 'Email格式错误,请重新输入';
exit;
}
if ($user = model('Passport')->getLocalUser($email, $password)) {
// dump($user);
if ($user['is_active'] == 0) {
// $this->redirect(U('w3g/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
echo '帐号尚未激活,请激活后重新登录';
exit;
}
model('Passport')->loginLocal($email, $password, $remember);
$this->setSessionAndCookie($user['uid'], $user['uname'], $user['email'], intval($_POST['remember']) === 1);
// $this->recordLogin($user['uid']);
// model('Passport')->registerLogin($user, intval($_POST['remember']) === 1);
echo '1';
exit;
} else {
// $this->redirect(U('w3g/Public/login'), 3, '帐号或密码错误,请重新输入');
echo '帐号或密码错误,请重新输入';
}
}
示例5: var_dump
public static function var_dump($var, $highlight = false)
{
$output = '';
if ($highlight) {
$output .= '<div style="font-weight: bold;">';
}
$xdebug = ini_get('xdebug.overload_var_dump');
if (!$xdebug) {
$output .= "<pre style='overflow: auto; background: #fff; color: #222; border: 1px dotted #ddd; padding: 3px;'>";
}
// Dump into a buffer
ob_start();
var_dump($var);
$dump = ob_get_clean();
if ($xdebug) {
$output .= $dump;
} else {
$output .= safe($dump);
$output .= "</pre>";
}
if ($highlight) {
$output .= '</div>';
}
echo $output;
}
示例6: lists
public function lists()
{
$model = $this->getModel('credit_data');
$map['token'] = get_token();
if (!empty($_GET['uid'])) {
$map['uid'] = intval($_GET['uid']);
} elseif (!empty($_REQUEST['nickname'])) {
$user_map['nickname'] = array('like', '%' . htmlspecialchars($_REQUEST['nickname']) . '%');
}
if (!isset($map['uid'])) {
$map['uid'] = array('exp', '>0');
}
if (!empty($_REQUEST['credit_name'])) {
$map['credit_name'] = safe($_REQUEST['credit_name']);
}
if (!empty($_REQUEST['start_time']) && !empty($_REQUEST['end_time'])) {
$map['cTime'] = array('between', '"' . intval($_REQUEST['start_time']) . ',' . intval($_REQUEST['start_time']) . '"');
} elseif (!empty($_REQUEST['start_time'])) {
$map['cTime'] = array('egt', intval($_REQUEST['start_time']));
} elseif (!empty($_REQUEST['end_time'])) {
$map['cTime'] = array('elt', intval($_REQUEST['end_time']));
}
session('common_condition', $map);
$list_data = $this->_get_model_list($model);
foreach ($list_data['list_data'] as &$vo) {
$vo['nickname'] = get_nickname($vo['uid']);
}
$this->assign($list_data);
// dump($list_data);
$this->display();
}
示例7: show
function show($widget)
{
$map['token'] = get_token();
if ($widget['data_from'] == 2) {
// 部分商品 cate_id=1,2,3&search_key=[search_key]&shopping_list=1
$condition = str_replace(array('[cate_id]', '[search_key]'), array($_REQUEST['cate_id'], $_REQUEST['search_key']), $widget['data_condition']);
parse_str($condition, $output);
if (!empty($output['cate_id'])) {
$map = getIdsForMap($output['cate_id'], $map, 'cate_id_1');
}
if (!empty($output['search_key'])) {
$key = safe($output['search_key']);
$map['title'] = array('like', "%{$key}%");
}
if (isset($output['shopping_list'])) {
// 购物清单 TODO
}
} elseif ($widget['data_from'] == 1) {
// 指定商品
$map = getIdsForMap($widget['data_ids'], $map);
}
if (isset($_REQUEST['cate_id'])) {
$cid = intval($_REQUEST['cate_id']);
$map['_string'] = ' (cate_id_1=' . $cid . ' or cate_id_2=' . $cid . ') ';
}
$list = M('shop_product')->where($map)->order($widget['order'])->selectPage($widget['list_row']);
// dump ( $list );
$this->assign('list', $list);
// dump ( $widget );
return $this->getWidgetHtml($widget);
}
示例8: track
function track()
{
$trace_num = isset($_POST['trace_num']) ? safe(trim($_POST['trace_num'])) : safe(trim($_GET['trace_num']));
$this->assign("trace_num", $trace_num);
if (!$trace_num) {
$this->display('goods.track.html');
}
$num = substr($trace_num, 2, 18);
preg_match("/^\\d{18}\$/", $num, $res);
if (!$res) {
$this->display('goods.track.empty.html');
return;
}
$info = $this->check->get("trace_num='{$trace_num}'");
if (empty($info)) {
$this->display('goods.track.empty.html');
return;
}
$traceinfo = $this->check->find(array("conditions" => "goods_id=" . $info['goods_id'], "fields" => 'trace_num,cid', 'order' => 'cid desc'));
$files_belong_track = $this->_uploadedfile_mod->find(array('conditions' => 'store_id = 0 AND belong = ' . BELONG_TRACK . ' AND item_id=' . $info['cid'], 'fields' => 'this.file_id, this.file_name, this.file_path', 'order' => 'add_time DESC'));
$files_belong_check = $this->_uploadedfile_mod->find(array('conditions' => 'store_id = 0 AND belong = ' . BELONG_CHECK . ' AND item_id=' . $info['cid'], 'fields' => 'this.file_id, this.file_path', 'order' => 'add_time DESC'));
$this->assign('files_belong_track', $files_belong_track);
$this->assign('files_belong_check', $files_belong_check);
$this->assign("trace", $info);
$this->assign("traceinfo", $traceinfo);
$data = $this->_get_common_info($info['goods_id']);
if ($data === false) {
return;
} else {
$data['cur_local'] = array(0 => array('text' => '追溯信息'));
$this->_assign_common_info($data);
}
$this->display('goods.track.index.html');
}
示例9: doRegister
public function doRegister()
{
$email = safe($_POST['email']);
$uname = safe($_POST['uname']);
$password = safe($_POST['password']);
$repassword = safe($_POST['re_password']);
if ($password != $repassword) {
redirect(U('/Public/register', $_POST), 3, '两次的密码不符');
}
$service = model('UserRegister');
$uid = $service->register($email, $uname, $password, true);
if (!$uid) {
redirect(U('/Public/register', $_POST), 3, $service->getLastError());
} else {
//redirect(U('/Public/login'), 1, '注册成功');
if ($user = model('Passport')->getLocalUser($email, $password)) {
if ($user['is_active'] == 0) {
redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
}
$result = model('Passport')->registerLogin($user);
redirect(U('wap/Index/index'));
} else {
redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入');
}
}
}
示例10: array_safe
function array_safe($array)
{
$newArray = array();
foreach ($array as $value) {
array_push($newArray, safe($value));
}
return $newArray;
}
示例11: safe_array
function safe_array( &$my_array )
{
foreach( $my_array as $key => &$value )
{
$value = safe( $value ) ;
}
return $my_array;
}
示例12: init
private static function init()
{
load_functions();
if (!build()) {
die('build directories error');
}
safe();
}
示例13: getParticipantData
function getParticipantData()
{
global $participant;
$username = safe($_GET['username']);
// participant information
$participantdata = callStoredProcedure("GetParticipantDetails('" . $username . "')");
$participant = mysqli_fetch_array($participantdata);
}
示例14: stdhead
function stdhead($title = "")
{
global $SITENAME, $pic_base_url;
header("Content-Type: text/html; charset=iso-8859-1");
// header("Pragma: No-cache");
if ($title == "") {
$title = $SITENAME . (isset($_GET['tbv']) ? " (" . TBVERSION . ")" : '');
} else {
$title = $SITENAME . (isset($_GET['tbv']) ? " (" . TBVERSION . ")" : '') . " :: " . safe($title);
}
//$stylesheet = "themes/default/default.css";
//require_once '../styles.php';
?>
<html><head>
<title>Pre-Coded Installer</title>
<link rel="stylesheet" href="themes/default/default.css" type="text/css">
<style type="text/css">
p {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
padding:0px 0px 0px 0px;
}
</style>
<script type="text/javascript">
var ClassName = "color";
var FocusColor = "#0099FF";
window.onload = function() {
var inputfields = document.getElementsByTagName("input");
for(var x = 0 ; x < inputfields.length ; x++ ) {
if(inputfields[x].getAttribute("class") == ClassName) {
inputfields[x].onfocus = function() {
OriginalColor = this.style.border;
this.style.border = "2px solid "+FocusColor;
}
inputfields[x].onblur = function() {
this.style.border = OriginalColor;
}
}
}
}
</script>
</head>
<body style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">
<?php
$w = "width=100%";
?>
<table class=mainouter <?php
$w;
?>
border="1" cellspacing="0" cellpadding="10">
<!------------- MENU ------------------------------------------------------------------------>
<?php
}
示例15: configExist
/**
Check if config is existing
**/
public function configExist($name)
{
$req = mysql_query("SELECT value FROM habbophp_config WHERE name='" . safe($name, 'SQL') . "'");
$data = mysql_fetch_assoc($req);
if ($data['value'] != null) {
return true;
}
return false;
}