private static function gen_key($str) { if (self::$config == null) { self::$config = CONFIG::get('cache'); } return md5($str . self::$config['seed']); }
function INIT() { global $_PLUGIN; $_PLUGIN = array(); $_PLUGIN['list'] = CACHE::get('plugins'); $_PLUGIN['obj'] = array(); $_PLUGIN['hook'] = array(); $_PLUGIN['page'] = array(); foreach ($_PLUGIN['list'] as $plugin) { $id = $plugin['name']; $classfile = ROOT . './plugins/' . $id . '/plugin.class.php'; if (file_exists($classfile)) { require_once $classfile; $classname = "plugin_{$id}"; if (!class_exists("plugin_{$id}", false)) { continue; } $_PLUGIN['obj'][$id] = new $classname(); $methods = get_class_methods($classname); foreach ($methods as $method) { $_PLUGIN['hook'][$method][] = $id; } if (method_exists($_PLUGIN['obj'][$id], 'getMethods')) { $_PLUGIN['obj'][$id]->modules = $_PLUGIN['obj'][$id]->getMethods(); } foreach ($_PLUGIN['obj'][$id]->modules as $module) { self::parse_module($module, $id); } } } }
function _do_register($username, $password, $email) { $user = array('username' => $username, 'password' => 'FAKE_PASSWORD', 'email' => $email); $uid = DB::insert('member', $user); $user['uid'] = $uid; $password = Widget_Password::encrypt($user, $password); DB::query("UPDATE member SET password='******' WHERE uid='{$uid}'"); DB::insert('member_setting', array('uid' => $uid, 'cookie' => '')); HOOK::run('register_user', true, $user); CACHE::update('username'); CACHE::save('user_setting_' . $uid, ''); return $uid; }
function saveSetting($key, $value) { $pluginid = $this->getPluginId(); $vars = CACHE::get('plugin'); if (!$vars) { $vars = array(); } if (!$vars[$pluginid]) { $vars[$pluginid] = array(); } $vars[$pluginid][$key] = $value; DB::query("REPLACE INTO plugin_var SET `key` = '" . addslashes($key) . "', `value` = '" . addslashes($value) . "', pluginid='" . addslashes($pluginid) . "'"); CACHE::clean('plugin'); }
function init() { global $_config; if (!$_config) { require_once SYSTEM_ROOT . './config.inc.php'; } $this->init_header(); $this->init_useragent(); CACHE::pre_fetch('setting', 'plugin', 'plugins'); Updater::init(); $this->init_syskey(); $this->init_cookie(); cloud::init(); HOOK::INIT(); $this->init_final(); }
public static function loop() { if (defined('IN_XAE')) { return array('status' => -3); } $file_list = CACHE::get('need_download'); list($path, $hash) = array_pop($file_list); if (!$path) { return array('status' => 1); } $ret = self::_download_file($path, $hash); if ($ret < 0) { return array('status' => $ret, 'file' => $path); } CACHE::save('need_download', $file_list); $max = sizeof(CACHE::get('kk_updater')); $current = $max - sizeof($file_list); return array('status' => 0, 'precent' => round($current / $max * 100), 'file' => $path); }
function _load_setting() { $this->_setting = CACHE::get('mail_' . $this->id); if ($this->_setting) { return; } $this->_setting = array(); if ($this->config) { foreach ($this->config as $k => $v) { $this->_setting[$v[1]] = $v[3]; } } $class = getSetting('mail_class'); $query = DB::query("SELECT * FROM setting WHERE k LIKE '_mail_{$class}_%'"); while ($result = DB::fetch($query)) { $key = str_replace("_mail_{$class}_", '', $result['k']); $this->_setting[$key] = $result['v']; } CACHE::save('mail_' . $this->id, $this->_setting); }
ob_start(); //Start a buffer, mainly in case there is a mysql error require(SERVER_ROOT.'/classes/class_debug.php'); //Require the debug class require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the encryption class require(SERVER_ROOT.'/classes/class_useragent.php'); //Require the useragent class require(SERVER_ROOT.'/classes/class_time.php'); //Require the time class require(SERVER_ROOT.'/classes/class_search.php'); //Require the searching class $Debug = new DEBUG; $Debug->handle_errors(); $DB = new DB_MYSQL; $Cache = new CACHE; $Enc = new CRYPT; $UA = new USER_AGENT; $SS = new SPHINX_SEARCH; //resource_type://username:password@domain:port/path?query_string#anchor define('RESOURCE_REGEX','(https?|ftps?):\/\/'); define('IP_REGEX','(\d{1,3}\.){3}\d{1,3}'); define('DOMAIN_REGEX','(ssl.)?(www.)?[a-z0-9-\.]{1,255}\.[a-zA-Z]{2,6}'); define('PORT_REGEX', '\d{1,5}'); define('URL_REGEX','('.RESOURCE_REGEX.')('.IP_REGEX.'|'.DOMAIN_REGEX.')(:'.PORT_REGEX.')?(\/\S+)*'); define('EMAIL_REGEX','[_a-z0-9-]+([.+][_a-z0-9-]+)*@'.DOMAIN_REGEX); define('IMAGE_REGEX', URL_REGEX.'\/\S+\.(jpg|jpeg|tif|tiff|png|gif|bmp)');
function saveSetting($k, $v) { if (!defined('IN_XAE') && $k == 'version') { return saveVersion($v); } static $cache_cleaned = false; $v = addslashes($v); DB::query("REPLACE INTO setting SET v='{$v}', k='{$k}'"); if ($cache_cleaned) { return; } CACHE::clean('setting'); $cache_cleaned = true; }
if(isset($_SERVER['http_if_modified_since'])) { header("Status: 304 Not Modified"); die(); } header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time()+3600*24*120)); //120 days header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C',time())); require('classes/config.php'); //The config contains all site wide configuration information as well as memcached rules if (!extension_loaded('gd')) { error('nogd'); } require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the encryption class $Cache = NEW CACHE; //Load the caching class $Enc = NEW CRYPT; //Load the encryption class if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); } if(isset($LoginCookie)) { list($SessionID, $UserID)=explode("|~|",$Enc->decrypt($LoginCookie)); $UserID = (int)$UserID; $UserInfo = $Cache->get_value('user_info_'.$UserID); $Permissions = $Cache->get_value('perm_'.$UserInfo['PermissionID']); } function check_perms($PermissionName) { global $Permissions; return (isset($Permissions['Permissions'][$PermissionName])) ? true : false; }
<?php require "cache.php"; require "misc.class.php"; $Cache = new CACHE(); if (($lasthpm = $Cache->get_value('ptpimg_hpm_last')) === false) { $lasthpm = $Cache->get_value('ptpimg_hpm'); $Cache->cache_value('ptpimg_hpm_last', $lasthpm, 60); $Cache->delete_value('ptpimg_hpm'); } if (($hpm = $Cache->get_value('ptpimg_hpm')) === false) { $hpm = 1; $Cache->cache_value('ptpimg_hpm', $hpm, 0); } else { $Cache->increment('ptpimg_hpm'); } echo "Average hits in the last minute: {$lasthpm}"; echo "<br /><br />"; echo $Cache->get_value('ptpimg_hpm_last'); echo "<br />"; echo $Cache->get_value('ptpimg_hpm');
function __construct(DATARequest $props = NULL) { global $GRAPH_INTERPOLATE_DATA_GAPS; global $GRAPH_ACCURACY_MARKS_IF_GAPS; global $GRAPH_INDICATE_MISSING_DATA; global $GRAPH_INDICATE_DATA_DENSITY; if ($props) { parent::__construct($props); } else { parent::__construct(new DATARequest()); } if ($this->width < 32 || $this->height < 32) { throw new ADEIException(translate("The graph dimmensions (%ux%u) are too small, use at least 32x32", $this->width, $this->height)); } /* DS, ToDo: We should restore some variables before we can reuse files if (is_file($TMP_PATH . "/" . $this->tmpfile)) $this->ready = true; else */ $this->reader = $this->req->CreateReader(); $opts = $this->req->GetOptions(); $this->use_cache_timewindow = $opts->Get('use_cache_timewindow'); $this->time_limit = $opts->GetDateLimit(); $this->set_time_axes = !$opts->Get('optimize_time_axes'); if (isset($this->req->props['precision'])) { $this->precision_mode = $this->FindPrecisionMode($this->req->props['precision']); } else { $this->precision_mode = 0; } if (isset($this->req->props['aggregation'])) { $this->aggregator = CACHE::FindAggregator($this->req->props['aggregation']); } else { $this->aggregator = CACHE::TYPE_AUTO; } if (isset($this->req->props['show_marks'])) { $this->show_marks = $this->FindMarksMode($this->req->props['show_marks']); } else { if ($GRAPH_ACCURACY_MARKS_IF_GAPS) { $this->show_marks = DRAW::MARKS_GAPS; } else { $this->show_marks = DRAW::MARKS_DEFAULT; } } if (isset($this->req->props['show_gaps'])) { $this->show_gaps = $this->FindGapsMode($this->req->props['show_gaps']); } else { if ($GRAPH_INDICATE_DATA_DENSITY) { eval("\$this->show_gaps = DRAW::{$GRAPH_INDICATE_DATA_DENSITY};"); } else { $this->show_gaps = $GRAPH_INDICATE_DATA_DENSITY; } } if (isset($this->req->props['interpolate'])) { $this->interpolate_gaps = $this->req->props['interpolate']; } else { $this->interpolate_gaps = $opts->Get('graph_interpolate', $GRAPH_INTERPOLATE_DATA_GAPS); } $this->allowed_gap = $opts->Get('maximal_allowed_gap', false); $this->hide_axes = $this->req->GetProp('hide_axes', false); }
$INSTALLER09['user_ratio4_slots'] = 10; define('TIME_NOW', time()); define('UC_USER', 0); define('UC_POWER_USER', 1); define('UC_VIP', 2); define('UC_UPLOADER', 3); define('UC_MODERATOR', 4); define('UC_ADMINISTRATOR', 5); define('UC_SYSOP', 6); // DB setup $INSTALLER09['mysql_host'] = "#mysql_host"; $INSTALLER09['mysql_user'] = "******"; $INSTALLER09['mysql_pass'] = "******"; $INSTALLER09['mysql_db'] = "#mysql_db"; require_once "include/class/class_cache.php"; $mc1 = new CACHE(); $INSTALLER09['expires']['user_passkey'] = 900; // 900 = 15 min $INSTALLER09['cache'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR; ////////////////// GLOBAL VARIABLES //////////////////////////// // DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU'RE DOING!! //=== bad stuff let's just kill this right off $agent = $_SERVER["HTTP_USER_AGENT"]; $detectedclient = $_SERVER["HTTP_USER_AGENT"]; if (isset($_SERVER['HTTP_COOKIE']) || isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) || isset($_SERVER['HTTP_ACCEPT_CHARSET'])) { exit('It takes 46 muscles to frown but only 4 to flip \'em the bird.'); } /////////////////////// FUNCTION DEFS /////////////////////////////////// function crazyhour_announce() { global $INSTALLER09;
//Require the database wrapper require SERVER_ROOT . '/classes/cache.class.php'; //Require the caching class require SERVER_ROOT . '/classes/encrypt.class.php'; //Require the encryption class require SERVER_ROOT . '/classes/time.class.php'; //Require the time class require SERVER_ROOT . '/classes/paranoia.class.php'; //Require the paranoia check_paranoia function require SERVER_ROOT . '/classes/regex.php'; require SERVER_ROOT . '/classes/util.php'; $Debug = new DEBUG(); $Debug->handle_errors(); $Debug->set_flag('Debug constructed'); $DB = new DB_MYSQL(); $Cache = new CACHE($MemcachedServers); $Enc = new CRYPT(); // Autoload classes. require SERVER_ROOT . '/classes/classloader.php'; // Note: G::initialize is called twice. // This is necessary as the code inbetween (initialization of $LoggedUser) makes use of G::$DB and G::$Cache. // TODO: remove one of the calls once we're moving everything into that class G::initialize(); //Begin browser identification $Browser = UserAgent::browser($_SERVER['HTTP_USER_AGENT']); $OperatingSystem = UserAgent::operating_system($_SERVER['HTTP_USER_AGENT']); //$Mobile = UserAgent::mobile($_SERVER['HTTP_USER_AGENT']); $Mobile = in_array($_SERVER['HTTP_HOST'], array('m.' . NONSSL_SITE_URL, 'm.' . NONSSL_SITE_URL)); $Debug->set_flag('start user handling'); // Get classes // TODO: Remove these globals, replace by calls into Users
function handleAction() { global $uid; if (!is_admin($uid)) { exit('Access Denied'); } $data = array(); $data['msgx'] = 0; $setting = json_decode($this->getSetting('setting'), true); switch ($_GET['action']) { case 'getsetting': $query = DB::query("SELECT * FROM `zw_mailauth_list`;"); while ($result = DB::fetch($query)) { $result['regtime'] = date("Y年m月d日 H:m:s", $result['regtime']); $data['list'][] = $result; } $data['count'] = count($data['list']); $data['setting'] = json_decode($this->getSetting('setting'), true); break; case 'savesetting': $mailaddrepeat = $_POST['mailaddrepeat'] == 1 ? 1 : 0; $this->saveSetting('setting', json_encode(array('deathtime' => $_POST['deathtime'], 'title' => $_POST['title'], 'format' => $_POST['format'], 'mailaddrepeat' => $mailaddrepeat, 'abledomain' => $_POST['abledomain'], 'unabledomain' => $_POST['unabledomain'], 'unableaddress' => $_POST['unableaddress']))); $data['msg'] = '保存成功!'; break; case 'clear': $deltime = time() - $setting['deathtime'] * 60; DB::query("DELETE FROM `zw_mailauth_list` WHERE `regtime`<{$deltime}"); $data['msg'] = "清除成功!"; break; case 'alldel': DB::query('TRUNCATE TABLE `zw_mailauth_list`'); $data['msg'] = '已经全部删除!'; break; case 'allpass': $query = DB::query("SELECT * FROM `zw_mailauth_list`;"); while ($result = DB::fetch($query)) { $list[] = $result; } DB::query('TRUNCATE TABLE `zw_mailauth_list`'); for ($i = 0; $i < count($list); $i++) { $uid = DB::insert('member', array('username' => $list[$i]['username'], 'password' => $list[$i]['password'], 'email' => $list[$i]['email'])); DB::insert('member_setting', array('uid' => $uid)); CACHE::update('username'); CACHE::save('user_setting_' . $uid, ''); } $data['msg'] = '已经全部通过!'; break; case 'allresend': $query = DB::query("SELECT * FROM `zw_mailauth_list`"); while ($result = DB::fetch($query)) { $list[] = $result; } for ($i = 0; $i < count($list); $i++) { $content = $this->getMailContent($setting['format'], $list[$i]['username'], $list[$i]['authcode'], $list[$i]['deathtime']); DB::insert('mail_queue', array('to' => $list[$i]['email'], 'subject' => $setting['title'], 'content' => $content)); } DB::query("UPDATE `zw_mailauth_list` SET `regtime`=" . time()); saveSetting('mail_queue', 1); $data['msg'] = '已经全部加入到邮件队列中,稍后将自动发送!'; break; case 'resend': $result = DB::fetch_first("SELECT * FROM `zw_mailauth_list` WHERE `id`=" . intval($_GET['vid'])); $content = $this->getMailContent($setting['format'], $result['username'], $result['authcode'], $setting['deathtime']); DB::query("UPDATE `zw_mailauth_list` SET `regtime`=" . time() . " WHERE `id`=" . intval($_GET['vid'])); DB::insert('mail_queue', array('to' => $result['email'], 'subject' => $setting['title'], 'content' => $content)); saveSetting('mail_queue', 1); $data['msg'] = "新的验证邮件已经加入到队列中,稍后将自动发送!"; break; case 'pass': $result = DB::fetch_first("SELECT * FROM `zw_mailauth_list` WHERE `id`=" . intval($_GET['vid'])); $uid = DB::insert('member', array('username' => $result['username'], 'password' => $result['password'], 'email' => $result['email'])); DB::insert('member_setting', array('uid' => $uid)); CACHE::update('username'); CACHE::save('user_setting_' . $uid, ''); DB::query("DELETE FROM `zw_mailauth_list` WHERE id=" . intval($_GET['vid'])); $data['msg'] = '已经通过帐号的邮箱验证!'; break; case 'del': DB::query("DELETE FROM `zw_mailauth_list` WHERE id=" . intval($_GET['vid'])); $data['msg'] = '成功删除该记录!'; break; default: $data['msg'] = '没有指定 Action!!'; } echo json_encode($data); }
function kk_sign($n = array()) { global $_config; require_once SYSTEM_ROOT . './config.cfg.php'; foreach ($this->m as $m) { require_once SYSTEM_ROOT . "./class/{$m}.php"; } DEBUG::INIT(); require_once SYSTEM_ROOT . './function/core.php'; CACHE::load(array('plugins', 'setting')); $this->a(); $this->b(); $n = $n ? $n : $this->n; foreach ($n as $m) { $mm = "_load_module_{$m}"; if (method_exists($this, $mm)) { $this->{$mm}(); } else { $this->_load_module($m); } } $this->f(); }
function ApplyCache(CACHE &$cache, $flags = 0) { if ($flags & INTERVAL::NEED_AMOUNT || $this->end_mode || $this->all_mode) { if ($flags & INTERVAL::NEED_AMOUNT) { $info = $cache->GetInfo(REQUEST::NEED_COUNT); $this->Apply($info['first'], $info['last'], $info['records']); } else { $info = $cache->GetInfo(); $this->Apply($info['first'], $info['last']); } } else { $this->UpdateWindow(); } }
<?php require './class/conn.class.php'; require_once './config.php'; include './include/function.php'; require_once '../classes/class_cache.php'; $Cache = new CACHE(); $con = new conn(); if (isset($_GET['openid']) && $_GET['openid'] != '') { $user_openid = $con->mres($_GET['openid']); } else { exit; } if (isset($_GET['torrent'])) { $torrent = $con->mres($_GET['torrent']) * 1; } else { exit; } if (bind_check()) { $sql = "SELECT * FROM `bookmarks` WHERE `torrentid` = {$torrent} AND `userid` = {$user_ptid}"; $res = $con->query($sql); if (empty($res)) { $sql = "INSERT INTO bookmarks (torrentid, userid) VALUES ( {$torrent} , {$user_ptid} )"; if ($con->query($sql)) { echo json_encode(array('status' => 'success')); $Cache->delete_value('user_' . $user_ptid . '_bookmark_array'); } else { echo json_encode(array('status' => 'fail', 'errmsg' => '远程下载失败')); } } else { echo json_encode(array('status' => 'fail', 'errmsg' => '已经下载过了!'));
<?php error_reporting(E_ALL ^ E_NOTICE); require "/home/ptpimg/config.dat"; require "misc.class.php"; require "sql.class.php"; require "cache.php"; $DB = new DB_MYSQL(); $Cache = new CACHE(); session_start(); function getdata($f, $nomd5 = false) { if (!$nomd5) { $Md5 = md5_file($f); } else { $Md5 = ""; } $Type = @exif_imagetype($f); switch ($Type) { case 1: $ext = "gif"; break; case 2: $ext = "jpg"; break; case 3: $ext = "png"; break; } $size = filesize($f); list($w, $h, $t, $a) = getimagesize($f);
function GetCachePostfix() { $cache = new CACHE($this); return $cache->GetCachePostfix(); }
function is_plugin_enabled($pluginid) { static $enabled_plugin; if (!isset($enabled_plugin)) { $enabled_plugin = array(); $arr = CACHE::get('plugins'); foreach ($arr as $plugin) { $enabled_plugin[] = $plugin['id']; } } return in_array($pluginid, $enabled_plugin); }
if (!preg_match('/BAIDUID=(.+?)/', $cookie)) { showmessage('Cookie 信息不完整,请尝试重新获取', './#baidu_bind', 1); } if (!verify_cookie($cookie)) { showmessage('无法登陆百度贴吧,请检查 Cookie 是否填写正确', './#baidu_bind', 1); } $cookie = daddslashes($cookie); save_cookie($uid, $cookie); showmessage('您的 Cookie 信息已经更新<script type="text/javascript" src="?action=refresh_liked_tieba&formhash=' . $formhash . '"></script>', './#baidu_bind', 1); break; case 'update_setting': if ($_POST['formhash'] != $formhash) { break; } DB::update('member_setting', array('error_mail' => $_POST['error_mail'] ? 1 : 0, 'send_mail' => $_POST['send_mail'] ? 1 : 0, 'zhidao_sign' => $_POST['zhidao_sign'] ? 1 : 0, 'wenku_sign' => $_POST['wenku_sign'] ? 1 : 0), "uid='{$uid}'"); CACHE::save('user_setting_' . $uid, ''); showmessage('设置已经保存', './#setting', 1); break; case 'change_password': if ($_POST['formhash'] != $formhash) { break; } $user = DB::fetch_first("SELECT * FROM member WHERE uid='{$uid}'"); if (!$_POST['old_password']) { showmessage('请输入旧密码', './#setting', 1); } if (!$_POST['new_password']) { showmessage('请输入新密码', './#setting', 1); } if ($_POST['new_password'] != $_POST['new_password2']) { showmessage('两次输入的新密码不一样,请检查', './#setting', 1);
<?php if (!defined('IN_TRACKER')) { die('Hacking attempt!'); } error_reporting(E_ERROR | E_PARSE); ini_set('display_errors', 1); include_once $rootpath . 'classes/class_cache.php'; //Require the caching class $Cache = new CACHE(); //Load the caching class $Cache->setLanguageFolderArray(get_langfolder_list()); define('TIMENOW', time()); $USERUPDATESET = array(); $query_name = array(); define("UC_PEASANT", 0); define("UC_USER", 1); define("UC_POWER_USER", 2); define("UC_ELITE_USER", 3); define("UC_CRAZY_USER", 4); define("UC_INSANE_USER", 5); define("UC_VETERAN_USER", 6); define("UC_EXTREME_USER", 7); define("UC_ULTIMATE_USER", 8); define("UC_NEXUS_MASTER", 9); define("UC_VIP", 10); define("UC_RETIREE", 11); define("UC_DOWNLOADER", 12); define("UC_UPLOADER", 13); //define ("UC_FORUM_MODERATOR", 12); define("UC_MODERATOR", 14);
function handleAction() { global $uid, $formhash; $status = -1; $msg = '未登录!'; $data = array('time' => time()); if ($_SERVER['HTTP_USER_AGENT'] != 'Android Client For Tieba Signer') { exit(json_encode(array('status' => -2, 'msg' => '非法操作', 'data' => $data))); } else { if ($_GET['a'] == 'api_info') { $status = 0; $data = array('version' => '1.0.0', 'site' => $_SERVER["HTTP_HOST"]); } elseif ($_GET['a'] == 'do_login') { if (!empty($_POST['username']) && !empty($_POST['password'])) { $username = daddslashes($_POST['username']); $un = strtolower($username); if (strlen($username) > 24) { $msg = '用户名过长,请修改'; $status = 3; } else { $user = DB::fetch_first("SELECT * FROM member WHERE username='******'"); $verified = Widget_Password::verify($user, $_POST['password']); if ($verified) { $login_exp = TIMESTAMP + 3600; do_login($user['uid']); $status = 0; $msg = "欢迎回来,{$user['username']}!"; $data = array('uid' => $user['uid'], 'username' => $user['username'], 'email' => $user['email'], 'formhash' => substr(md5(substr(TIMESTAMP, 0, -7) . $user['username'] . $user['uid'] . ENCRYPT_KEY . ROOT), 8, 8)); } else { $status = 2; $msg = "对不起,您的用户名或密码错误,无法登录"; } } } else { $status = 1; $msg = '用户名或密码不得为空!'; } } elseif ($_GET['a'] == 'check_login') { if ($uid) { $status = 0; } if ($uid) { $msg = '您已登录'; } } elseif ($formhash != $_GET['formhash']) { $status = -2; $msg = '非法操作'; } elseif ($uid) { $status = 0; $msg = ""; require_once ROOT . './plugins/zw_client_api/BaiduUtil.php'; $binded_baidu = true; $cookie = get_cookie($uid); if (empty($cookie)) { $binded_baidu = false; } else { try { $baiduUtil = new BaiduUtil(get_cookie($uid)); } catch (Exception $e) { if ($e->getCode() == -99) { $binded_baidu = false; } } } switch ($_GET['a']) { case 'baidu_info': if ($binded_baidu) { $msg = '百度账号信息'; try { $baidu_account_info = $baiduUtil->fetchClientUserInfo(); $baidu_account_tieba_list = $baiduUtil->fetchClientLikedForumList(); $baidu_account_follow_list = $baiduUtil->fetchFollowList(4); $baidu_account_fans_list = $baiduUtil->fetchFansList(4); $data = array('id' => $baidu_account_info['data']['id'], 'username' => $baidu_account_info['data']['un'], 'avatar' => $baidu_account_info['data']['head_photo_h'], 'sex' => $baidu_account_info['data']['sex'], 'tb_age' => $baidu_account_info['data']['tb_age'], 'fans_num' => $baidu_account_info['data']['fans_num'], 'follow_num' => $baidu_account_info['data']['concern_num'], 'tb_num' => $baidu_account_info['data']['like_forum_num'], 'intro' => $baidu_account_info['data']['intro'] ? $baidu_account_info['data']['intro'] : '这个家伙很懒,什么也没有留下', 'tiebas' => $baidu_account_tieba_list['data'] ? $baidu_account_tieba_list['data'] : array(), 'follow' => $baidu_account_follow_list['data'], 'fans' => $baidu_account_fans_list['data']); } catch (Exception $e) { $status = "3"; $msg = '助手站点错误:' . $e->getMessage(); } } else { $status = 1; $msg = "未绑定百度账号"; } break; case 'unbind_baidu': DB::query("UPDATE member_setting SET cookie='' WHERE uid='{$uid}'"); DB::query("DELETE FROM my_tieba WHERE uid='{$uid}'"); DB::query("DELETE FROM sign_log WHERE uid='{$uid}'"); $msg = "已经解除百度账号绑定,您可以稍后重新进行绑定"; break; case 'sign_log': $msg = '获取成功'; $date = intval($_GET['date']); $data['date'] = $date; $data['log'] = array(); $query = DB::query("SELECT * FROM sign_log l LEFT JOIN my_tieba t ON t.tid=l.tid WHERE l.uid='{$uid}' AND l.date='{$date}'"); while ($result = DB::fetch($query)) { $data['log'][] = $result; } $data['count'] = count($data['log']); $previous_date = DB::result_first("SELECT date FROM sign_log WHERE uid='{$uid}' AND date<'{$date}' ORDER BY date DESC LIMIT 0,1"); $next_date = DB::result_first("SELECT date FROM sign_log WHERE uid='{$uid}' AND date>'{$date}' ORDER BY date ASC LIMIT 0,1"); $data['previous_date'] = $previous_date ? $previous_date : '0'; $data['next_date'] = $next_date ? $next_date : '0'; break; case 'cloud_info': $msg = '获取成功'; $data['sid'] = cloud::id(); break; case 'plugin_info': $msg = '获取成功'; $plugin_info = CACHE::get('plugins'); $data['plugins'] = array(); $plugin_supported = array('zw_custom_page' => array('name' => '自定义页面', 'author' => 'JerryLocke'), 'zw_blockid' => array('name' => '循环封禁', 'author' => 'JerryLocke'), 'x_tdou' => array('name' => 'T豆', 'author' => '星弦雪'), 'xxx_post' => array('name' => '客户端回帖', 'author' => '星弦雪'), 'xxx_meizi' => array('name' => '妹纸认证', 'author' => '星弦雪')); foreach ($plugin_info as $plugin) { if (isset($plugin_supported[$plugin['id']])) { $data['plugins'][] = $plugin + $plugin_supported[$plugin['id']]; } } $data['count'] = count($data['plugins']); break; } } echo json_encode(array('status' => $status, 'msg' => $msg, 'data' => $data)); } }
<?php require 'config.php'; //The config contains all site wide configuration information as well as memcached rules require SERVER_ROOT . '/classes/debug.class.php'; require SERVER_ROOT . '/classes/cache.class.php'; //Require the caching class require SERVER_ROOT . '/classes/encrypt.class.php'; //Require the caching class $Debug = new DEBUG(); $Cache = new CACHE($MemcachedServers); //Load the caching class $Enc = new CRYPT(); //Load the encryption class $SSL = $_SERVER['SERVER_PORT'] === '443'; if (isset($_COOKIE['session'])) { $LoginCookie = $Enc->decrypt($_COOKIE['session']); } if (isset($LoginCookie)) { list($SessionID, $UserID) = explode("|~|", $Enc->decrypt($LoginCookie)); if (!$UserID || !$SessionID) { die('Not logged in!'); } if (!($Enabled = $Cache->get_value("enabled_{$UserID}"))) { require SERVER_ROOT . '/classes/mysql.class.php'; //Require the database wrapper $DB = new DB_MYSQL(); //Load the database wrapper $DB->query("\n\t\t\tSELECT Enabled\n\t\t\tFROM users_main\n\t\t\tWHERE ID = '{$UserID}'"); list($Enabled) = $DB->next_record(); $Cache->cache_value("enabled_{$UserID}", $Enabled, 0);
<? /*-- Ajax Start Class ----------------------------------*/ /*------------------------------------------------------*/ /* Simplified version of script_start, used for ajax. */ /*------------------------------------------------------*/ /********************************************************/ require 'config.php'; //The config contains all site wide configuration information as well as memcached rules require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the caching class $Cache = NEW CACHE; //Load the caching class $Enc = NEW CRYPT; //Load the encryption class date_default_timezone_set('UTC'); if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); } if(isset($LoginCookie)) { list($SessionID, $UserID)=explode("|~|",$Enc->decrypt($LoginCookie)); if(!$UserID || !$SessionID) { die('Not logged in!'); } if(!$Enabled = $Cache->get_value('enabled_'.$UserID)){ require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper $DB=NEW DB_MYSQL; //Load the database wrapper $DB->query("SELECT Enabled FROM users_main WHERE ID='$UserID'"); list($Enabled) = $DB->next_record(); $Cache->cache_value('enabled_'.$UserID, $Enabled, 0); } } else { die('Not logged in!');
showmessage('成功更新到 1.13.11.9!', './'); } elseif ($current_version == '1.13.11.9') { runquery("\nALTER TABLE `plugin` ADD `enable` TINYINT(1) NOT NULL DEFAULT '1' AFTER `id`;\nALTER TABLE `plugin` ADD `version` VARCHAR(8) NOT NULL DEFAULT '0';\nALTER TABLE `member_setting` ADD `cookie` TEXT BINARY CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;\n"); $query = DB::query('SELECT uid, cookie FROM member'); while ($result = DB::fetch($query)) { save_cookie($result['uid'], $result['cookie']); } DB::query('ALTER TABLE `member` DROP `cookie`'); $query = DB::query('SHOW columns FROM `plugin`'); while ($result = DB::fetch($query)) { if ($result['Field'] == 'module') { DB::query('ALTER TABLE `plugin` DROP `module`'); } } CACHE::clear(); CACHE::update('plugins'); saveSetting('register_limit', 1); saveSetting('register_check', 1); saveSetting('jquery_mode', 2); saveSetting('version', '1.13.12.15'); showmessage('成功更新到 1.13.12.15!', './'); } elseif ($current_version == '1.13.12.15') { saveSetting('version', '1.13.12.25'); showmessage('成功更新到 1.13.12.25!', './'); } elseif ($current_version == '1.13.12.25') { if ($_config['adminid']) { saveSetting('admin_uid', $_config['adminid']); } saveSetting('version', '1.14.1.15'); showmessage('成功更新到 1.14.1.15!', './'); }
<?php require "/home/ptpimg/config.dat"; require "misc.class.php"; require "sql.class.php"; require "cache.php"; $DB = new DB_MYSQL(); $Cache = new CACHE(); session_start(); require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_line.php'; require_once 'jpgraph/jpgraph_mgraph.php'; //------------------------------------------------------------------ // Create some random data for the plot. We use the current time for the // first X-position //------------------------------------------------------------------ $datay = array(); $datax = array(); $datay2 = array(); $ts = time(); if (isset($_GET['i']) && is_numeric($_GET['i'])) { $Interval = $_GET['i']; } else { $Interval = 1; } // This is for the totals // Data sets are too big for 12-48 hours $Extra = ''; if ($Interval > 12) { $Extra = "AND DATE_FORMAT(Time, '%i') IN (0,15,30,45)"; }
function CreateCache(LOGGROUP $grp = NULL, $flags = 0) { $grp = $this->CheckGroup($grp, $flags); $greq = $this->GetCachePostfix($grp); /* Older version $cache = new CACHE(new GROUPRequest($greq), $rdr = NULL, $flags); */ $props = $this->req->props; $props['db_group'] = $grp->gid; $props['base_mask'] = $greq['db_mask']; $req = new GROUPRequest($props); unset($greq['db_mask']); $cache = new CACHE($req, $this, $flags); $cache->SetDefaultPostfix($greq); return $cache; }
<?php error_reporting(E_ALL ^ E_NOTICE); require "/home/ptpimg/config.dat"; require "misc.class.php"; require "sql.class.php"; require "cache.php"; $DB = new DB_MYSQL(); $Cache = new CACHE(); session_start(); require "helpers.php"; if (isset($_GET['type']) && $_GET['type'] == "uploadv7") { // upload via Java application require "javaupload.php"; } if (isset($_GET['type']) && $_GET['type'] == "uploadv3") { require "ajaxupload.php"; } if (isset($_GET['type']) && $_GET['type'] == "uploadv2") { require "urlupload.php"; } if (isset($_GET['type']) && $_GET['type'] == "short") { require "serveimg.php"; } if (isset($_GET['type']) && $_GET['type'] == "prop_display") { if (!isset($_GET['code'])) { die("404/Missing code"); } if (!isset($_GET['ext'])) { die("404/Missing ext"); }