Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 1 | ############### |
| 2 | Security Helper |
| 3 | ############### |
| 4 | |
| 5 | The Security Helper file contains security related functions. |
| 6 | |
| 7 | .. contents:: Page Contents |
| 8 | |
| 9 | Loading this Helper |
| 10 | =================== |
| 11 | |
| 12 | This helper is loaded using the following code |
| 13 | |
| 14 | :: |
| 15 | |
| 16 | $this->load->helper('security'); |
| 17 | |
| 18 | The following functions are available: |
| 19 | |
| 20 | xss_clean() |
| 21 | =========== |
| 22 | |
| 23 | Provides Cross Site Script Hack filtering. This function is an alias to |
| 24 | the one in the :doc:`Input class <../libraries/input>`. More info can |
| 25 | be found there. |
| 26 | |
| 27 | sanitize_filename() |
| 28 | =================== |
| 29 | |
| 30 | Provides protection against directory traversal. This function is an |
| 31 | alias to the one in the :doc:`Security class <../libraries/security>`. |
| 32 | More info can be found there. |
| 33 | |
| 34 | do_hash() |
| 35 | ========= |
| 36 | |
| 37 | Permits you to create SHA1 or MD5 one way hashes suitable for encrypting |
| 38 | passwords. Will create SHA1 by default. Examples |
| 39 | |
| 40 | :: |
| 41 | |
| 42 | $str = do_hash($str); // SHA1 |
| 43 | $str = do_hash($str, 'md5'); // MD5 |
| 44 | |
| 45 | .. note:: This function was formerly named dohash(), which has been |
| 46 | deprecated in favor of `do_hash()`. |
| 47 | |
| 48 | strip_image_tags() |
| 49 | ================== |
| 50 | |
| 51 | This is a security function that will strip image tags from a string. It |
| 52 | leaves the image URL as plain text. |
| 53 | |
| 54 | :: |
| 55 | |
| 56 | $string = strip_image_tags($string); |
| 57 | |
| 58 | encode_php_tags() |
| 59 | ================= |
| 60 | |
| 61 | This is a security function that converts PHP tags to entities. Note: If |
| 62 | you use the XSS filtering function it does this automatically. |
| 63 | |
| 64 | :: |
| 65 | |
| 66 | $string = encode_php_tags($string); |
| 67 | |