• 非法字符替换类


    简介:这是非法字符替换类的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=323735' scrolling='no'> <?php

    //********************************************************
    //-- 程序名称:StrSwap V1.01
    //-- 程序编写:cngift@163.com
    //-- 完成: 2002-8-1
    //-- 程序用途:Get或Post提交值的非法数据处理
    //-- 备注: 本程序需要加载在所有程序处理前使用,以便自动进行
    //-- 程序中使用的变量的替换
    //-- 由于发现严重BUG紧急升级
    //-- Copyright By cngift ◎ 2002
    //********************************************************

    class StrSwap{

    //当以Get方式提交变量时用于连接变量的连接符
    var $GetSplitStr = "&&";
    var $TempArray = array();
    var $VariableArray = array();

    //********************************************************
    //-- 程序名称:Main()
    //-- 程序用途:本类的默认运行方式
    //-- 传入参数:无
    //********************************************************

    function Main(){

    global $REQUEST_METHOD;
    if("GET"==$REQUEST_METHOD){

    $this->SubGetStrToArray();

    }
    if("POST"==$REQUEST_METHOD){

    $this->SubPostStrToArray();

    }

    $this->GlobalVariable();



    }

    //********************************************************
    //-- 程序名称:SubGetStrToArray()
    //-- 程序用途:当变量以Get方式提交时所调用的方法
    //-- 传入参数:无
    //********************************************************

    function SubGetStrToArray(){

    global $QUERY_STRING;
    $this->TempArray = explode($this->GetSplitStr,$QUERY_STRING);

    for($i=0;$i<sizeof($this->TempArray);$i++){

    $temp = explode('=',$this->TempArray[$i]);
    $this->VariableArray[$i][0] = $temp[0];
    $this->VariableArray[$i][1] = $this->StrReplace($temp[1]);

    }

    }

    //********************************************************
    //-- 程序名称:SubPostStrToArray()
    //-- 程序用途:当变量以POST方式提交时所调用的方法
    //-- 传入参数:无
    //********************************************************

    function SubPostStrToArray(){

    global $_POST;
    reset($_POST);
    for($i=0;$i<count($_POST);$i++){

    $this->VariableArray[$i][0] = key($_POST);
    $this->VariableArray[$i][1] = $this->StrReplace($_POST[key($_POST)]);
    next($_POST);
    }

    }

    //********************************************************
    //-- 程序名称:StrReplace()
    //-- 程序用途:替换变量中的非法字符
    //-- 传入参数:变量值
    //********************************************************

    function StrReplace($str){

    $str = StripSlashes($str);
    $str = str_replace(chr(92),'',$str);
    $str = str_replace(chr(47),'',$str);
    $str = str_replace(chr(10).chr(13),"<br>",$str);
    $str = str_replace('<',"&lt;",$str);
    $str = str_replace('>',"&gt;",$str);
    $str = str_replace(';',";",$str);
    $str = str_replace('"',"“",$str);
    $str = str_replace("'","‘",$str);
    $str = str_replace(" "," ",$str);
    $str = str_replace("/**/"," ",$str);

    return trim($str);

    }

    //********************************************************
    //-- 程序名称:GlobalVariable()
    //-- 程序用途:声明变量为全局变量方便其他程序调用
    //-- 传入参数:无
    //********************************************************

    function GlobalVariable(){

    for($i=0;$i<sizeof($this->VariableArray);$i++){

    global $$this->VariableArray[$i][0];
    ${$this->VariableArray[$i][0]} = $this->VariableArray[$i][1];

    }

    }

    }

    ?>

    “非法字符替换类”的更多相关文章 》

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/323735.html pageNo:16
  • 相关阅读:
    provider: Shared Memory Provider, error: 0
    用户 'sa' 登录失败。 (Microsoft SQL Server,错误: 18456)
    从sqlite 迁移到mysql报错,处理 D:seafile-server_5.0.3_win32seafile-server-5.0.3seahubsql 重新执行这个SQL
    org.apache.jasper.runtime.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
    java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation
    无法完成操作。服务无法在此时接受控制信息。
    MyEclipse出现Unable to install breakpoint in...
    ERROR 1364 (HY000): Field 'id' doesn't have a default value
    各地都在搞大数据,你的家乡有啥特色没——解读2017年地方政府大数据报告
    HTML5桌面通知:notification
  • 原文地址:https://www.cnblogs.com/ooooo/p/2255884.html
Copyright © 2020-2023  润新知