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


PHP _addslashes函數代碼示例

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


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

示例1: _addslashes

function _addslashes($arr) {
    foreach($arr as $k=>$v) {
        if(is_string($v)) {
            $arr[$k] = addslashes($v);
        } else if(is_array($v)) {  // 再加判斷,如果是數組,調用自身,再轉
            $arr[$k] = _addslashes($v);
        }
    }
    
    return $arr;
}
開發者ID:xiaoxiaoJun,項目名稱:phpper,代碼行數:11,代碼來源:lib_base.php

示例2: _addslashes

function _addslashes($arr){
	foreach($arr as $key=>$value){
		if(is_string($value)){
			$arr[$key] = addslashes($arr[$key]);
		}else if(is_array($value)){
			$arr[$key] = _addslashes($value);
		}

		return $arr;

	}
}
開發者ID:xiaoxiaoJun,項目名稱:phpper,代碼行數:12,代碼來源:多維數組字符串轉義.php

示例3: _addslashes

/**
 * 遞歸轉義數組
 * @param array $arr
 * @return array
 */
function _addslashes($arr)
{
    foreach ($arr as $key => $v) {
        if (is_string($v)) {
            $arr[$key] = addslashes($v);
        } elseif (is_array($v)) {
            //先寫一個一維的轉義函數再加一個遞歸
            $arr[$key] = _addslashes($v);
        }
    }
    return $arr;
}
開發者ID:KevinZY,項目名稱:mall,代碼行數:17,代碼來源:lib_base.php

示例4: _addslashes

function _addslashes($arr)
{
    foreach ($arr as $index => $element) {
        if (is_string($element)) {
            $arr[$index] = addslashes($element);
        } else {
            if (is_array($element)) {
                $arr[$index] = _addslashes($element);
            }
        }
    }
    return $arr;
}
開發者ID:qiushuiqs,項目名稱:myshop,代碼行數:13,代碼來源:lib.base.php

示例5: _addslashes

function _addslashes($value)
{
    $magic_quotes_gpc = get_magic_quotes_gpc();
    if (is_array($value)) {
        foreach ($value as $k => $v) {
            $value[$k] = _addslashes($v);
        }
        return $value;
    }
    if ($magic_quotes_gpc) {
        return $value;
    }
    return addslashes($value);
}
開發者ID:BGCX261,項目名稱:zhwphp-svn-to-git,代碼行數:14,代碼來源:common.func.php

示例6: _addslashes

/**
 * [_addslashes 自動轉義]
 * @param  [array] $arr [要轉義的數組]
 * @return [array]      [返回轉義後的數組]
 */
function _addslashes($arr)
{
    foreach ($arr as $k => $v) {
        //如果不是數組直接轉義
        if (is_string($v)) {
            $arr[$k] = addslashes($v);
        }
        //如果是數組則遞歸轉義
        if (is_array($v)) {
            $arr[$k] = _addslashes($v);
        }
    }
    //原樣輸出
    return $arr;
}
開發者ID:neilchou,項目名稱:phpbase,代碼行數:20,代碼來源:lib_base.php

示例7: _addslashes

function _addslashes($arr)
{
    foreach ($arr as $key => $value) {
        if (is_string($value)) {
            //數組元素是一個字符串 直接轉義即可
            $arr[$key] = addslashes($value);
        } else {
            if (is_array($value)) {
                //數組元素是數組 遞歸轉義
                $arr[$key] = _addslashes($value);
            } else {
                //數組元素存在其他元素 屬於錯誤情況
                return NULL;
            }
        }
    }
    return $arr;
}
開發者ID:hsshhsshhssh,項目名稱:bianli,代碼行數:18,代碼來源:lib_base.php

示例8: _implode

/**
 * 二維數組 轉換為 seage 
 */
function _implode(array $pieces)
{
    //[_implode]
    $str = null;
    foreach ($pieces as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $vv) {
                $str .= $k . ':' . _addslashes($vv) . ';';
            }
        } elseif (false !== stripos($v, ',')) {
            $str .= "{$k}:" . str_replace(',', ";{$k}:", $v) . ';';
        } else {
            $str .= $k . ':' . _addslashes($v) . ';';
        }
    }
    return $str;
}
開發者ID:slumbersoul,項目名稱:gnw-weixin,代碼行數:20,代碼來源:function.php

示例9: exit

