get.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * scientia
  4. *
  5. * Copyright 2023 - 2024 Johannes Keßler
  6. *
  7. * https://www.bananas-playground.net/projekt/scientia/
  8. *
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  12. *
  13. * You should have received a copy of the
  14. * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
  15. * along with this program. If not, see http://www.sun.com/cddl/cddl.html
  16. */
  17. /**
  18. * get endpoint. Accepts only GET and returns data
  19. */
  20. mb_http_output('UTF-8');
  21. mb_internal_encoding('UTF-8');
  22. ini_set('error_reporting',-1); // E_ALL & E_STRICT
  23. ## check request
  24. $_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW);
  25. if(!empty($_urlToParse)) {
  26. # see http://de2.php.net/manual/en/regexp.reference.unicode.php
  27. if(preg_match('/[\p{C}\p{M}\p{Sc}\p{Sk}\p{So}\p{Zl}\p{Zp}]/u',$_urlToParse) === 1) {
  28. die('Malformed request. Make sure you know what you are doing.');
  29. }
  30. }
  31. ## config
  32. require_once('config/config.php');
  33. ## set the error reporting
  34. ini_set('log_errors',true);
  35. ini_set('error_log',PATH_SYSTEMOUT.'/error.log');
  36. if(DEBUG === true) {
  37. ini_set('display_errors',true);
  38. }
  39. else {
  40. ini_set('display_errors',false);
  41. }
  42. # time settings
  43. date_default_timezone_set(TIMEZONE);
  44. # required libs
  45. require_once('lib/summoner.class.php');