当前位置: 首页>>代码示例>>PHP>>正文


PHP ADODB_Session::destroy方法代码示例

本文整理汇总了PHP中ADODB_Session::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_Session::destroy方法的具体用法?PHP ADODB_Session::destroy怎么用?PHP ADODB_Session::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ADODB_Session的用法示例。


在下文中一共展示了ADODB_Session::destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: LogoutNotification

function LogoutNotification($SessionID)
{
    global $CFG, $SESSION, $DB;
    // Delete session of user using $SessionID
    if (empty($CFG->dbsessions)) {
        // File session
        $dir = $CFG->dataroot . '/sessions';
        if (is_dir($dir)) {
            if ($dh = opendir($dir)) {
                // Read all session files
                while (($file = readdir($dh)) !== false) {
                    // Check if it is a file
                    if (is_file($dir . '/' . $file)) {
                        $session_key = preg_replace('/sess_/', '', $file);
                        // Read session file data
                        $data = file($dir . '/' . $file);
                        if (isset($data[0])) {
                            $user_session = unserializesession($data[0]);
                            // Check if we have found session that shall be deleted
                            if (isset($user_session['SESSION']) && isset($user_session['SESSION']->shibboleth_session_id)) {
                                // If there is a match, delete file
                                if ($user_session['SESSION']->shibboleth_session_id == $SessionID) {
                                    // Delete session file
                                    if (!unlink($dir . '/' . $file)) {
                                        return new SoapFault('LogoutError', 'Could not delete Moodle session file.');
                                    }
                                }
                            }
                        }
                    }
                }
                closedir($dh);
            }
        }
    } else {
        // DB Session
        //TODO: this needs to be rewritten to use new session stuff
        if (!empty($CFG->sessiontimeout)) {
            $ADODB_SESS_LIFE = $CFG->sessiontimeout;
        }
        if ($user_session_data = $DB->get_records_sql('SELECT sesskey, sessdata FROM {sessions2} WHERE expiry > NOW()')) {
            foreach ($user_session_data as $session_data) {
                // Get user session
                $user_session = adodb_unserialize(urldecode($session_data->sessdata));
                if (isset($user_session['SESSION']) && isset($user_session['SESSION']->shibboleth_session_id)) {
                    // If there is a match, delete file
                    if ($user_session['SESSION']->shibboleth_session_id == $SessionID) {
                        // Delete this session entry
                        if (ADODB_Session::destroy($session_data->sesskey) !== true) {
                            return new SoapFault('LogoutError', 'Could not delete Moodle session entry in database.');
                        }
                    }
                }
            }
        }
    }
    // If now SoapFault was thrown the function will return OK as the SP assumes
}
开发者ID:educakanchay,项目名称:campus,代码行数:58,代码来源:logout.php

示例2: NotifyExpire

function NotifyExpire($ref, $key)
{
    print "<p><b>Notify Expiring={$ref}, sessionkey={$key}</b></p>";
}
$ADODB_SESSION_DRIVER = 'mysql';
$ADODB_SESSION_CONNECT = 'localhost';
$ADODB_SESSION_USER = 'root';
$ADODB_SESSION_PWD = '';
$ADODB_SESSION_DB = 'pos';
$ADODB_SESS_LIFE = 120;
//$ADODB_SESS_DEBUG = true;
$USER = 'h_izan@yahoo.com';
$ADODB_SESSION_EXPIRE_NOTIFY = array('USER', 'NotifyExpire');
error_reporting(E_ALL);
include 'session/adodb-cryptsession.php';
session_start();
print "session id <br>";
print session_id() . "<br>";
if (ADODB_Session::read(session_id()) == '') {
    ADODB_Session::destroy(session_id());
    //ADODB_Session::gc(160);
    //unset($_COOKIE['PHPSESSID']);
    //unset($_SESSION);
    //session_destroy();
    //session_unset();
    print "session info is empty <br>";
}
print ADODB_Session::read(session_id()) . "<br>";
print date("F j, Y, g:i a s", 1095289294) . "<br>";
print date("F j, Y, g:i a s", 1095289337);
ob_end_flush();
开发者ID:nateirwin,项目名称:custom-historic,代码行数:31,代码来源:time.php


注:本文中的ADODB_Session::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。