global.php
程序员文章站
2022-05-13 07:58:08
...
/**
* 自动判断PHP版本,并把所有环境变量转为全局变量
*
* @author Avenger
* @version $Id 2003-05-18 13:01:14 $
*/
function pmyoutput(&$a) {
if (is_array($a)) {
array_walk($a,'pmyoutput');
} else {
$a = stripslashes($a);
$a = str_replace('"', '"', $a);
}
}
function pmyinput(&$a) {
if (is_array($a)) {
array_walk($a,'pmyinput');
} else {
$a = addslashes($a);
}
}
/*
if (phpversion()
isset($HTTP_SESSION_VARS) ? $GLOBALS['_SESSION'] = &$HTTP_SESSION_VARS : '';
isset($HTTP_SERVER_VARS) ? $GLOBALS['_SERVER'] = &$HTTP_SERVER_VARS : '';
isset($HTTP_ENV_VARS) ? $GLOBALS['_ENV'] = &$HTTP_ENV_VARS : '';
isset($HTTP_FILES_VARS) ? $GLOBALS['_FILES'] = &$HTTP_FILES_VARS : '';
if (get_magic_quotes_gpc() == 1) {
isset($HTTP_GET_VARS) ? $GLOBALS['_GET'] = &$HTTP_GET_VARS : '';
isset($HTTP_POST_VARS) ? $GLOBALS['_POST'] = &$HTTP_POST_VARS : '';
isset($HTTP_COOKIE_VARS) ? $GLOBALS['_COOKIE'] = &$HTTP_COOKIE_VARS : '';
} else {
isset($HTTP_GET_VARS) ? pmyinput($HTTP_GET_VARS) : '';
isset($HTTP_POST_VARS) ? pmyinput($HTTP_POST_VARS) : '';
isset($HTTP_COOKIE_VARS) ? pmyinput($HTTP_COOKIE_VARS) : '';
$GLOBALS['_GET'] = &$HTTP_GET_VARS;
$GLOBALS['_POST'] = &$HTTP_POST_VARS;
$GLOBALS['_COOKIE'] = &$HTTP_COOKIE_VARS;
}
$GLOBALS['_REQUEST'] = array_merge($_GET, $_POST, $_COOKIE);
} else {
if (get_magic_quotes_gpc() != 1) {
isset($_GET) ? pmyinput($_GET) : '';
isset($_POST) ? pmyinput($_POST) : '';
isset($_COOKIE) ? pmyinput($_COOKIE) : '';
isset($_REQUEST) ? pmyinput($_REQUEST) : '';
}
}
*/
?>
* 自动判断PHP版本,并把所有环境变量转为全局变量
*
* @author Avenger
* @version $Id 2003-05-18 13:01:14 $
*/
function pmyoutput(&$a) {
if (is_array($a)) {
array_walk($a,'pmyoutput');
} else {
$a = stripslashes($a);
$a = str_replace('"', '"', $a);
}
}
function pmyinput(&$a) {
if (is_array($a)) {
array_walk($a,'pmyinput');
} else {
$a = addslashes($a);
}
}
/*
if (phpversion()
isset($HTTP_SESSION_VARS) ? $GLOBALS['_SESSION'] = &$HTTP_SESSION_VARS : '';
isset($HTTP_SERVER_VARS) ? $GLOBALS['_SERVER'] = &$HTTP_SERVER_VARS : '';
isset($HTTP_ENV_VARS) ? $GLOBALS['_ENV'] = &$HTTP_ENV_VARS : '';
isset($HTTP_FILES_VARS) ? $GLOBALS['_FILES'] = &$HTTP_FILES_VARS : '';
if (get_magic_quotes_gpc() == 1) {
isset($HTTP_GET_VARS) ? $GLOBALS['_GET'] = &$HTTP_GET_VARS : '';
isset($HTTP_POST_VARS) ? $GLOBALS['_POST'] = &$HTTP_POST_VARS : '';
isset($HTTP_COOKIE_VARS) ? $GLOBALS['_COOKIE'] = &$HTTP_COOKIE_VARS : '';
} else {
isset($HTTP_GET_VARS) ? pmyinput($HTTP_GET_VARS) : '';
isset($HTTP_POST_VARS) ? pmyinput($HTTP_POST_VARS) : '';
isset($HTTP_COOKIE_VARS) ? pmyinput($HTTP_COOKIE_VARS) : '';
$GLOBALS['_GET'] = &$HTTP_GET_VARS;
$GLOBALS['_POST'] = &$HTTP_POST_VARS;
$GLOBALS['_COOKIE'] = &$HTTP_COOKIE_VARS;
}
$GLOBALS['_REQUEST'] = array_merge($_GET, $_POST, $_COOKIE);
} else {
if (get_magic_quotes_gpc() != 1) {
isset($_GET) ? pmyinput($_GET) : '';
isset($_POST) ? pmyinput($_POST) : '';
isset($_COOKIE) ? pmyinput($_COOKIE) : '';
isset($_REQUEST) ? pmyinput($_REQUEST) : '';
}
}
*/
?>
上一篇: 如何使用PHP静态方法与属性
下一篇: 用PHP实现POP3邮件的收取(三)