1
0

index-file.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * dolphin. Collection of useful PHP skeletons.
  4. * Copyright (C) 2013 Johannes 'Banana' Keßler
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  8. *
  9. * You should have received a copy of the
  10. * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
  11. * along with this program. If not, see http://www.sun.com/cddl/cddl.html
  12. */
  13. /**
  14. * this is an example index file. All requests should go through this file.
  15. */
  16. # the internal encoding should be set to utf-8
  17. mb_internal_encoding("UTF-8");
  18. # the default timezone should be set everytime. Otherwise a warning will be throuwn
  19. date_default_timezone_set('Europe/Berlin');
  20. # magic quotes are evil. make sure they are disabled
  21. if(ini_get("magic_quotes_gpc") == 1)
  22. die('Magic quotes is set to "on", and system is not able to change it. Please update Your php.ini file');
  23. # some constans which are use everywhere
  24. define('DEBUG', true);
  25. # display debug messages or not
  26. if(DEBUG === true) {
  27. ini_set('error_reporting',-1); // E_ALL & E_STRICT
  28. ini_set('display_errors',true);
  29. }
  30. else {
  31. # this is the setting for productive enviroment.
  32. # error messages ONLY visible in testing enviroment
  33. # otherwise they are a security risk
  34. ini_set('error_reporting',-1); // E_ALL & E_STRICT
  35. ini_set('display_errors',false);
  36. ini_set('log_errors',true);
  37. ini_set('log_errors_max_len',"10M");
  38. ini_set('error_log','path/to/error/error.file');
  39. }
  40. # header information which should be set before making any output
  41. # those are sepcial for html output
  42. header('Content-type: text/html; charset=UTF-8');
  43. header("Date: ".gmdate("D, d M Y H:i:s", time())." GMT");
  44. header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT");
  45. # anti cache header
  46. # those headers will desiable any cache
  47. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  48. header("Cache-Control: no-store, no-cache, must-revalidate");
  49. header("Cache-Control: post-check=0, pre-check=0", false);
  50. header("Pragma: no-cache");
  51. # any ouput after this line
  52. ?>