当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter::XSSFilter方法代码示例

本文整理汇总了PHP中Filter::XSSFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::XSSFilter方法的具体用法?PHP Filter::XSSFilter怎么用?PHP Filter::XSSFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filter的用法示例。


在下文中一共展示了Filter::XSSFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * gets/returns the value of a specific key of the session
  *
  * @param mixed $key Usually a string, right ?
  * @return mixed the key's value or nothing
  */
 public static function get($key)
 {
     if (isset($_SESSION[$key])) {
         $value = $_SESSION[$key];
         // filter the value for XSS vulnerabilities
         return Filter::XSSFilter($value);
     }
 }
开发者ID:AstroTheCoder,项目名称:huge,代码行数:14,代码来源:Session.php

示例2: get

 /**
  * gets/returns the value of a specific key of the session
  *
  * @param mixed $key Usually a string, right ?
  * @return mixed the key's value or nothing
  */
 public static function get($key)
 {
     if (isset($_SESSION[$key])) {
         if (is_string($_SESSION[$key])) {
             // filter the value for XSS vulnerabilities
             Filter::XSSFilter($_SESSION[$key]);
             return $_SESSION[$key];
         } else {
             return $_SESSION[$key];
         }
     }
 }
开发者ID:morashid92,项目名称:Huge,代码行数:18,代码来源:Session.php

示例3: get

 /**
  * gets/returns the value of a specific key of the session
  *
  * @param mixed $key Usually a string, right ?
  * @return mixed the key's value or nothing
  */
 public static function get($key)
 {
     if (isset($_SESSION[$key])) {
         if (is_string($_SESSION[$key])) {
             // filter the value for XSS vulnerabilities
             if ($key == "Error-text") {
                 // Error-text is formatted, but set by the server. It is exempt from processing, which mangles it.
                 return $_SESSION[$key];
             }
             Filter::XSSFilter($_SESSION[$key]);
             return $_SESSION[$key];
         } else {
             return $_SESSION[$key];
         }
     }
 }
开发者ID:alexanderkjackson-eagles,项目名称:application,代码行数:22,代码来源:Session.php

示例4: testXSSFilterWithBadCode

 /**
  * When argument contains bad code the encoded (and therefore un-dangerous) string should be returned
  */
 public function testXSSFilterWithBadCode()
 {
     $codeBefore = "Hello <script>var http = new XMLHttpRequest(); http.open('POST', 'example.com/my_account/delete.php', true);</script>";
     $codeAfter = "Hello &lt;script&gt;var http = new XMLHttpRequest(); http.open(&#039;POST&#039;, &#039;example.com/my_account/delete.php&#039;, true);&lt;/script&gt;";
     $this->assertEquals($codeAfter, Filter::XSSFilter($codeBefore));
 }
开发者ID:evdevgit,项目名称:huge,代码行数:9,代码来源:FilterTest.php


注:本文中的Filter::XSSFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。