• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ADODB_Session类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 function __construct($conn_options, $persist = TRUE, $debug = FALSE, $sess_table = 'sessao')
 {
     $ret = FALSE;
     list($host, $database, $user, $password, $port) = array_values($conn_options);
     $host .= ':' . $port;
     $options['table'] = $sess_table;
     $this->session_table = $sess_table;
     ADOdb_Session::config('postgres', $host, $user, $password, $database, $options);
     ADODB_Session::open(false, false, $connectMode = $persist);
     if (isset($GLOBALS['ADODB_SESS_CONN']) && is_object($GLOBALS['ADODB_SESS_CONN'])) {
         ADOdb_session::Persist($connectMode = $persist);
         $GLOBALS['ADODB_SESS_CONN']->debug = $debug;
         // limpa outras sessoes expiradas e inativas por mais de 15 minutos (padr�o)
         $this->clear_expired_sessions();
         @session_start();
     }
 }
开发者ID:fraancisneiluiz,项目名称:ciaweb,代码行数:17,代码来源:session.php


示例2: init

 public static function init()
 {
     if (!wbCore::isFuncDisabled('ini_set')) {
         // PHP configuration variables
         // Stop adding SID to URLs
         ini_set('session.use_trans_sid', 0);
         // User-defined save handler
         ini_set('session.save_handler', 'user');
         // How to store data
         ini_set('session.serialize_handler', 'php');
         // Use cookie to store the session ID
         ini_set('session.use_cookies', 1);
         // Name of our cookie
         ini_set('session.name', 'WEBISID');
         $path = wbServer::getBaseURI();
         if (empty($path)) {
             $path = '/';
         }
         // Lifetime of our cookie. Session lasts set number of days
         $lifetime = wbConfig::get('Session.Duration') * 86400;
         ini_set('session.cookie_lifetime', $lifetime);
         // Cookie path
         // this should be customized for multi-server setups wanting to share
         // sessions
         ini_set('session.cookie_path', $path);
         // Garbage collection
         ini_set('session.gc_probability', 1);
         // Inactivity timeout for user sessions
         ini_set('session.gc_maxlifetime', wbConfig::get('Session.InactivityTimeout') * 60);
         // Auto-start session
         ini_set('session.auto_start', 1);
     }
     include_once 'lib/adodb/session/adodb-session2.php';
     $GLOBALS['ADODB_SESS_CONN'] =& wbDB::getConn();
     ADODB_Session::table(wbConfig::get('DB.prefix') . '_sessions');
     session_start();
 }
开发者ID:rayminami,项目名称:cc_webservice,代码行数:37,代码来源:sessions.php


示例3: adodb_session_regenerate_id

 function adodb_session_regenerate_id()
 {
     $conn = ADODB_Session::_conn();
     if (!$conn) {
         return false;
     }
     $old_id = session_id();
     if (function_exists('session_regenerate_id')) {
         session_regenerate_id();
     } else {
         session_id(md5(uniqid(rand(), true)));
         $ck = session_get_cookie_params();
         setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
         //@session_start();
     }
     $new_id = session_id();
     $ok = $conn->Execute('UPDATE ' . ADODB_Session::table() . ' SET sesskey=' . $conn->qstr($new_id) . ' WHERE sesskey=' . $conn->qstr($old_id));
     /* it is possible that the update statement fails due to a collision */
     if (!$ok) {
         session_id($old_id);
         if (empty($ck)) {
             $ck = session_get_cookie_params();
         }
         setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
         return false;
     }
     return true;
 }
开发者ID:aaricpittman,项目名称:openemr,代码行数:28,代码来源:adodb-session.php


示例4: 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


示例5: define

 * 
 * @author Organisation: Queen's University
 * @author Unit: School of Medicine
 * @author Developer: Matt Simpson <[email protected]>
 * @copyright Copyright 2010 Queen's University. All Rights Reserved.
 * 
