PageRenderTime 74ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 1ms

/source/libs/adodb/session/adodb-session.php

https://github.com/yfg2014/ddim
PHP | 841 lines | 565 code | 134 blank | 142 comment | 103 complexity | f5d57388fe6dd13ca927e7ddf486ede2 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. /*
  3. V4.01 23 Oct 2003 (c) 2000-2005 John Lim (jlim@natsoft.com.my). All rights reserved.
  4. Contributed by Ross Smith (adodb@netebb.com).
  5. Released under both BSD license and Lesser GPL library license.
  6. Whenever there is any discrepancy between the two licenses,
  7. the BSD license will take precedence.
  8. Set tabs to 4 for best viewing.
  9. */
  10. /*
  11. You may want to rename the 'data' field to 'session_data' as
  12. 'data' appears to be a reserved word for one or more of the following:
  13. ANSI SQL
  14. IBM DB2
  15. MS SQL Server
  16. Postgres
  17. SAP
  18. If you do, then execute:
  19. ADODB_Session::dataFieldName('session_data');
  20. */
  21. if (!defined('_ADODB_LAYER')) {
  22. require_once realpath(dirname(__FILE__) . '/../adodb.inc.php');
  23. }
  24. if (defined('ADODB_SESSION')) return 1;
  25. define('ADODB_SESSION', dirname(__FILE__));
  26. /*
  27. Unserialize session data manually. See http://phplens.com/lens/lensforum/msgs.php?id=9821
  28. From Kerr Schere, to unserialize session data stored via ADOdb.
  29. 1. Pull the session data from the db and loop through it.
  30. 2. Inside the loop, you will need to urldecode the data column.
  31. 3. After urldecode, run the serialized string through this function:
  32. */
  33. function adodb_unserialize( $serialized_string )
  34. {
  35. $variables = array( );
  36. $a = preg_split( "/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
  37. for( $i = 0; $i < count( $a ); $i = $i+2 ) {
  38. $variables[$a[$i]] = unserialize( $a[$i+1] );
  39. }
  40. return( $variables );
  41. }
  42. /*!
  43. \static
  44. */
  45. class ADODB_Session {
  46. /////////////////////
  47. // getter/setter methods
  48. /////////////////////
  49. /*!
  50. */
  51. function driver($driver = null) {
  52. static $_driver = 'mysql';
  53. static $set = false;
  54. if (!is_null($driver)) {
  55. $_driver = trim($driver);
  56. $set = true;
  57. } elseif (!$set) {
  58. // backwards compatibility
  59. if (isset($GLOBALS['ADODB_SESSION_DRIVER'])) {
  60. return $GLOBALS['ADODB_SESSION_DRIVER'];
  61. }
  62. }
  63. return $_driver;
  64. }
  65. /*!
  66. */
  67. function host($host = null) {
  68. static $_host = 'localhost';
  69. static $set = false;
  70. if (!is_null($host)) {
  71. $_host = trim($host);
  72. $set = true;
  73. } elseif (!$set) {
  74. // backwards compatibility
  75. if (isset($GLOBALS['ADODB_SESSION_CONNECT'])) {
  76. return $GLOBALS['ADODB_SESSION_CONNECT'];
  77. }
  78. }
  79. return $_host;
  80. }
  81. /*!
  82. */
  83. function user($user = null) {
  84. static $_user = 'root';
  85. static $set = false;
  86. if (!is_null($user)) {
  87. $_user = trim($user);
  88. $set = true;
  89. } elseif (!$set) {
  90. // backwards compatibility
  91. if (isset($GLOBALS['ADODB_SESSION_USER'])) {
  92. return $GLOBALS['ADODB_SESSION_USER'];
  93. }
  94. }
  95. return $_user;
  96. }
  97. /*!
  98. */
  99. function password($password = null) {
  100. static $_password = '';
  101. static $set = false;
  102. if (!is_null($password)) {
  103. $_password = $password;
  104. $set = true;
  105. } elseif (!$set) {
  106. // backwards compatibility
  107. if (isset($GLOBALS['ADODB_SESSION_PWD'])) {
  108. return $GLOBALS['ADODB_SESSION_PWD'];
  109. }
  110. }
  111. return $_password;
  112. }
  113. /*!
  114. */
  115. function database($database = null) {
  116. static $_database = 'xphplens_2';
  117. static $set = false;
  118. if (!is_null($database)) {
  119. $_database = trim($database);
  120. $set = true;
  121. } elseif (!$set) {
  122. // backwards compatibility
  123. if (isset($GLOBALS['ADODB_SESSION_DB'])) {
  124. return $GLOBALS['ADODB_SESSION_DB'];
  125. }
  126. }
  127. return $_database;
  128. }
  129. /*!
  130. */
  131. function persist($persist = null)
  132. {
  133. static $_persist = true;
  134. if (!is_null($persist)) {
  135. $_persist = trim($persist);
  136. }
  137. return $_persist;
  138. }
  139. /*!
  140. */
  141. function lifetime($lifetime = null) {
  142. static $_lifetime;
  143. static $set = false;
  144. if (!is_null($lifetime)) {
  145. $_lifetime = (int) $lifetime;
  146. $set = true;
  147. } elseif (!$set) {
  148. // backwards compatibility
  149. if (isset($GLOBALS['ADODB_SESS_LIFE'])) {
  150. return $GLOBALS['ADODB_SESS_LIFE'];
  151. }
  152. }
  153. if (!$_lifetime) {
  154. $_lifetime = ini_get('session.gc_maxlifetime');
  155. if ($_lifetime <= 1) {
  156. // bug in PHP 4.0.3 pl 1 -- how about other versions?
  157. //print "<h3>Session Error: PHP.INI setting <i>session.gc_maxlifetime</i>not set: $lifetime</h3>";
  158. $_lifetime = 1440;
  159. }
  160. }
  161. return $_lifetime;
  162. }
  163. /*!
  164. */
  165. function debug($debug = null) {
  166. static $_debug = false;
  167. static $set = false;
  168. if (!is_null($debug)) {
  169. $_debug = (bool) $debug;
  170. $conn = ADODB_Session::_conn();
  171. if ($conn) {
  172. $conn->debug = $_debug;
  173. }
  174. $set = true;
  175. } elseif (!$set) {
  176. // backwards compatibility
  177. if (isset($GLOBALS['ADODB_SESS_DEBUG'])) {
  178. return $GLOBALS['ADODB_SESS_DEBUG'];
  179. }
  180. }
  181. return $_debug;
  182. }
  183. /*!
  184. */
  185. function expireNotify($expire_notify = null) {
  186. static $_expire_notify;
  187. static $set = false;
  188. if (!is_null($expire_notify)) {
  189. $_expire_notify = $expire_notify;
  190. $set = true;
  191. } elseif (!$set) {
  192. // backwards compatibility
  193. if (isset($GLOBALS['ADODB_SESSION_EXPIRE_NOTIFY'])) {
  194. return $GLOBALS['ADODB_SESSION_EXPIRE_NOTIFY'];
  195. }
  196. }
  197. return $_expire_notify;
  198. }
  199. /*!
  200. */
  201. function table($table = null) {
  202. static $_table = 'sessions';
  203. static $set = false;
  204. if (!is_null($table)) {
  205. $_table = trim($table);
  206. $set = true;
  207. } elseif (!$set) {
  208. // backwards compatibility
  209. if (isset($GLOBALS['ADODB_SESSION_TBL'])) {
  210. return $GLOBALS['ADODB_SESSION_TBL'];
  211. }
  212. }
  213. return $_table;
  214. }
  215. /*!
  216. */
  217. function optimize($optimize = null) {
  218. static $_optimize = false;
  219. static $set = false;
  220. if (!is_null($optimize)) {
  221. $_optimize = (bool) $optimize;
  222. $set = true;
  223. } elseif (!$set) {
  224. // backwards compatibility
  225. if (defined('ADODB_SESSION_OPTIMIZE')) {
  226. return true;
  227. }
  228. }
  229. return $_optimize;
  230. }
  231. /*!
  232. */
  233. function syncSeconds($sync_seconds = null) {
  234. static $_sync_seconds = 60;
  235. static $set = false;
  236. if (!is_null($sync_seconds)) {
  237. $_sync_seconds = (int) $sync_seconds;
  238. $set = true;
  239. } elseif (!$set) {
  240. // backwards compatibility
  241. if (defined('ADODB_SESSION_SYNCH_SECS')) {
  242. return ADODB_SESSION_SYNCH_SECS;
  243. }
  244. }
  245. return $_sync_seconds;
  246. }
  247. /*!
  248. */
  249. function clob($clob = null) {
  250. static $_clob = false;
  251. static $set = false;
  252. if (!is_null($clob)) {
  253. $_clob = strtolower(trim($clob));
  254. $set = true;
  255. } elseif (!$set) {
  256. // backwards compatibility
  257. if (isset($GLOBALS['ADODB_SESSION_USE_LOBS'])) {
  258. return $GLOBALS['ADODB_SESSION_USE_LOBS'];
  259. }
  260. }
  261. return $_clob;
  262. }
  263. /*!
  264. */
  265. function dataFieldName($data_field_name = null) {
  266. static $_data_field_name = 'data';
  267. if (!is_null($data_field_name)) {
  268. $_data_field_name = trim($data_field_name);
  269. }
  270. return $_data_field_name;
  271. }
  272. /*!
  273. */
  274. function filter($filter = null) {
  275. static $_filter = array();
  276. if (!is_null($filter)) {
  277. if (!is_array($filter)) {
  278. $filter = array($filter);
  279. }
  280. $_filter = $filter;
  281. }
  282. return $_filter;
  283. }
  284. /*!
  285. */
  286. function encryptionKey($encryption_key = null) {
  287. static $_encryption_key = 'CRYPTED ADODB SESSIONS ROCK!';
  288. if (!is_null($encryption_key)) {
  289. $_encryption_key = $encryption_key;
  290. }
  291. return $_encryption_key;
  292. }
  293. /////////////////////
  294. // private methods
  295. /////////////////////
  296. /*!
  297. */
  298. function &_conn($conn=null) {
  299. return $GLOBALS['ADODB_SESS_CONN'];
  300. }
  301. /*!
  302. */
  303. function _crc($crc = null) {
  304. static $_crc = false;
  305. if (!is_null($crc)) {
  306. $_crc = $crc;
  307. }
  308. return $_crc;
  309. }
  310. /*!
  311. */
  312. function _init() {
  313. session_module_name('user');
  314. session_set_save_handler(
  315. array('ADODB_Session', 'open'),
  316. array('ADODB_Session', 'close'),
  317. array('ADODB_Session', 'read'),
  318. array('ADODB_Session', 'write'),
  319. array('ADODB_Session', 'destroy'),
  320. array('ADODB_Session', 'gc')
  321. );
  322. }
  323. /*!
  324. */
  325. function _sessionKey() {
  326. // use this function to create the encryption key for crypted sessions
  327. // crypt the used key, ADODB_Session::encryptionKey() as key and session_id() as salt
  328. return crypt(ADODB_Session::encryptionKey(), session_id());
  329. }
  330. /*!
  331. */
  332. function _dumprs($rs) {
  333. $conn =& ADODB_Session::_conn();
  334. $debug = ADODB_Session::debug();
  335. if (!$conn) {
  336. return;
  337. }
  338. if (!$debug) {
  339. return;
  340. }
  341. if (!$rs) {
  342. echo "<br />\$rs is null or false<br />\n";
  343. return;
  344. }
  345. //echo "<br />\nAffected_Rows=",$conn->Affected_Rows(),"<br />\n";
  346. if (!is_object($rs)) {
  347. return;
  348. }
  349. require_once ADODB_SESSION.'/../tohtml.inc.php';
  350. rs2html($rs);
  351. }
  352. /////////////////////
  353. // public methods
  354. /////////////////////
  355. /*!
  356. Create the connection to the database.
  357. If $conn already exists, reuse that connection
  358. */
  359. function open($save_path, $session_name, $persist = null) {
  360. $conn =& ADODB_Session::_conn();
  361. if ($conn) {
  362. return true;
  363. }
  364. $database = ADODB_Session::database();
  365. $debug = ADODB_Session::debug();
  366. $driver = ADODB_Session::driver();
  367. $host = ADODB_Session::host();
  368. $password = ADODB_Session::password();
  369. $user = ADODB_Session::user();
  370. if (!is_null($persist)) {
  371. ADODB_Session::persist($persist);
  372. } else {
  373. $persist = ADODB_Session::persist();
  374. }
  375. # these can all be defaulted to in php.ini
  376. # assert('$database');
  377. # assert('$driver');
  378. # assert('$host');
  379. // cannot use =& below - do not know why...
  380. $conn =& ADONewConnection($driver);
  381. if ($debug) {
  382. $conn->debug = true;
  383. // ADOConnection::outp( " driver=$driver user=$user pwd=$password db=$database ");
  384. }
  385. if ($persist) {
  386. switch($persist) {
  387. default:
  388. case 'P': $ok = $conn->PConnect($host, $user, $password, $database); break;
  389. case 'C': $ok = $conn->Connect($host, $user, $password, $database); break;
  390. case 'N': $ok = $conn->NConnect($host, $user, $password, $database); break;
  391. }
  392. } else {
  393. $ok = $conn->Connect($host, $user, $password, $database);
  394. }
  395. if ($ok) $GLOBALS['ADODB_SESS_CONN'] =& $conn;
  396. else
  397. ADOConnection::outp('<p>Session: connection failed</p>', false);
  398. return $ok;
  399. }
  400. /*!
  401. Close the connection
  402. */
  403. function close() {
  404. $conn =& ADODB_Session::_conn();
  405. if ($conn) {
  406. $conn->Close();
  407. }
  408. return true;
  409. }
  410. /*
  411. Slurp in the session variables and return the serialized string
  412. */
  413. function read($key) {
  414. $conn =& ADODB_Session::_conn();
  415. $data = ADODB_Session::dataFieldName();
  416. $filter = ADODB_Session::filter();
  417. $table = ADODB_Session::table();
  418. if (!$conn) {
  419. return '';
  420. }
  421. assert('$table');
  422. $qkey = $conn->quote($key);
  423. $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
  424. $sql = "SELECT $data FROM $table WHERE $binary sesskey = $qkey AND expiry >= " . time();
  425. $rs =& $conn->Execute($sql);
  426. //ADODB_Session::_dumprs($rs);
  427. if ($rs) {
  428. if ($rs->EOF) {
  429. $v = '';
  430. } else {
  431. $v = reset($rs->fields);
  432. $filter = array_reverse($filter);
  433. foreach ($filter as $f) {
  434. if (is_object($f)) {
  435. $v = $f->read($v, ADODB_Session::_sessionKey());
  436. }
  437. }
  438. $v = rawurldecode($v);
  439. }
  440. $rs->Close();
  441. ADODB_Session::_crc(strlen($v) . crc32($v));
  442. return $v;
  443. }
  444. return '';
  445. }
  446. /*!
  447. Write the serialized data to a database.
  448. If the data has not been modified since the last read(), we do not write.
  449. */
  450. function write($key, $val) {
  451. $clob = ADODB_Session::clob();
  452. $conn =& ADODB_Session::_conn();
  453. $crc = ADODB_Session::_crc();
  454. $data = ADODB_Session::dataFieldName();
  455. $debug = ADODB_Session::debug();
  456. $driver = ADODB_Session::driver();
  457. $expire_notify = ADODB_Session::expireNotify();
  458. $filter = ADODB_Session::filter();
  459. $lifetime = ADODB_Session::lifetime();
  460. $table = ADODB_Session::table();
  461. if (!$conn) {
  462. return false;
  463. }
  464. assert('$table');
  465. $expiry = time() + $lifetime;
  466. $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
  467. // crc32 optimization since adodb 2.1
  468. // now we only update expiry date, thx to sebastian thom in adodb 2.32
  469. if ($crc !== false && $crc == (strlen($val) . crc32($val))) {
  470. if ($debug) {
  471. echo '<p>Session: Only updating date - crc32 not changed</p>';
  472. }
  473. $sql = "UPDATE $table SET expiry = ".$conn->Param('0')." WHERE $binary sesskey = ".$conn->Param('1')." AND expiry >= ".$conn->Param('2');
  474. $rs =& $conn->Execute($sql,array($expiry,$key,time()));
  475. ADODB_Session::_dumprs($rs);
  476. if ($rs) {
  477. $rs->Close();
  478. }
  479. return true;
  480. }
  481. $val = rawurlencode($val);
  482. foreach ($filter as $f) {
  483. if (is_object($f)) {
  484. $val = $f->write($val, ADODB_Session::_sessionKey());
  485. }
  486. }
  487. $arr = array('sesskey' => $key, 'expiry' => $expiry, $data => $val, 'expireref' => '');
  488. if ($expire_notify) {
  489. $var = reset($expire_notify);
  490. global $$var;
  491. if (isset($$var)) {
  492. $arr['expireref'] = $$var;
  493. }
  494. }
  495. if (!$clob) { // no lobs, simply use replace()
  496. $arr[$data] = $conn->qstr($val);
  497. $rs = $conn->Replace($table, $arr, 'sesskey', $autoQuote = true);
  498. ADODB_Session::_dumprs($rs);
  499. } else {
  500. // what value shall we insert/update for lob row?
  501. switch ($driver) {
  502. // empty_clob or empty_lob for oracle dbs
  503. case 'oracle':
  504. case 'oci8':
  505. case 'oci8po':
  506. case 'oci805':
  507. $lob_value = sprintf('empty_%s()', strtolower($clob));
  508. break;
  509. // null for all other
  510. default:
  511. $lob_value = 'null';
  512. break;
  513. }
  514. // do we insert or update? => as for sesskey
  515. $rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = $qkey");
  516. ADODB_Session::_dumprs($rs);
  517. if ($rs && reset($rs->fields) > 0) {
  518. $sql = "UPDATE $table SET expiry = $expiry, $data = $lob_value WHERE sesskey = $qkey";
  519. } else {
  520. $sql = "INSERT INTO $table (expiry, $data, sesskey) VALUES ($expiry, $lob_value, $qkey)";
  521. }
  522. if ($rs) {
  523. $rs->Close();
  524. }
  525. $err = '';
  526. $rs1 =& $conn->Execute($sql);
  527. ADODB_Session::_dumprs($rs1);
  528. if (!$rs1) {
  529. $err = $conn->ErrorMsg()."\n";
  530. }
  531. $rs2 =& $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
  532. ADODB_Session::_dumprs($rs2);
  533. if (!$rs2) {
  534. $err .= $conn->ErrorMsg()."\n";
  535. }
  536. $rs = ($rs && $rs2) ? true : false;
  537. if ($rs1) {
  538. $rs1->Close();
  539. }
  540. if (is_object($rs2)) {
  541. $rs2->Close();
  542. }
  543. }
  544. if (!$rs) {
  545. ADOConnection::outp('<p>Session Replace: ' . $conn->ErrorMsg() . '</p>', false);
  546. return false;
  547. } else {
  548. // bug in access driver (could be odbc?) means that info is not committed
  549. // properly unless select statement executed in Win2000
  550. if ($conn->databaseType == 'access') {
  551. $sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
  552. $rs =& $conn->Execute($sql);
  553. ADODB_Session::_dumprs($rs);
  554. if ($rs) {
  555. $rs->Close();
  556. }
  557. }
  558. }
  559. return $rs ? true : false;
  560. }
  561. /*!
  562. */
  563. function destroy($key) {
  564. $conn =& ADODB_Session::_conn();
  565. $table = ADODB_Session::table();
  566. $expire_notify = ADODB_Session::expireNotify();
  567. if (!$conn) {
  568. return false;
  569. }
  570. assert('$table');
  571. $qkey = $conn->quote($key);
  572. $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
  573. if ($expire_notify) {
  574. reset($expire_notify);
  575. $fn = next($expire_notify);
  576. $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
  577. $sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
  578. $rs =& $conn->Execute($sql);
  579. ADODB_Session::_dumprs($rs);
  580. $conn->SetFetchMode($savem);
  581. if (!$rs) {
  582. return false;
  583. }
  584. if (!$rs->EOF) {
  585. $ref = $rs->fields[0];
  586. $key = $rs->fields[1];
  587. //assert('$ref');
  588. //assert('$key');
  589. $fn($ref, $key);
  590. }
  591. $rs->Close();
  592. }
  593. $sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
  594. $rs =& $conn->Execute($sql);
  595. ADODB_Session::_dumprs($rs);
  596. if ($rs) {
  597. $rs->Close();
  598. }
  599. return $rs ? true : false;
  600. }
  601. /*!
  602. */
  603. function gc($maxlifetime) {
  604. $conn =& ADODB_Session::_conn();
  605. $debug = ADODB_Session::debug();
  606. $expire_notify = ADODB_Session::expireNotify();
  607. $optimize = ADODB_Session::optimize();
  608. $sync_seconds = ADODB_Session::syncSeconds();
  609. $table = ADODB_Session::table();
  610. if (!$conn) {
  611. return false;
  612. }
  613. assert('$table');
  614. $time = time();
  615. $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : '';
  616. if ($expire_notify) {
  617. reset($expire_notify);
  618. $fn = next($expire_notify);
  619. $savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
  620. $sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
  621. $rs =& $conn->Execute($sql);
  622. ADODB_Session::_dumprs($rs);
  623. $conn->SetFetchMode($savem);
  624. if ($rs) {
  625. $conn->BeginTrans();
  626. $keys = array();
  627. while (!$rs->EOF) {
  628. $ref = $rs->fields[0];
  629. $key = $rs->fields[1];
  630. $fn($ref, $key);
  631. $del = $conn->Execute("DELETE FROM $table WHERE sesskey='$key'");
  632. $rs->MoveNext();
  633. }
  634. $rs->Close();
  635. $conn->CommitTrans();
  636. }
  637. } else {
  638. $sql = "DELETE FROM $table WHERE expiry < $time";
  639. $rs =& $conn->Execute($sql);
  640. ADODB_Session::_dumprs($rs);
  641. if ($rs) {
  642. $rs->Close();
  643. }
  644. if ($debug) {
  645. ADOConnection::outp("<p><b>Garbage Collection</b>: $sql</p>");
  646. }
  647. }
  648. // suggested by Cameron, "GaM3R" <gamr@outworld.cx>
  649. if ($optimize) {
  650. $driver = ADODB_Session::driver();
  651. if (preg_match('/mysql/i', $driver)) {
  652. $sql = "OPTIMIZE TABLE $table";
  653. }
  654. if (preg_match('/postgres/i', $driver)) {
  655. $sql = "VACUUM $table";
  656. }
  657. if (!empty($sql)) {
  658. $conn->Execute($sql);
  659. }
  660. }
  661. if ($sync_seconds) {
  662. $sql = 'SELECT ';
  663. if ($conn->dataProvider === 'oci8') {
  664. $sql .= "TO_CHAR({$conn->sysTimeStamp}, 'RRRR-MM-DD HH24:MI:SS')";
  665. } else {
  666. $sql .= $conn->sysTimeStamp;
  667. }
  668. $sql .= " FROM $table";
  669. $rs =& $conn->SelectLimit($sql, 1);
  670. if ($rs && !$rs->EOF) {
  671. $dbts = reset($rs->fields);
  672. $rs->Close();
  673. $dbt = $conn->UnixTimeStamp($dbts);
  674. $t = time();
  675. if (abs($dbt - $t) >= $sync_seconds) {
  676. global $HTTP_SERVER_VARS;
  677. $msg = __FILE__ .
  678. ": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: " .
  679. " database=$dbt ($dbts), webserver=$t (diff=". (abs($dbt - $t) / 3600) . ' hours)';
  680. error_log($msg);
  681. if ($debug) {
  682. ADOConnection::outp("<p>$msg</p>");
  683. }
  684. }
  685. }
  686. }
  687. return true;
  688. }
  689. }
  690. ADODB_Session::_init();
  691. // for backwards compatability only
  692. function adodb_sess_open($save_path, $session_name, $persist = true) {
  693. return ADODB_Session::open($save_path, $session_name, $persist);
  694. }
  695. // for backwards compatability only
  696. function adodb_sess_gc($t)
  697. {
  698. return ADODB_Session::gc($t);
  699. }
  700. ?>