@session_start();
if (isset($_REQUEST['GLOBALS'])) {
    exit('Request tainting attempted.');
}
//程序目錄(有/)
define('WEB_ROOT', str_replace(array('\\', '//'), array('/', '/'), dirname(__FILE__) . DIRECTORY_SEPARATOR));
//網站URL(無/)
define('WEB_URL', 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')));
//當前文件名(無後綴)
define('FILE', basename($_SERVER['PHP_SELF'], '.php'));
//包含基本文件,設置包含路徑
include WEB_ROOT . 'config.inc.php';
set_include_path(get_include_path() . PATH_SEPARATOR . WEB_ROOT . 'include');
include 'common.func.php';
//數據庫連接
include 'Mysql.class.php';
$db = new Mysql($db_config);
//memcache支持
//$MC = new Memcache();
//$MC->connect($MC_config['MC_HOST'],$MC_config['MC_PORT']) or die('can not connect Memcache');
//時間
$mtime = explode(' ', microtime());
define('TIMESTAMP', $mtime[0]);
define('MICROTIME', (double) $mtime[0] + (double) $mtime[1]);
//GPC過濾
define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
if (!MAGIC_QUOTES_GPC) {
    foreach (array($_GET, $_POST, $_REQUEST, $_COOKIE) as $v) {
        $v = _addslashes($v);
    }
}
開發者ID:BGCX261,項目名稱:zhwphp-svn-to-git,代碼行數:31,代碼來源:common.inc.php

示例10: foreach

    $tlbrset = $_POST['tlbrset'];
    $resultString = "";
    $_string = '';
    foreach ($tlbrset as $tlbrname => $tlbr) {
        $resultString .= $tlbrname . ":";
        $resultString .= $tlbr['show'] . ",";
        $resultString .= $tlbr['docked'] . ",";
        $resultString .= "[";
        foreach ($tlbr['position'] as $tlbrpos) {
            $resultString .= (substr($tlbrpos, -2) == "px" ? substr($tlbrpos, 0, -2) : $tlbrpos) . ";";
        }
        $resultString .= "]";
        $resultString .= "||";
    }
    $resultString = substr($resultString, 0, -2);
    CUserOptions::SetOption("fileman", "toolbar_settings_" . $edname, _addslashes($resultString));
}
if (isset($_REQUEST['tooltips']) && $target == 'tooltips') {
    CUserOptions::SetOption("fileman", "show_tooltips" . $edname, $_REQUEST['tooltips'] == "N" ? "N" : "Y");
}
if (isset($_REQUEST['visual_effects']) && $target == "visual_effects") {
    CUserOptions::SetOption("fileman", "visual_effects" . $edname, $_REQUEST['visual_effects'] == "N" ? "N" : "Y");
}
if (isset($_REQUEST['render_components']) && $target == 'render_components') {
    CUserOptions::SetOption("fileman", "render_components", $_REQUEST['render_components'] == "Y");
}
if ($target == 'taskbars') {
    // Taskbars
    if (isset($_POST['tskbrset'])) {
        $taskbars = $_POST['tskbrset'];
        $res = array();
開發者ID:spas-viktor,項目名稱:books,代碼行數:31,代碼來源:fileman_manage_settings.php

示例11: _addslashes

function _addslashes($string, $force = 0)
{
    !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
    if (!MAGIC_QUOTES_GPC || $force) {
        if (is_array($string)) {
            foreach ($string as $key => $val) {
                $string[$key] = _addslashes($val, $force);
            }
        } else {
            $string = addslashes($string);
        }
    }
    return $string;
}
開發者ID:baiduXM,項目名稱:agent,代碼行數:14,代碼來源:global.functions.php

示例12: Finput

function Finput($type = 'request', $field = null, $default = null, $time = null)
{
    switch ($type) {
        //_REQUEST數據
        case 'request':
            //GET方式請求
            if ($_SERVER['REQUEST_METHOD'] == 'GET') {
                //方式
                $urlencode = config('URL_ENCODE') ? config('URL_ENCODE') : false;
                if ($urlencode) {
                    //GET方式判斷是否URL編碼
                    foreach ($_REQUEST as $key => $val) {
                        //解碼url參數
                        $_REQUEST[$key] = urldecode($val);
                    }
                }
            }
            if (!empty($field)) {
                @($data = $_REQUEST[$field] ? $_REQUEST[$field] : $default);
            } else {
                @($data = $_REQUEST);
            }
            break;
            //_POST數據
        //_POST數據
        case 'post':
            if (!empty($field)) {
                @($data = $_POST[$field] ? $_POST[$field] : $default);
            } else {
                @($data = $_POST);
            }
            break;
            //_GET數據
        //_GET數據
        case 'get':
            //GET方式請求
            $urlencode = config('URL_ENCODE') ? config('URL_ENCODE') : false;
            if ($urlencode) {
                //GET方式判斷是否URL編碼
                foreach ($_GET as $key => $val) {
                    //解碼url參數
                    $_GET[$key] = urldecode($val);
                }
            }
            if (!empty($field)) {
                @($data = $_GET[$field] ? $_GET[$field] : $default);
            } else {
                @($data = $_GET);
            }
            break;
            //_PUT數據
        //_PUT數據
        case 'put':
            if (!empty($field)) {
                @($data = $_PUT[$field] ? $_PUT[$field] : $default);
            } else {
                @($data = $_PUT);
            }
            break;
            //COOKIE數據
        //COOKIE數據
        case 'cookie':
            if (!empty($field)) {
                @($data = $_COOKIE[$field] ? $_COOKIE[$field] : set_cookies($field, $default, $time));
            } else {
                @($data = $_COOKIE);
            }
            break;
            //SESSION數據
        //SESSION數據
        case 'session':
            @session_start();
            if (!empty($field)) {
                @($data = $_SESSION[$field] ? $_SESSION[$field] : $default);
            } else {
                @($data = $_SESSION);
            }
            break;
            //SERVER數據
        //SERVER數據
        case 'server':
            if (!empty($field)) {
                @($data = $_SERVER[$field] ? $_SERVER[$field] : $default);
            } else {
                @($data = $_SERVER);
            }
            break;
    }
    //遞歸轉義數據
    return _addslashes($data);
}
開發者ID:xinlianit,項目名稱:myMiniFrame,代碼行數:91,代碼來源:function.php

示例13: _addslashes

/* $Id$ */
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
// Matthew Gregg
// <greggmc at musc.edu>
require_once "./phpESP.first.php";
$_name = '';
$_title = '';
$_css = '';
$sid = '';
if (isset($_GET['name'])) {
    $_name = _addslashes($_GET['name']);
    unset($_GET['name']);
    $_SERVER['QUERY_STRING'] = preg_replace('/(^|&)name=[^&]*&?/', '', $_SERVER['QUERY_STRING']);
}
if (isset($_POST['name'])) {
    $_name = _addslashes($_POST['name']);
    unset($_POST['name']);
}
if (!empty($_name)) {
    $_sql = "SELECT id,title,theme FROM " . $GLOBALS['ESPCONFIG']['survey_table'] . " WHERE name = {$_name}";
    if ($_result = execute_sql($_sql)) {
        if (record_count($_result) > 0) {
            list($sid, $_title, $_css) = fetch_row($_result);
        }
        db_close($_result);
    }
    unset($_sql);
    unset($_result);
}
// To make all results public uncomment the next line.
//$results = 1;
開發者ID:idolcemia,項目名稱:phpESP,代碼行數:31,代碼來源:survey.php

示例14: _addslashes

            if ($_POST['password'] != "") {
                $_SESSION['raw_password'] = $_POST['password'];
            }
        }
        if (isset($_SESSION['username'])) {
            $username = $_SESSION['username'];
        } else {
            $username = "";
        }
        if (isset($_SESSION['raw_password'])) {
            $raw_password = $_SESSION['raw_password'];
        } else {
            $raw_password = "";
        }
    }
    $password = _addslashes($raw_password);
    if (!manage_auth($username, $password, $raw_password)) {
        exit;
    }
} else {
    $_SESSION['acl'] = array('username' => 'none', 'pdesign' => array('none'), 'pdata' => array('none'), 'pstatus' => array('none'), 'pall' => array('none'), 'pgroup' => array('none'), 'puser' => array('none'), 'superuser' => 'Y', 'disabled' => 'N');
}
if (empty($where) && isset($_REQUEST['where'])) {
    $where = $_REQUEST['where'];
}
if ($where == 'download') {
    include esp_where($where);
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
開發者ID:idolcemia,項目名稱:phpESP,代碼行數:31,代碼來源:manage.php

示例15: intval

     }
     if (isset($_SESSION['espuser'])) {
         $espuser = $_SESSION['espuser'];
     } else {
         $espuser = "";
     }
     if (isset($_REQUEST['password']) && $_REQUEST['password'] != "") {
         $_SESSION['esppass'] = $_REQUEST['password'];
     }
     if (isset($_SESSION['esppass'])) {
         $esppass = $_SESSION['esppass'];
     } else {
         $esppass = "";
     }
 }
 if (!survey_auth($sid, $espuser, _addslashes($esppass), $esppass, $_css, $_title)) {
     return;
 }
 if (auth_get_option('resume')) {
     $_SESSION['rid'] = auth_get_rid($sid, $espuser, $request_rid);
     if (!empty($_SESSION['rid']) && (!isset($_SESSION['sec']) || empty($_SESSION['sec']) || intval($_SESSION['sec']) < 1)) {
         $section_to_return_to = response_select_max_sec($sid, $_SESSION['rid']);
         // we let people return to previously filled in sections
         // if defined in the URL request
         if (isset($_GET['sec']) && intval($_GET['sec']) > 0 && $_GET['sec'] <= $section_to_return_to) {
             $_SESSION['sec'] = intval($_GET['sec']);
         } else {
             $_SESSION['sec'] = $section_to_return_to;
         }
     }
 }
開發者ID:idolcemia,項目名稱:phpESP,代碼行數:31,代碼來源:handler-prefix.php


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