*/
$ADODB_QUOTE_FIELDNAMES = true;
// Whether or not you want ADOdb to backtick field names in AutoExecute, GetInsertSQL and GetUpdateSQL.
define("ADODB_QUOTE_FIELDNAMES", $ADODB_QUOTE_FIELDNAMES);
// Information required to start a new database connection.
$db = NewADOConnection(DATABASE_TYPE);
$db->Connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
if (defined("DEFAULT_CHARSET") && isset($ENTRADA_CHARSETS) && is_array($ENTRADA_CHARSETS) && array_key_exists(DEFAULT_CHARSET, $ENTRADA_CHARSETS)) {
    $db->Execute("SET NAMES " . $db->qstr($ENTRADA_CHARSETS[DEFAULT_CHARSET]["mysql_names"]) . " COLLATE " . $db->qstr($ENTRADA_CHARSETS[DEFAULT_CHARSET]["mysql_collate"]));
}
$db->debug = isset($DEVELOPER_IPS) && is_array($DEVELOPER_IPS) && isset($_SERVER["REMOTE_ADDR"]) && in_array($_SERVER["REMOTE_ADDR"], $DEVELOPER_IPS) && isset($_GET["debug"]) ? true : false;
@ini_set("session.name", SESSION_NAME);
@ini_set("session.gc_maxlifetime", SESSION_EXPIRES);
if (defined("ADODB_SESSION") && defined("DATABASE_SESSIONS") && DATABASE_SESSIONS) {
    require_once "Entrada/adodb/session/adodb-session2.php";
    ADODB_Session::config(SESSION_DATABASE_TYPE, SESSION_DATABASE_HOST, SESSION_DATABASE_USER, SESSION_DATABASE_PASS, SESSION_DATABASE_NAME, array("table" => "sessions"));
    ADODB_Session::encryptionKey(ENCRYPTION_KEY);
    ADODB_Session::open(false, false, false);
    ADODB_Session::optimize(true);
    ADODB_Session::expireNotify(array("PROXY_ID", "expired_session"));
    session_start();
} else {
    session_start();
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:31,代码来源:dbconnection.inc.php


示例6: _sessionKey

 function _sessionKey()
 {
     return crypt(ADODB_Session::encryptionKey(), session_id());
 }
开发者ID:briandodson,项目名称:bdcms,代码行数:4,代码来源:adodb-session.php


示例7: Lim

<?php

/*
V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
         Contributed by Ross Smith ([email protected]). 
  Released under both BSD license and Lesser GPL library license.
  Whenever there is any discrepancy between the two licenses,
  the BSD license will take precedence.
	  Set tabs to 4 for best viewing.
*/
/*
This file is provided for backwards compatibility purposes
*/
require_once dirname(__FILE__) . '/adodb-session.php';
ADODB_Session::clob('CLOB');
开发者ID:ruckfull,项目名称:taobaocrm,代码行数:15,代码来源:adodb-session-clob.php


示例8: gc

 static function gc($maxlifetime)
 {
     $conn = ADODB_Session::_conn();
     $debug = ADODB_Session::debug();
     $expire_notify = ADODB_Session::expireNotify();
     $optimize = ADODB_Session::optimize();
     $table = ADODB_Session::table();
     if (!$conn) {
         return false;
     }
     $debug = ADODB_Session::debug();
     if ($debug) {
         $conn->debug = 1;
         $COMMITNUM = 2;
     } else {
         $COMMITNUM = 20;
     }
     //assert('$table');
     $time = $conn->OffsetDate(-$maxlifetime / 24 / 3600, $conn->sysTimeStamp);
     $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
     if ($expire_notify) {
         reset($expire_notify);
         $fn = next($expire_notify);
     } else {
         $fn = false;
     }
     $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
     $sql = "SELECT expireref, sesskey FROM {$table} WHERE expiry < {$time} ORDER BY 2";
     # add order by to prevent deadlock
     $rs = $conn->SelectLimit($sql, 1000);
     if ($debug) {
         ADODB_Session::_dumprs($rs);
     }
     $conn->SetFetchMode($savem);
     if ($rs) {
         $tr = $conn->hasTransactions;
         if ($tr) {
             $conn->BeginTrans();
         }
         $keys = array();
         $ccnt = 0;
         while (!$rs->EOF) {
             $ref = $rs->fields[0];
             $key = $rs->fields[1];
             if ($fn) {
                 $fn($ref, $key);
             }
             $del = $conn->Execute("DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0'), array($key));
             $rs->MoveNext();
             $ccnt += 1;
             if ($tr && $ccnt % $COMMITNUM == 0) {
                 if ($debug) {
                     echo "Commit<br>\n";
                 }
                 $conn->CommitTrans();
                 $conn->BeginTrans();
             }
         }
         $rs->Close();
         if ($tr) {
             $conn->CommitTrans();
         }
     }
     // suggested by Cameron, "GaM3R" <[email protected]>
     if ($optimize) {
         $driver = ADODB_Session::driver();
         if (preg_match('/mysql/i', $driver)) {
             $sql = "OPTIMIZE TABLE {$table}";
         }
         if (preg_match('/postgres/i', $driver)) {
             $sql = "VACUUM {$table}";
         }
         if (!empty($sql)) {
             $conn->Execute($sql);
         }
     }
     return true;
 }
开发者ID:fgbreel,项目名称:ADOdb,代码行数:78,代码来源:adodb-session2.php


示例9: array

            </table></td>
<?php
  $heading = array();
  $contents = array();
  if (isset($info)) {
    $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b><br />');

    if (STORE_SESSIONS == '1') {
      $sessionstable = $oostable['sessions'];

      $session_data = $dbconn->Execute("SELECT data FROM $sessionstable WHERE sesskey = '" . $info . "'");

      if (STORE_SESSIONS_CRYPT == '1') {
        include_once '../includes/lib/adodb/session/crypt.inc.php';
        $Crypt = new MD5Crypt;
        $session_data = rawurldecode($Crypt->Decrypt(reset($session_data->fields), crypt(ADODB_Session::encryptionKey(), $info)));
      } else {
        $session_data = rawurldecode($session_data->fields['data']);
      }
    } else {
      if ( (file_exists(oos_session_save_path() . '/sess_' . $info)) && (filesize(oos_session_save_path() . '/sess_' . $info) > 0) ) {
        $session_data = file(oos_session_save_path() . '/sess_' . $info);
        $session_data = trim(implode('', $session_data));
      }
    }

    $currency = unserialize(oos_get_serialized_variable($session_data, 'currency', 'string'));

    $cart = unserialize(oos_get_serialized_variable($session_data, 'cart', 'object'));

    if (isset($cart) && is_object($cart)) {
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:whos_online.php


示例10: error_reporting

error_reporting(E_ALL ^ E_NOTICE);
date_default_timezone_set('Europe/Kiev');
require_once _ROOT . 'vendor/autoload.php';
include_once _ROOT . "vendor/adodb/adodb-php/adodb-exceptions.inc.php";
//чтение  конфигурации
$_config = parse_ini_file(_ROOT . 'config/config.ini', true);
//  phpQuery::$debug = true;
// Подключение  фреймворка
require_once _ZIPPY . 'zippy.inc.php';
//Параметры   соединения  с  БД
\ZCL\DB\DB::config($_config['db']['host'], $_config['db']['name'], $_config['db']['user'], $_config['db']['pass']);
//Настройка   сессии   в  БД
if ($_config["common"]["sessiondb"] == "1") {
    include_once _ROOT . "vendor/adodb/adodb-php/session/adodb-session2.php";
    \ADODB_Session::config('mysqli', $_config['db']['host'], $_config['db']['user'], $_config['db']['pass'], $_config['db']['name'], array('table' => 'system_session'));
    \ADODB_Session::Persist($connectMode = false);
}
//подключение  ядра системмы
require_once _ROOT . 'system/start.inc.php';
require_once _ROOT . 'erp/start.inc.php';
//загружаем  модули
$modules = array();
/*
 $modulespath = _ROOT . 'modules/';
 if ($handle = @opendir($modulespath)) {
 while (false !== ($file = readdir($handle))) {
 if (is_dir($modulespath . $file) && strlen($file) > 2) {
 $startfile = $modulespath . $file . '/start.inc.php';
 if(file_exists($startfile)){
 $modules[] = $file;
 require_once $startfile;
开发者ID:Niqpue,项目名称:zippyerp,代码行数:31,代码来源:init.php


示例11: calc

 calc("Last Moderated Image", $sql);
 $table[] = array("Parameter" => '', "Value" => '');
 $sql = "SELECT COUNT(*) FROM gridimage WHERE submitted > DATE_SUB(NOW() , INTERVAL 24 HOUR)";
 calc("Images Submitted in last 24 hours", $sql, 600);
 $sql = "SELECT COUNT(DISTINCT user_id) FROM gridimage WHERE submitted > DATE_SUB(NOW() , INTERVAL 24 HOUR)";
 calc("Image Contributors in last 24 hours", $sql, 3600);
 $sql = "SELECT COUNT(DISTINCT moderator_id) FROM gridimage WHERE submitted > DATE_SUB(NOW() , INTERVAL 48 HOUR) and moderator_id > 0 and moderated > DATE_SUB(NOW() , INTERVAL 24 HOUR)";
 calc("Active Moderators in last 24 hours", $sql, 3600);
 $table[] = array("Parameter" => '', "Value" => '');
 $sql = "SELECT COUNT(*) FROM gridimage WHERE submitted > DATE_SUB(NOW() , INTERVAL 7 DAY)";
 calc("Images Submitted in last 7 days", $sql, 3600 * 3);
 $sql = "SELECT COUNT(DISTINCT user_id) FROM gridimage WHERE submitted > DATE_SUB(NOW() , INTERVAL 7 DAY)";
 calc("Image Contributors in last 7 days", $sql, 3600 * 3);
 $table[] = array("Parameter" => '', "Value" => '');
 $sql = "SELECT COUNT(DISTINCT ipaddr) FROM sessions WHERE EXPIRY > UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL 24 MINUTE))";
 $db2 = ADODB_Session::_conn();
 $table[] = array("Parameter" => "Approx Visitors in last 24 <u>minutes</u>", "Value" => $db2->getOne($sql));
 $sql = "SELECT COUNT(DISTINCT user_id)-1 FROM autologin WHERE created > DATE_SUB(NOW(), INTERVAL 1 HOUR)";
 calc("Approx Regular Users visited in last hour", $sql);
 $table[] = array("Parameter" => '', "Value" => '');
 $sql = "SELECT COUNT(*) FROM geobb_posts WHERE post_time > DATE_SUB(NOW() , INTERVAL 1 HOUR)";
 calc("Forum Posts in last hour", $sql);
 $sql = "SELECT COUNT(DISTINCT poster_id) FROM geobb_posts WHERE post_time > DATE_SUB(NOW() , INTERVAL 1 HOUR)";
 calc("Forum Posters in last hour", $sql);
 $table[] = array("Parameter" => '', "Value" => '');
 $sql = "SELECT COUNT(*) FROM geobb_posts WHERE post_time > DATE_SUB(NOW() , INTERVAL 24 HOUR)";
 calc("Forum Posts in last 24 hours", $sql);
 $sql = "SELECT COUNT(DISTINCT poster_id) FROM geobb_posts WHERE post_time > DATE_SUB(NOW() , INTERVAL 24 HOUR)";
 calc("Forum Posters in last 24 hours", $sql);
 $sql = "SELECT COUNT(DISTINCT user_id) FROM geobb_lastviewed WHERE ts > DATE_SUB(NOW() , INTERVAL 24 HOUR)";
 calc("Forum Viewers in last 24 hours", $sql);
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:31,代码来源:pulse.php


示例12: 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 = '[email protected]';
$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


示例13: ini_set

    // No errors
    ini_set('display_errors', '0');
    // Don't show them
    $db_logging = false;
    // True gives an admin log entry for any SQL calls that update/insert/delete, and turns on adodb's sql logging. Only for use during development!This makes a huge amount of logs! You have been warned!!
}
ini_set('url_rewriter.tags', '');
// Ensure that the session id is *not* passed on the url - this is a possible security hole for logins - including admin.
global $ADODB_CRYPT_KEY;
global $ADODB_SESSION_CONNECT, $ADODB_SESSION_USER, $ADODB_SESSION_DB;
$ADODB_SESS_CONN = '';
$ADODB_SESSION_TBL = $db_prefix . "sessions";
// We explicitly use encrypted sessions, but this adds compression as well.
ADODB_Session::encryptionKey($ADODB_CRYPT_KEY);
// The data field name "data" violates SQL reserved words - switch it to SESSDATA
ADODB_Session::dataFieldName('SESSDATA');
global $db;
connectdb();
$db->prefix = $db_prefix;
$db->logging = $db_logging;
if ($db_logging) {
    adodb_perf::table("{$db->prefix}adodb_logsql");
    $db->LogSQL();
    // Turn on adodb performance logging
}
if (!isset($index_page)) {
    $index_page = false;
}
if (!$index_page) {
    // Ensure that we do not set cookies on the index page, until the player chooses to allow them.
    if (!isset($_SESSION)) {
开发者ID:kagetenshi,项目名称:xenoberage,代码行数:31,代码来源:global_cleanups.php


示例14: elseif

}
// is session data stored in DB or in filesystem?
if ($gBitSystem->isFeatureActive('site_store_session_db') && !empty($gBitDbType)) {
    if (file_exists(EXTERNAL_LIBS_PATH . 'adodb/session/adodb-session.php')) {
        include_once EXTERNAL_LIBS_PATH . 'adodb/session/adodb-session.php';
    } elseif (file_exists(UTIL_PKG_PATH . 'adodb/session/adodb-session.php')) {
        include_once UTIL_PKG_PATH . 'adodb/session/adodb-session.php';
    }
    if (class_exists('ADODB_Session')) {
        ADODB_Session::dataFieldName('session_data');
        ADODB_Session::driver($gBitDbType);
        ADODB_Session::host($gBitDbHost);
        ADODB_Session::user($gBitDbUser);
        ADODB_Session::password($gBitDbPassword);
        ADODB_Session::database($gBitDbName);
        ADODB_Session::table(BIT_DB_PREFIX . 'sessions');
        ini_set('session.save_handler', 'user');
    }
}
session_name(BIT_SESSION_NAME);
if ($gBitSystem->isFeatureActive('users_remember_me')) {
    session_set_cookie_params($gBitSystem->getConfig('site_session_lifetime'), $gBitSystem->getConfig('cookie_path', BIT_ROOT_URL), $gBitSystem->getConfig('cookie_domain', ''));
} else {
    session_set_cookie_params($gBitSystem->getConfig('site_session_lifetime'), BIT_ROOT_URL, '');
}
// just use a simple COOKIE (unique random string) that is linked to the users_cnxn table.
// This way, nuking rows in the users_cnxn table can log people out and is much more reliable than SESSIONS
global $gShellScript;
if (empty($gShellScript)) {
    if (session_status() == PHP_SESSION_NONE) {
        session_start();
开发者ID:bitweaver,项目名称:users,代码行数:31,代码来源:bit_setup_inc.php


示例15: db_op_result

        // Since we now have the config values(including perf_logging), if the admin wants perf logging on - turn it on.
        if (isset($perf_logging) && $perf_logging) {
            $debug_query = $db->SelectLimit("SELECT * from {$db_prefix}adodb_logsql", 1);
            if ($debug_query) {
                adodb_perf::table("{$db_prefix}adodb_logsql");
                $db->LogSQL();
            }
        }
    }
    // Ensure that the sessions table has been created, and if so, start a session.
    // I bet there is a more elegant way to do this, but this works for all my testing scenarios, so its in for now.
    $debug_query = $db->Execute("SHOW TABLES LIKE '{$db_prefix}sessions'");
    db_op_result($debug_query, __LINE__, __FILE__);
    $row = $debug_query->fields;
    if ($debug_query) {
        // We explicitly use encrypted sessions, but this adds compression as well.
        $ADODB_SESSION_TBL = $db_prefix . "sessions";
        ADODB_Session::filter(new ADODB_Compress_Gzip());
        // The data field name "data" violates SQL reserved words - switch it to session_data.
        ADODB_Session::dataFieldName('session_data');
        session_start();
    }
}
$smarty = new Smarty();
if (getenv("HTTP_X_FORWARDED_FOR")) {
    $ip = getenv("HTTP_X_FORWARDED_FOR");
    // Get Proxy IP address for user
} else {
    $ip = getenv("REMOTE_ADDR");
    // Get IP address for user
}
开发者ID:BackupTheBerlios,项目名称:freechess-svn,代码行数:31,代码来源:global_includes.php


示例16: gc

 function gc($maxlifetime)
 {
     $conn =& ADODB_Session::_conn();
     $debug = ADODB_Session::debug();
     $expire_notify = ADODB_Session::expireNotify();
     $optimize = ADODB_Session::optimize();
     $table = ADODB_Session::table();
     if (!$conn) {
         return false;
     }
     //assert('$table');
     $time = $conn->sysTimeStamp;
     $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
     if ($expire_notify) {
         reset($expire_notify);
         $fn = next($expire_notify);
         $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
         $sql = "SELECT expireref, sesskey FROM {$table} WHERE expiry < {$time}";
         $rs =& $conn->Execute($sql);
         ADODB_Session::_dumprs($rs);
         $conn->SetFetchMode($savem);
         if ($rs) {
             $conn->StartTrans();
             $keys = array();
             while (!$rs->EOF) {
                 $ref = $rs->fields[0];
                 $key = $rs->fields[1];
                 $fn($ref, $key);
                 $del = $conn->Execute("DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0'), array($key));
                 $rs->MoveNext();
             }
             $rs->Close();
             $conn->CompleteTrans();
         }
     } else {
         if (0) {
             $sql = "SELECT sesskey FROM {$table} WHERE expiry < {$time}";
             $arr =& $conn->GetAll($sql);
             foreach ($arr as $row) {
                 $sql2 = "DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0');
                 $conn->Execute($sql2, array(reset($row)));
             }
         } else {
             $sql = "DELETE FROM {$table} WHERE expiry < {$time}";
             $rs =& $conn->Execute($sql);
             ADODB_Session::_dumprs($rs);
             if ($rs) {
                 $rs->Close();
             }
         }
         if ($debug) {
             ADOConnection::outp("<p><b>Garbage Collection</b>: {$sql}</p>");
         }
     }
     // suggested by Cameron, "GaM3R" <[email protected]>
     if ($optimize) {
         $driver = ADODB_Session::driver();
         if (preg_match('/mysql/i', $driver)) {
             $sql = "OPTIMIZE TABLE {$table}";
         }
         if (preg_match('/postgres/i', $driver)) {
             $sql = "VACUUM {$table}";
         }
         if (!empty($sql)) {
             $conn->Execute($sql);
         }
     }
     return true;
 }
开发者ID:vincseize,项目名称:GDC,代码行数:69,代码来源:adodb-session2.php


示例17: print_r

} else {
    $_SESSION['MONKEY'][0] += 1;
}
if (!isset($_GET['nochange'])) {
    @($_SESSION['AVAR'] += 1);
}
### START DISPLAY
print "<h3>PHP " . PHP_VERSION . "</h3>";
print "<p><b>\$_SESSION['AVAR']={$_SESSION['AVAR']}</b></p>";
print "<hr /> <b>Cookies</b>: ";
print_r($_COOKIE);
var_dump($_SESSION['MONKEY']);
### RANDOMLY PERFORM Garbage Collection
### In real-production environment, this is done for you
### by php's session extension, which calls adodb_sess_gc()
### automatically for you. See php.ini's
### session.cookie_lifetime and session.gc_probability
if (rand() % 5 == 0) {
    print "<hr /><p><b>Garbage Collection</b></p>";
    adodb_sess_gc(10);
    if (rand() % 2 == 0) {
        print "<p>Random own session destroy</p>";
        session_destroy();
    }
} else {
    $DB = ADODB_Session::_conn();
    $sessk = $DB->qstr('%AZ' . rand() . time());
    $olddate = $DB->DBTimeStamp(time() - 30 * 24 * 3600);
    $rr = $DB->qstr(rand());
    $DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ({$sessk},{$olddate}, {$rr},'',{$olddate},{$olddate})");
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:31,代码来源:testsessions.php


示例18: NotifyFn

    ADODB_Session::host($host);
    ADODB_Session::lifetime($lifetime);
    ADODB_Session::optimize($optimize);
    ADODB_Session::password($password);
    ADODB_Session::syncSeconds($sync_seconds);
    ADODB_Session::table($table);
    ADODB_Session::user($user);
}
function NotifyFn($var, $sesskey)
{
    echo "NotifyFn({$var}, {$sesskey}) called<br />\n";
}
if ($expire_notify) {
    $ADODB_SESSION_EXPIRE_NOTIFY = array('debug', 'NotifyFn');
    if (class_exists('ADODB_Session')) {
        ADODB_Session::expireNotify(array('debug', 'NotifyFn'));
    }
}
session_start();
$register = true;
if (!empty($_REQUEST['submit'])) {
    switch ($_REQUEST['submit']) {
        case 'Change Driver':
        case 'Delete Session':
            $_SESSION = array();
            setcookie(session_name(), '', time() - 2592000, '/', '', 0);
            session_destroy();
            $register = false;
            break;
        default:
    }
开发者ID:Artea,项目名称:freebeer,代码行数:31,代码来源:adodb-session-demo.php


示例19: gc

 function gc($maxlifetime)
 {
     $conn =& ADODB_Session::_conn();
     $debug = ADODB_Session::debug();
     $expire_notify = ADODB_Session::expireNotify();
     $optimize = ADODB_Session::optimize();
     $sync_seconds = ADODB_Session::syncSeconds();
     $table = ADODB_Session::table();
     if (!$conn) {
         return false;
     }
     $time = time();
     $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
     if ($expire_notify) {
         reset($expire_notify);
         $fn = next($expire_notify);
         $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
         $sql = "SELECT expireref, sesskey FROM {$table} WHERE expiry < {$time}";
         $rs =& $conn->Execute($sql);
         ADODB_Session::_dumprs($rs);
         $conn->SetFetchMode($savem);
         if ($rs) {
             $conn->StartTrans();
             $keys = array();
             while (!$rs->EOF) {
                 $ref = $rs->fields[0];
                 $key = $rs->fields[1];
                 $fn($ref, $key);
                 $del = $conn->Execute("DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0'), array($key));
                 $rs->MoveNext();
             }
             $rs->Close();
             $conn->CompleteTrans();
         }
     } else {
         if (1) {
             $sql = "SELECT sesskey FROM {$table} WHERE expiry < {$time}";
             $arr =& $conn->GetAll($sql);
             foreach ($arr as $row) {
                 $sql2 = "DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0');
                 $conn->Execute($sql2, array($row[0]));
             }
         } else {
             $sql = "DELETE FROM {$table} WHERE expiry < {$time}";
             $rs =& $conn->Execute($sql);
             ADODB_Session::_dumprs($rs);
             if ($rs) {
                 $rs->Close();
             }
         }
         if ($debug) {
             ADOConnection::outp("<p><b>Garbage Collection</b>: {$sql}</p>");
         }
     }
     // suggested by Cameron, "GaM3R" <[email protected]>
     if ($optimize) {
         $driver = ADODB_Session::driver();
         if (preg_match('/mysql/i', $driver)) {
             $sql = "OPTIMIZE TABLE {$table}";
         }
         if (preg_match('/postgres/i', $driver)) {
             $sql = "VACUUM {$table}";
         }
         if (!empty($sql)) {
             $conn->Execute($sql);
         }
     }
     if ($sync_seconds) {
         $sql = 'SELECT ';
         if ($conn->dataProvider === 'oci8') {
             $sql .= "TO_CHAR({$conn->sysTimeStamp}, 'RRRR-MM-DD HH24:MI:SS')";
         } else {
             $sql .= $conn->sysTimeStamp;
         }
         $sql .= " FROM {$table}";
         $rs =& $conn->SelectLimit($sql, 1);
         if ($rs && !$rs->EOF) {
             $dbts = reset($rs->fields);
             $rs->Close();
             $dbt = $conn->UnixTimeStamp($dbts);
             $t = time();
             if (abs($dbt - $t) >= $sync_seconds) {
                 $msg = __FILE__ . ": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: " . " database={$dbt} ({$dbts}), webserver={$t} (diff=" . abs($dbt - $t) / 60 . ' minutes)';
                 error_log($msg);
                 if ($debug) {
                     ADOConnection::outp("<p>{$msg}</p>");
                 }
             }
         }
     }
     return true;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:92,代码来源:adodb-session.php


示例20: array

 require_once '../session/adodb-session.php';
 $encryption = array('', 'adodb-encrypt-mcrypt.php', 'adodb-encrypt-md5.php', 'adodb-encrypt-ordcrypt.php', 'adodb-encrypt-secret.php', 'adodb-encrypt-sha1.php');
 $encryption_object = array('', 'ADODB_Encrypt_MCrypt', 'ADODB_Encrypt_MD5', 'ADODB_Encrypt_OrdCrypt', 'ADODB_Encrypt_Secret', 'ADODB_Encrypt_SHA1');
 $encryption_name = array('None', 'MCrypt', 'MD5', 'OrdCrypt', 'Secret', 'SHA1');
 $compression = array('', 'adodb-compress-bzip2.php', 'adodb-compress-gzip.php');
 $compression_object = array('', 'ADODB_Compress_Bzip2', 'ADODB_Compress_Gzip');
 $compression_name = array('None', 'Bzip2', 'Gzip');
 if ($_POST['encrypt'] > 0) {
     require_once ADODB_SESSION . '/' . $encryption[$_POST['encrypt']];
     $object = $encryption_object[$_POST['encrypt']];
     ADODB_Session::filter(new $object());
 }
 if ($_POST['compress'] > 0) {
     require_once ADODB_SESSION . '/' . $compression[$_POST['compress']];
     $object = $compression_object[$_POST['compress']];
     ADODB_Session::filter(new $object());
 }
 $db = ADONewConnection($_POST['databasetype']);
 $db->createdatabase = true;
 $result = $db->Connect($_POST['dbhost'], $_POST['dbusername'], $_POST['dbpassword'], $_POST['databasename']);
 if (!$result) {
     die("Could not connect to the database.");
 }
 $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
 function ExpiredSession($expireref, $sesskey)
 {
     echo "Session USERID: {$expireref} - expired<br>";
     echo "Session Key: {$sesskey}<br><br>";
 }
 if ($_POST['databasetype'] == 'mysql' || $_POST['databasetype'] == 'mysqli' || $_POST['databasetype'] == 'mysqlt') {
     $res = $db->Execute("DROP TABLE IF EXISTS `sessions`");
开发者ID:jinahadam,项目名称:Keystroke-Dynamics,代码行数:31,代码来源:test_adodb_lite_sessions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ADODB_mssql类代码示例发布时间:2022-05-23
下一篇:
PHP ADODB_Pager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap