PHP GET/POST MGR


SUBMITTED BY: Guest

DATE: July 8, 2013, 6:51 p.m.

FORMAT: PHP

SIZE: 955 Bytes

HITS: 1131

  1. <?php
  2. class get_post {
  3. private $_post;
  4. private $_get;
  5. public function __construct() {
  6. $this->_post = $_POST;
  7. $this->_get = $_GET;
  8. //$_GET = array();
  9. //$_POST = array();
  10. }
  11. public function is_key($key, $type = "get") {
  12. if($type == "get") {
  13. if(isset($this->_get[$key])) return 1;
  14. else return 0;
  15. }
  16. elseif($type == "post") {
  17. if(isset($this->_post[$key])) return 1;
  18. else return 0;
  19. }
  20. else return -1;
  21. }
  22. public function get_key($key, $type = "get" ) {
  23. if($type == "get") {
  24. return $this->_get[$key];
  25. }
  26. elseif($type == "post") {
  27. return $this->_post[$key];
  28. }
  29. else return -1;
  30. }
  31. public function get_all_keys($type = "get") {
  32. if($type == "get") {
  33. return $this->_get;
  34. }
  35. elseif($type == "post") {
  36. return $this->_post;
  37. }
  38. else return -1;
  39. }
  40. }
  41. ?>

comments powered by Disqus