function check_cookie() { global $db, $cookiecfg, $tablepre, $onlineip, $onlineurl; $secret = $_COOKIE[$cookiecfg['prefix'] . secret]; $onlineurl = addslashes($onlineurl); //old online information if (isset($secret)) { list($cookies['uid'], $cookies['username'], $cookies['logintime']) = explode("\t", authcrypt($secret, 'decode')); //online member if (is_numeric($cookies['uid'])) { $sql = "INSERT INTO `{$tablepre}online` (uid,username,logintime,dateline,url) VALUES ('{$cookies['uid']}','{$cookies['username']}',UNIX_TIMESTAMP(),UNIX_TIMESTAMP(),'{$onlineurl}') ON DUPLICATE KEY UPDATE dateline=UNIX_TIMESTAMP(),url='{$onlineurl}'"; $db->query($sql); //online guest } else { $sql = "INSERT INTO `{$tablepre}online` (uid,username,logintime,dateline,url) VALUES ('{$cookies['uid']}','{$onlineip}',UNIX_TIMESTAMP(),UNIX_TIMESTAMP(),'') ON DUPLICATE KEY UPDATE dateline=UNIX_TIMESTAMP(),url='{$onlineurl}'"; $db->query($sql); } //new member information } else { $time = times(); $rnd = m_rand(5); m_setcookie('secret', authcrypt("{$rnd}\tguest\t{$time}", 'encode')); $sql = "INSERT INTO `{$tablepre}online` VALUES ('{$rnd}','{$onlineip}',UNIX_TIMESTAMP(),UNIX_TIMESTAMP(),'{$onlineurl}') ON DUPLICATE KEY UPDATE dateline=UNIX_TIMESTAMP(),url='{$onlineurl}'"; $db->query($sql); } }
/** * 间隔变换颜色 * Color(用,隔开的颜色代码若干); * {Color:#FFFFFF,#DCDCDC}; */ function color($color = '') { if (strstr($color, ',')) { $Co = explode(",", $color); $tmpname = m_rand(5); $C = count($Co); $res = "\$_{$tmpname} = " . var_export($Co, true) . ";\necho (\$_{$tmpname}" . "[" . "\$__{$tmpname}%{$C}]);\$__{$tmpname}++;"; return '<?php ' . $res . '?>'; } return ''; }
if (!$_GET['tabledata']) { reffer('参数错误'); } else { $table = explode("|", $tabledata); } } $step = intval($_GET['step']); $start = intval($_GET['start']); $timestamp = gmdate('Ymd', time()); $bak = "-- -------------------------------------------------------\n-- " . SYSTEM_NAME . "本次数据库备份的表及其内容为:" . implode(",", $table) . " \n-- Time: " . format_time(time()) . "\n-- MYSQL version:" . $db->version() . "\n-- PHP version:" . phpversion() . "\n-- -------------------------------------------------------\n\n\n"; $db->query("SET SQL_QUOTE_SHOW_CREATE = 0"); if (!$step) { $tabledata = implode('|', $table); $step = 1; $start = 0; $pre = $timestamp . '(' . m_rand(4) . ')_'; $bakuptable = ''; //确保数据库的编码是UTF8 $bakuptable .= "ALTER DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\n\n"; foreach ($table as $key => $value) { $bakuptable .= "--\n-- 表的结构 `{$value}`\n--\nDROP TABLE IF EXISTS `{$value}`;\n"; $CreatTable = $db->fetch_array($db->query("SHOW CREATE TABLE {$value}")); $CreatTable['Create Table'] = str_replace($CreatTable['Table'], $value, $CreatTable['Create Table']); $bakuptable .= $CreatTable['Create Table'] . ";\n\n"; } $sizelimit /= 2; } $f_num = ceil($step / 2); $filename = $pre . $f_num . '.sql'; $step++; $tableid = empty($_GET['tableid']) ? 0 : $_GET['tableid'] - 1;