home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / session_auth.inc < prev    next >
Encoding:
Text File  |  2003-07-06  |  1.3 KB  |  58 lines

  1. <?php
  2. /********************************************************
  3.     include/session_auth.inc
  4.     
  5.     (C)Copyright 2000-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  6.  
  7.     This file is part of IlohaMail, and released under GPL.
  8.     See COPYING, or http://www.fsf.org/copyleft/gpl.html
  9.     
  10.     PURPOSE:
  11.         Shell for session_auth.backend.inc
  12.  
  13. ********************************************************/
  14.  
  15. include_once("../conf/conf.inc");
  16.  
  17. //sanitize session ID
  18. $user = eregi_replace("[^0-9-]", "", $user);
  19.  
  20. //time out
  21. if (!$STAY_LOGGED_IN){
  22.     $session_parts = explode("-", $user);
  23.     $in_time = $session_parts[0];
  24.     $valid_time = time() - $MAX_SESSION_TIME;
  25.     if ($in_time < $valid_time){
  26.         echo "Session timeout.  Please log out.";
  27.         if (!$do_not_die) exit;
  28.     }
  29. }
  30.  
  31. //determine backend
  32. $sa_backend = $backend;
  33. include("../conf/db_conf.php");
  34. if ($backend!="FS"){
  35.     if (empty($DB_SESSIONS_TABLE)) $sa_backend = "FS";
  36.     else $sa_backend = "DB";
  37. }
  38.  
  39. //get session ID
  40. $session_cookie = false;
  41. if (!empty($ILOHAMAIL_SESSION)){
  42.     $user = $ILOHAMAIL_SESSION;
  43.     $session_cookie = true;
  44. }
  45.  
  46. //do it...
  47. include("../include/session_auth.".$sa_backend.".inc");
  48.  
  49. //theme stuff
  50. if (empty($my_prefs["theme"])) $my_prefs["theme"] = "default";
  51. include("themes/".$my_prefs["theme"]."/override.inc");
  52.  
  53. //remove session ID if cookies are used
  54. if ($session_cookie) $user = "";
  55.  
  56. header("Content-Type: text/html; charset=".$my_prefs["charset"]);
  57.  
  58. ?>