function open($save_path, $session_name, $persist = null) { $conn =& ADODB_Session::_conn(); if ($conn) { return true; } $database = ADODB_Session::database(); $debug = ADODB_Session::debug(); $driver = ADODB_Session::driver(); $host = ADODB_Session::host(); $password = ADODB_Session::password(); $user = ADODB_Session::user(); if (!is_null($persist)) { ADODB_Session::persist($persist); } else { $persist = ADODB_Session::persist(); } # these can all be defaulted to in php.ini # assert('$database'); # assert('$driver'); # assert('$host'); $conn =& ADONewConnection($driver); if ($debug) { $conn->debug = true; // ADOConnection::outp( " driver=$driver user=$user pwd=$password db=$database "); } if ($persist) { switch ($persist) { default: case 'P': $ok = $conn->PConnect($host, $user, $password, $database); break; case 'C': $ok = $conn->Connect($host, $user, $password, $database); break; case 'N': $ok = $conn->NConnect($host, $user, $password, $database); break; } } else { $ok = $conn->Connect($host, $user, $password, $database); } if ($ok) { $GLOBALS['ADODB_SESS_CONN'] =& $conn; } else { ADOConnection::outp('<p>Session: connection failed</p>', false); } return $ok; }
$ADODB_SESSION_USER = $user; $ADODB_SESSION_USE_LOBS = $clob; $ADODB_SESS_DEBUG = $debug; $ADODB_SESS_LIFE = $lifetime; if ($optimize) { define('ADODB_SESSION_OPTIMIZE', $optimize); } define('ADODB_SESSION_SYNCH_SECS', $sync_seconds); if (class_exists('ADODB_Session')) { ADODB_Session::clob($clob); ADODB_Session::dataFieldName($data_field_name); ADODB_Session::database($database); ADODB_Session::debug($debug); ADODB_Session::driver($driver); ADODB_Session::filter($filters); 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'));
function open($save_path, $session_name, $persist = null) { $conn =& ADODB_Session::_conn(); if ($conn) { return true; } $database = ADODB_Session::database(); $debug = ADODB_Session::debug(); $driver = ADODB_Session::driver(); $host = ADODB_Session::host(); $password = ADODB_Session::password(); $user = ADODB_Session::user(); if (!is_null($persist)) { $persist = (bool) $persist; ADODB_Session::persist($persist); } else { $persist = ADODB_Session::persist(); } # these can all be defaulted to in php.ini # assert('$database'); # assert('$driver'); # assert('$host'); //print "driver is ". $host. $user. $password. $driver; // cannot use =& below - do not know why... $conn = ADONewConnection($driver); if ($debug) { $conn->debug = true; // ADOConnection::outp( " driver=$driver user=$user pwd=$password db=$database "); } if ($persist) { $ok = $conn->PConnect($host, $user, $password, $database); } else { $ok = $conn->Connect($host, $user, $password, $database); } if ($ok) { $GLOBALS['ADODB_SESS_CONN'] =& $conn; } else { ADOConnection::outp('<p>Session: connection failed</p>', false); } return $ok; }
function config($driver, $host, $user, $password, $database = false, $options = false) { ADODB_Session::driver($driver); ADODB_Session::host($host); ADODB_Session::user($user); ADODB_Session::password($password); ADODB_Session::database($database); if ($driver == 'oci8' || $driver == 'oci8po') { $options['lob'] = 'CLOB'; } if (isset($options['table'])) { ADODB_Session::table($options['table']); } if (isset($options['lob'])) { ADODB_Session::clob($options['lob']); } if (isset($options['debug'])) { ADODB_Session::debug($options['debug']); } }
require_once USERS_PKG_PATH . $userClass . '.php'; // set session lifetime if ($gBitSystem->isFeatureActive('site_session_lifetime')) { ini_set('session.gc_maxlifetime', $gBitSystem->isFeatureActive('site_session_lifetime')); } // 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