當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。