~ubuntu-branches/ubuntu/maverick/ilohamail/maverick

« back to all changes in this revision

Viewing changes to IlohaMail/include/session_close.DB.inc

  • Committer: Bazaar Package Importer
  • Author(s): Joerg Jaspert
  • Date: 2004-02-04 13:44:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040204134437-kz8j3ui2qa7oq8z2
Tags: upstream-0.8.12
ImportĀ upstreamĀ versionĀ 0.8.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
?>
 
 
b'\\ No newline at end of file'