/** * First start output buffering then start SESSION * Reads configuration and main-language file lang.php and creates * Database-Object $dbo * * @param string $json Return JSON-Encoded answer * @param string $send_header If set to false headers are completely skipped * @return void */ function obstart($json = false, $send_header = true) { global $dbo, $config, $databases, $dump, $lang; if ($config['ob_gzhandler']) { if (!@ob_start("ob_gzhandler")) { @ob_start(); } } // if default config file doesn't exists, it is a new installation -> redirect to installation if (!$json && !file_exists('./work/config/mysqldumper.php')) { header("location: install.php"); die; exit; } session_name('MySQLDumper'); $res = session_start(); if (false === $res) { die("Error starting session! Check server."); } if (isset($_SESSION['config_file'])) { $config['config_file'] = $_SESSION['config_file']; } else { $config['config_file'] = 'mysqldumper'; } if ($send_header) { header('Pragma: no-cache'); header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Expires: -1'); // Datum in der Vergangenheit header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT'); if (!$json) { header('Content-Type: text/html; charset=UTF-8'); } else { header('Content-type: application/x-json'); } } // get config from configuration file if not set if (!isset($_SESSION['config'])) { getConfig($config['config_file']); } else { // otherwise get parameters from session $config = array_merge($config, $_SESSION['config']); if (isset($_SESSION['databases'])) { $databases = $_SESSION['databases']; } if (isset($_SESSION['dump'])) { $dump = $_SESSION['dump']; } } // special case -> configuration is set to a language that was deleted meanwhile if (!is_readable('./language/' . $config['language'] . '/lang.php')) { $config['language'] = 'en'; } include './language/' . $config['language'] . '/lang.php'; // create database object $dbo = MsdDbFactory::getAdapter($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbport'], $config['dbsocket']); if (!isset($_SESSION['databases'])) { setDefaultConfig(); } //echo $config['db_actual']; // die(); if (isset($config['db_actual']) && $config['db_actual'] > '') { $dbo->selectDb($config['db_actual']); } else { if (!isset($databases)) { // no config loaded -> SetDefault-Values setDefaultConfig(); } // get first DB-Name and set as actual db $dbNames = array_keys($databases); $config['db_actual'] = $dbNames[0]; $dbo->selectDb($config['db_actual']); } //$_SESSION['config'] = $config; //$_SESSION['databases'] = $databases; }
<?php $memberLoginLevel = 8; $default_class = 1; include "../../defaultSetting.php"; include "../../public_include/Pasing.class.php"; $this = new Pasing(); //기본환경설정을 한다. setDefaultConfig(); include "../../member/include/config.inc.php"; $this->setHtmlHeader(); $this->callAdminTopFrame(); if ($this->page < 1) { $this->page = 1; } //$this->queryOption = "page=$this->page"; if ($this->sortField == "") { $this->sortField = "signDate"; $this->sortType = "desc"; } if ($this->sortMode == "today") { $todayTime = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $whereOption[] = "signDate > {$todayTime}"; $this->queryOption .= "&sortMode={$this->sortMode}"; } else { if ($this->sortMode == "member") { $whereOption[] = "author = {$this->sortLevel}"; $this->queryOption .= "&sortMode={$this->sortMode}&sortLevel={$this->sortLevel}"; } else { if ($this->sortMode == "sex") { $whereOption[] = "sex = '{$this->sortTarget}'";
function restoreToken($appid, $access_token = false) { $createtime = mktime(); if (!setDefaultConfig()) { return false; } if ($access_token != false) { $sql = "UPDATE `wx_config` SET `access_token`='{$access_token}',createtime='{$createtime}' WHERE appid='{$appid}'"; $result = mysql_query($sql); if (!$result) { return false; } if (mysql_num_rows($result) < 1) { return 3; } //appid有没有写错? } else { $sql = "select * from wx_config where appid='{$appid}'"; $result = mysql_query($sql); if (!$result) { return false; } if (mysql_num_rows($result) < 1) { return 3; } //appid有没有写错? $token = mysql_fetch_array($result, MYSQL_ASSOC); $createtime = $token['createtime']; $access_token = $token['access_token']; if ($token['createtime'] - mktime() + EXP_TIME < 100) { return 2; } } return array('access_token' => $access_token, 'createtime' => $createtime); }