blob: b1bcf2b4aa8960dee7087274583dc34b9d33de11 [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
46.. note:: This function was formerly named dohash(), which has been
freewil8840c962012-03-18 15:23:09 -040047 removed in favor of `do_hash()`.
Derek Jones8ede1a22011-10-05 13:34:52 -050048
49strip_image_tags()
50==================
51
52This is a security function that will strip image tags from a string. It
53leaves the image URL as plain text.
54
55::
56
57 $string = strip_image_tags($string);
58
59encode_php_tags()
60=================
61
62This is a security function that converts PHP tags to entities. Note: If
63you use the XSS filtering function it does this automatically.
64
65::
66
67 $string = encode_php_tags($string);
68