日期:2012-10-19  浏览次数:20650 次

<?php
/*____生成HTML文件________beign__________*/
if ($make_html)
{
        $buffer = ob_get_flush();
        if ($go_html)//是否直接转到HTML文件显示还是PHP读得内容输出(0:php读内容输出1:直接转)
        {
                /*__处理因生成了HTML文件而产生的种径问题______begin_______*/
                $search = array(
                        "/(src=|action=|href=|ajaxRead\()\"/ie",
                        "/\.\.\./e",
                        "/\.\/\./e",
                        "/\.\.\/http:\/\//ies",
                        "/\.\.\/#/",
                        "/\'\.\'/e",
                        "/\.\.\/javascript:/ies");

                $replace = array(
                        "'\\1\"../'",
                        "'..'",
                        "'.'",
                        "'http://'",
                        "#",
                        "'\'..\''",
                        "'javascript:'");
                $buffer = preg_replace($search, $replace, $buffer);
                /*___处理因生成了HTML文件而产生的种径问题_____end_____*/
        }

        $fp = fopen(HTML_FILE, "w");
        if ($fp)
        {
                fwrite($fp, $buffer);
                fclose($fp);
        }
}
/*_______生成HTML文件_________beign________*/
?>

<?php
ob_start();
/*____判断是否已生成了HTML文件,若生成了则跳转到HTML页面___begin_____*/
$qstring = isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : "";
if ($qstring)//程序加了GET请求的处理
{
 &