[ create a new paste ] login | about

Link: http://codepad.org/QLNNM87i    [ raw code | output | fork ]

PHP, pasted on Aug 15:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
function cleanInput($input) {

  $search = array(
    '@<script[^>]*?>.*?</script>@si',   // Strip out javascript
    '@<[\/\!]*?[^<>]*?>@si',            // Strip out HTML tags
    '@<style[^>]*?>.*?</style>@siU',    // Strip style tags properly
    '@<![\s\S]*?--[ \t\n\r]*>@'         // Strip multi-line comments
  );

    $output = preg_replace($search, '', $input);
    return $output;
  }

var_dump(cleanInput('<<>script>alert("xss")</<>script>'));


Output:
1
string(29) "<script>alert("xss")</script>"


Create a new paste based on this one


Comments: