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.FS.inc < prev    next >
Encoding:
Text File  |  2003-07-03  |  2.4 KB  |  76 lines

  1. <?php
  2. /////////////////////////////////////////////////////////
  3. //    
  4. //    include/session_auth.FS.inc
  5. //
  6. //    (C)Copyright 2001-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  7. //
  8. //    This file is part of IlohaMail, and released under GPL.
  9. //    See COPYING, or http://www.fsf.org/copyleft/gpl.html
  10. //
  11. /////////////////////////////////////////////////////////
  12.  
  13. /********************************************************
  14.  
  15.     PURPOSE:
  16.         1.  Make sure session (pass as $user) is valid
  17.         2.    Initialize $loginID variable, containing IMAP login ID.
  18.         3.  Initialize $host variable, containing IMAP server name
  19.         4.  Initialize $password variable, containing plain text password
  20.         5.  Initialize $my_prefs variable, which should be an associated array containing user preferecnes
  21.         6.  Initialize $my_colors variable, which should be an associated array containing user defined colors
  22.     PRE-CONDITIONS:
  23.         $user - Session ID
  24.     POST-CONDITIONS:
  25.     COMMENTS:
  26.         All source files should include this file for session verification and user data initialization.
  27.         As long as the variables and functions defined above are initialized, where the data is
  28.         (i.e. on the HD, in a SQL database, LDAP, etc) should not matter.
  29.  
  30. ********************************************************/
  31.  
  32.     //cehck session ID
  33.     if ((empty($user)) || (!file_exists(realpath($SESSION_DIR.$user.".inc")))){
  34.         echo "Invalid session ID<br>\n";
  35.         if (!$do_not_die) exit;
  36.     }
  37.  
  38.     include_once("../include/encryption.inc");
  39.     include_once($SESSION_DIR.$user.".inc");
  40.  
  41.     $ipkey = GetSessionEncKey($user);
  42.     $userPath = DecodeMessage($ipkey, $userPath);
  43.  
  44.     if (!file_exists(realpath($userPath."/key.inc"))){
  45.         echo "<html>Session no longer valid.  Log out and log back in.</html>";
  46.         exit;
  47.     }else{
  48.         //get key
  49.         include($userPath."/key.inc");
  50.     }
  51.  
  52.     //include color prefs
  53.     if (file_exists(realpath($userPath."/colors.inc"))){
  54.         include_once($userPath."/colors.inc");
  55.     }else{
  56.         echo "Invalid color prefs include path: $userPath <br>\n";
  57.         if (!$do_not_die) exit;
  58.     }
  59.     
  60.     //include prefs
  61.     if (file_exists(realpath($userPath."/prefs.inc"))){
  62.         include_once($userPath."/prefs.inc");
  63.     }else{
  64.         echo "Invalid prefs include path: $usePath <br>\n";
  65.         if (!$do_not_die) exit;
  66.     }
  67.         
  68.     //initialize session variables
  69.     $my_charset=$my_prefs["charset"];
  70.     if ($port==110) $my_prefs["list_folders"] = 0;    
  71.     $loginID = DecodeMessage($passkey, GetUserName());
  72.     $password = DecodeMessage($passkey, GetPassword());
  73.     $host = DecodeMessage($passkey, GetHost());
  74.     $dataID = $userPath;
  75.     $session_dataID = $dataID;
  76. ?>