色欲av免费一区二区三区|人妻丰满熟妇av欧无码区免费|免费看A片无码不卡福利视频6080|久久京东热AV男人的天堂|

            <sub id="j9vn7"><nobr id="j9vn7"></nobr></sub>

                  <form id="j9vn7"><nobr id="j9vn7"></nobr></form>

                      <address id="j9vn7"></address>

                          <address id="j9vn7"></address>

                            <form id="j9vn7"></form>
                            <form id="j9vn7"><nobr id="j9vn7"><nobr id="j9vn7"></nobr></nobr></form>

                            <form id="j9vn7"></form>

                              <form id="j9vn7"></form>

                              中山php|最優網絡中山做網站 中山php建站

                              最優良人

                              2012/11/24 at 17:16

                              php過濾客戶提交參數,防注入

                              以下代碼實現過濾php的$_GET 和$_POST參數

                              /**
                              * 安全防范
                              */
                              function Add_S($array)
                              {
                              foreach($array as $key=>$value)
                              {
                              if(!is_array($value))
                              {
                              $value = get_magic_quotes_gpc()?$value:addslashes($value);
                              $array[$key]=filterHtml($value);
                              }
                              Else
                              {
                              Add_S($array[$key]);
                              }
                              }
                              return $array;
                              }
                              function glstr($var) {

                              if (is_array($var)) {
                              return Add_S($var);
                              }
                              elseif(strlen($var)){
                              $var = get_magic_quotes_gpc()?$var:addslashes($var);

                              $var = filterHtml($var);
                              }
                              return $var;
                              }
                              function filterHtml($html)
                              {
                              $farr = array(
                              "/<!DOCTYPE([^>]*?)>/eis",
                              "/<(\/?)(html|body|head|link|meta|base|input)([^>]*?)>/eis",
                              "/<(script|i?frame|style|title|form)(.*?)<\/\\1>/eis",
                              "/(<[^>]*?\s+)on[a-z]+\s*?=(\"|')([^\\2]*)\\2([^>]*?>)/isU",//過濾javascript的on事件
                              "/\s+/",//過濾多余的空白
                              );
                              $tarr = array(
                              "",
                              "",
                              "",
                              "\\1\\4",
                              " ",
                              );
                              $html = preg_replace( $farr,$tarr,$html);
                              return $html;
                              }
                              if (sizeof($_GET)) {
                              foreach($_GET as $key => $value) {
                              $_GET[$key] = glstr($value); //
                              }

                              }
                              if (sizeof($_POST)) {
                              foreach($_POST as $key => $value) {
                              $_POST[$key] = glstr($value); //
                              }
                              }

                              標簽:,
                              -

                                        <sub id="j9vn7"><nobr id="j9vn7"></nobr></sub>

                                              <form id="j9vn7"><nobr id="j9vn7"></nobr></form>

                                                  <address id="j9vn7"></address>

                                                      <address id="j9vn7"></address>

                                                        <form id="j9vn7"></form>
                                                        <form id="j9vn7"><nobr id="j9vn7"><nobr id="j9vn7"></nobr></nobr></form>

                                                        <form id="j9vn7"></form>

                                                          <form id="j9vn7"></form>