Req.php 671 B

1234567891011121314151617181920212223242526
  1. <?php
  2. class Req{
  3. public static function filt($data, $type = "STRING", $len = -1){
  4. return Filter::act($data, $type, $len);
  5. }
  6. public static function get($field, $type = "STRING", $len = -1){
  7. if(isset($_GET[$field]))
  8. return self::filt($_GET[$field], $type, $len);
  9. return null;
  10. }
  11. public static function post($field, $type = "HTML_ESCAPED", $len = -1){
  12. if(isset($_POST[$field]))
  13. return self::filt($_POST[$field], $type, $len);
  14. return null;
  15. }
  16. public static function input(){
  17. if (file_get_contents('php://input')) {
  18. return self::filt(json_decode(file_get_contents('php://input'), true));
  19. }
  20. return null;
  21. }
  22. }