blob: ec0be28b3f2ec3e003fa0cb2ae9292c4612fa566 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001###############
2Security Helper
3###############
4
5The Security Helper file contains security related functions.
6
7.. contents:: Page Contents
8
9Loading this Helper
10===================
11
12This helper is loaded using the following code
13
14::
15
16 $this->load->helper('security');
17
18The following functions are available:
19
20xss_clean()
21===========
22
23Provides Cross Site Script Hack filtering. This function is an alias to
24the one in the :doc:`Input class <../libraries/input>`. More info can
25be found there.
26
27sanitize_filename()
28===================
29
30Provides protection against directory traversal. This function is an
31alias to the one in the :doc:`Security class <../libraries/security>`.
32More info can be found there.
33
34do_hash()
35=========
36
freewil8840c962012-03-18 15:23:09 -040037Permits you to create one way hashes suitable for encrypting
38passwords. Will create SHA1 by default. See `hash_algos() <http://php.net/function.hash_algos>`_
39for a full list of supported algorithms.
Derek Jones8ede1a22011-10-05 13:34:52 -050040
41::
42
43 $str = do_hash($str); // SHA1
44 $str = do_hash($str, 'md5'); // MD5
45
Andrey Andreev0f0b7692012-06-07 14:57:04 +030046.. note:: This function was formerly named ``dohash()``, which has been
47 removed in favor of ``do_hash()``.
48
49.. note:: This function is DEPRECATED. Use the native ``hash()`` instead.
Derek Jones8ede1a22011-10-05 13:34:52 -050050
51strip_image_tags()
52==================
53
54This is a security function that will strip image tags from a string. It
55leaves the image URL as plain text.
56
57::
58
59 $string = strip_image_tags($string);
60
61encode_php_tags()
62=================
63
64This is a security function that converts PHP tags to entities. Note: If
65you use the XSS filtering function it does this automatically.
66
67::
68
69 $string = encode_php_tags($string);
70