{ $this->conn = null; return true; } /** * Destoroy the session * @param string session id * @return bool */ public function destroy($session_id) { $stmt = $this->conn->prepare(self::DELETE_SESSION_QUERY); $stmt->bindParam(":id", $session_id); return $stmt->execute(); } /** * Garbage Collector * @param int life time (sec.) * @return bool */ public function gc($maxlifetime) { $expired = time() - $maxlifetime; $stmt = $this->conn->prepare(self::DELETE_EXPIRED_SESSION_QUERY); $stmt->bindParam(":expired", $expired); return $stmt->execute(); } } $handler = new DatabaseSessionHandler(); $handler->init("mysql", "172.22.102.88", "root", "kobe91925", "owncloud"); $session_Est = session_set_save_handler($handler, true);
/** * Returns an instance of LiveCart Application * * Method prevents of creating multiple application instances during one request * * @return LiveCart */ public function __construct() { ClassLoader::import('application.model.ActiveRecordModel'); ClassLoader::import('framework.renderer.SmartyRenderer'); parent::__construct(); unset($this->session, $this->config, $this->locale, $this->localeName); $dsnPath = ClassLoader::getRealPath("storage.configuration.database") . '.php'; $this->isInstalled = file_exists($dsnPath); ActiveRecordModel::setApplicationInstance($this); if ($this->isInstalled) { ActiveRecordModel::setDSN(include $dsnPath); if (!session_id()) { $session = new DatabaseSessionHandler(); if ($this->getConfig()->get('USE_DEFAULT_SESSION_HANDLER') == false) { $session->setHandlerInstance(); } $this->sessionHandler = $session; } } // LiveCart request routing rules $this->initRouter(); if (file_exists(ClassLoader::getRealPath('cache.dev'))) { $this->setDevMode(true); } if ($this->isDevMode()) { ActiveRecordModel::getLogger()->setLogFileName(ClassLoader::getRealPath("cache") . DIRECTORY_SEPARATOR . "activerecord.log"); if (phpversion() >= '5.3') { error_reporting(E_ALL & ~E_DEPRECATED); } else { error_reporting(E_ALL); } ini_set('display_errors', 'On'); } $compileDir = $this->isTemplateCustomizationMode() ? 'cache.templates_c.customize' : 'cache.templates_c'; SmartyRenderer::setCompileDir(ClassLoader::getRealPath($compileDir)); // mod_rewrite disabled? if ($this->request->get('noRewrite')) { $this->router->setBaseDir($_SERVER['baseDir'], $_SERVER['virtualBaseDir']); //$this->router->enableURLRewrite(false); } }