Subversion Repositories ggsysinfo

[/] [modules/] [sysinfo/] [lib/] [PhpSecInfo/] [Test/] [Core/] [post_max_size.php] - Blame information for rev 123

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 123 gg
<?php
2
/**
3
 * Test Class for post_max_size
4
 *
5
 * @package PhpSecInfo
6
 * @author Ed Finkler <coj@funkatron.com>
7
 */
8
 
9
 
10
/**
11
 * require the PhpSecInfo_Test_Core class
12
 */
13
require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php');
14
 
15
/**
16
 * The max recommended size for the post_max_size setting, in bytes
17
 *
18
 */
19
define ('PHPSECINFO_POST_MAXLIMIT', 1024*256);
20
 
21
/**
22
 * Test Class for post_max_size
23
 *
24
 * @package PhpSecInfo
25
 */
26
class PhpSecInfo_Test_Core_Post_Max_Size extends PhpSecInfo_Test_Core
27
{
28
 
29
        /**
30
         * This should be a <b>unique</b>, human-readable identifier for this test
31
         *
32
         * @var string
33
         */
34
        var $test_name = "post_max_size";
35
 
36
        var $recommended_value = PHPSECINFO_POST_MAXLIMIT;
37
 
38
        function _retrieveCurrentValue() {
39
                $this->current_value =  $this->returnBytes(ini_get('post_max_size'));
40
        }
41
 
42
        /**
43
         * Check to see if the post_max_size setting is enabled.
44
         */
45
        function _execTest() {
46
 
47
                if ($this->current_value
48
                        && $this->current_value <= $this->recommended_value
49
                        && $post_max_size != -1) {
50
                        return PHPSECINFO_TEST_RESULT_OK;
51
                }
52
 
53
                return PHPSECINFO_TEST_RESULT_NOTICE;
54
        }
55
 
56
 
57
        /**
58
         * Set the messages specific to this test
59
         *
60
         */
61
        function _setMessages() {
62
                parent::_setMessages();
63
 
64
                $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'post_max_size is enabled, and appears to
65
                                be a relatively low value');
66
                $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'post_max_size is not enabled, or is set to
67
                                a high value.  Allowing a large value may open up your server to denial-of-service attacks');
68
        }
69
 
70
 
71
}