session.handler.php 717 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. if(session_id() == '' || !isset($_SESSION)) {
  3. session_start();
  4. }
  5. if(_debug) {
  6. if(!isset($_SESSION[_sid])) {
  7. $_SESSION[_sid] = dev_debug_session();
  8. }
  9. if(!isset($_SESSION[_sid]['ver'])) {
  10. $_SESSION[_sid] = dev_debug_session();
  11. }
  12. if($_SESSION[_sid]['ver'] != _ver) {
  13. $_SESSION[_sid] = dev_debug_session();
  14. }
  15. }
  16. if(isset($_SESSION[_sid]['user'])) {
  17. DEFINE('_auth_status', true);
  18. } else {
  19. DEFINE('_auth_status', false);
  20. }
  21. function dev_debug_session() {
  22. return [
  23. 'ver' => _ver,
  24. 'user' => [
  25. 'username' => 'admin',
  26. 'access' => [1,2,3,4,5],
  27. 'signin' => microtime()
  28. ],
  29. 'view' => 'dashboard'
  30. ];
  31. }
  32. ?>