Source for file post_max_size.php

Documentation is available at post_max_size.php

  1. <?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/Test/Test_Core.php');
  14.  
  15. /**
  16. * The max recommended size for the post_max_size setting, in bytes
  17. *
  18. */
  19. define ('PHPSEC_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 = PHPSEC_POST_MAXLIMIT;
  37. function _retrieveCurrentValue() {
  38. $this->current_value = $this->returnBytes(ini_get('post_max_size'));
  39. }
  40.  
  41. /**
  42. * Check to see if the post_max_size setting is enabled.
  43. */
  44. function _execTest() {
  45.  
  46. if ($this->current_value
  47. && $this->current_value < $this->recommended_value
  48. && $post_max_size != -1) {
  49. return PHPSECINFO_TEST_RESULT_OK;
  50. }
  51.  
  52. return PHPSECINFO_TEST_RESULT_NOTICE;
  53. }
  54.  
  55.  
  56. /**
  57. * Set the messages specific to this test
  58. *
  59. */
  60. function _setMessages() {
  61. parent::_setMessages();
  62.  
  63. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'post_max_size is enabled, and appears to
  64. be a relatively low value');
  65. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'post_max_size is not enabled, or is set to
  66. a high value. Allowing a large value may open up your server to denial-of-service attacks');
  67. }
  68.  
  69.  
  70. }

Documentation generated on Mon, 26 Feb 2007 10:50:03 -0500 by phpDocumentor 1.3.0RC3