blob: 01018c61ac12e563864a151e7e324a5c53af982a [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
37Permits you to create SHA1 or MD5 one way hashes suitable for encrypting
38passwords. 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
48strip_image_tags()
49==================
50
51This is a security function that will strip image tags from a string. It
52leaves the image URL as plain text.
53
54::
55
56 $string = strip_image_tags($string);
57
58encode_php_tags()
59=================
60
61This is a security function that converts PHP tags to entities. Note: If
62you use the XSS filtering function it does this automatically.
63
64::
65
66 $string = encode_php_tags($string);
67