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_close.DB.inc < prev    next >
Encoding:
Text File  |  2003-07-06  |  1.2 KB  |  39 lines

  1. <?php
  2. /////////////////////////////////////////////////////////
  3. //    
  4. //    include/session_close.DB.inc
  5. //
  6. //    (C)Copyright 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.     PURPOSE:
  15.     PRE-CONDITIONS:
  16.         This page is include'd in "source/login.php" which is loaded upon logout.
  17.         Session should be closed, and any cached data (i.e. password) purged.
  18.     COMMENTS:
  19.         This file is for the default DB back-end.
  20.  
  21. ********************************************************/
  22.  
  23.     // delete this session and any old unclosed ones
  24.     include_once("../conf/db_conf.php");
  25.     include_once("../conf/conf.inc");
  26.     
  27.     //connect to db
  28.     include_once("../include/idba.$DB_TYPE.inc");
  29.     $db = new idba_obj;
  30.     if ($db->connect()){
  31.             $expTime = time() - $MAX_SESSION_TIME; //close all session that are over 24 hours old
  32.             $sql = "delete from $DB_SESSIONS_TABLE where (sid = '$user') or (inTime < $expTime)";
  33.             if (!$db->query($sql)) echo "DB query failed: $sql <br>\n";
  34.     }else{
  35.         echo "DB connection failed.<br>\n";
  36.     }
  37.     
  38.  
  39. ?>