function auto_addslashes(&$array)
{
    if ($array) {
        foreach ($array as $key => $value) {
            if (!is_array($value)) {
                $array[$key] = addslashes($value);
            } else {
                auto_addslashes($array[$key]);
            }
        }
    }
}
예제 #2
0
//防止变量覆盖
foreach ($_REQUEST as $_k => $_v) {
    if (strlen($_k) > 0 && preg_match('/^(cfg_|GLOBALS)/i', $_k)) {
        exit('Request var not allow!');
    }
}
//加载常量定义库
require_once PATH_ADMIN . '/config/cfg_constants.php';
// 加载函数库
require_once PATH_APPLICATION . '/pm_core_functions.php';
// 自动转义
if (@function_exists(auto_addslashes)) {
    auto_addslashes($_POST);
    auto_addslashes($_GET);
    auto_addslashes($_COOKIE);
    auto_addslashes($_REQUEST);
}
//加载相关文件
require_once PATH_CONFIG . '/cfg_database.php';
require_once PATH_APPLICATION . '/pm_router.php';
require_once includesqlfile();
//加载数据库文件
require_once PATH_MODULE . '/smarty/Smarty.class.php';
require_once PATH_APPLICATION . '/pm_tpl.php';
defined('DEBUG_LEVEL') || define('DEBUG_LEVEL', TRUE);
defined('HOST') || define('HOST', 'http://' . $_SERVER['HTTP_HOST']);
$path_info = pathinfo($_SERVER['PHP_SELF']);
$path_x = rtrim(strtr($path_info['dirname'], array('\\' => '/')), '/');
//URL定义
defined('URL') || define('URL', 'http://' . $_SERVER['HTTP_HOST'] . $path_x);
defined('VERIFY_CODE') || define('VERIFY_CODE', mod_config::get_one_config('fl_verify_code'));