直播中
index0.php文件:
<html><head><title>MySQL 維護(hù)</title></head><body>
<!--
<?php
//編碼,防止在地址欄上顯示
function b2h($string) {
return(bin2hex(strrev($string)));
}
//反編碼,防止在地址欄上顯示
function h2b($string) {
$stringtmp="";
for($i=0;$i<strlen($string);$i+=2) {
$stringtmp .= pack("C",hexdec(substr($string,$i,2)));
}
return(strrev($stringtmp));
}
global $PHP_SELF;
if (1==0) {
echo "-->PHP運(yùn)行不正常,請檢查<!--";
} else {
echo "--".">";
}
?>
<?php
if ($step=="") {
?>
<p>歡迎使用</p>本工具用于維護(hù)MySQL數(shù)據(jù)庫</p>
<p><a href="<? echo basename($PHP_SELF); ?>?step=2">下一步 -></a></p>
<?php
}
if ($step==2) {
$userfiletmp="/tmp/~userfile/~tmp.inc";
if (file_exists($userfiletmp)) {
include $userfiletmp;
//$dbservertype,$servername,$dbusername,$dbpassword,$dbname;
$dbservertype=h2b($dbservertype);
$servername=h2b($servername);
$dbusername=h2b($dbusername);
$dbname=h2b($dbname);
$curtime=h2b($curtime);
if (time()-$curtime<120){
$dbpassword=h2b($dbpassword);
}else{
$dbpassword="";
}
}else{
$dbservertype="mysql";
$servername="localhost";
$dbusername="";
$dbpassword="";
$dbname="";
}
$dbservertype=($dbservertype==""?"mysql":$dbservertype);
$servername=($servername==""?"localhost":$servername);
?>
<p>填入連接信息</p></p>
<div align="center">
<center>
<table border="1" width="53%" height="111">
<tr>
<td width="100%" height="105">
<form method="POST" action="<? echo basename($PHP_SELF); ?>?step=3">
<div align="center">
<center>
<table border="1" width="83%" height="60">
<tr>
<td width="34%" height="10">主機(jī)類型:</td>
<td width="66%" height="10"><input type="text" name="dbservertype" size="20" value="<? echo $dbservertype; ?>"></td>
</tr>
<tr>
<td width="34%" height="10">主機(jī)地址:</td>
<td width="66%" height="10"><input type="text" name="servername" size="20" value="<? echo $servername; ?>"></td>
</tr>
<tr>
<td width="34%" height="10">用戶名稱:</td>
<td width="66%" height="10"><input type="text" name="dbusername" size="20" value="<? echo $dbusername; ?>"></td>
</tr>
<tr>
<td width="34%" height="16">密碼:</td>
<td width="66%" height="16"><input type="password" name="dbpassword" size="20" value="<? echo $dbpassword; ?>"></td>
</tr>
<tr>
<td width="34%" height="16">數(shù)據(jù)庫名:</td>
<td width="66%" height="16"><input type="text" name="dbname" size="20" value="<? echo $dbname; ?>"></td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="submit" value="下一步" name="next"><input type="reset" value="清 除" name="reset"></p>
</form>
</td>
</tr>
</table>
</center>
</div>
<?php
}
if ($step==3) {
$dbservertype=trim($dbservertype);
$servername=trim($servername);
$dbusername=trim($dbusername);
$dbpassword=trim($dbpassword);
$dbname=trim($dbname);
echo "<p>確認(rèn)是否正確:</p>n";
echo "<p><b>Database server type:</b> $dbservertype</p>n";
echo "<p><b>Database server hostname / IP address:</b> $servername</p>n";
echo "<p><b>Database username:</b> $dbusername</p>n";
echo "<p><b>Database password:</b> ******</p>n";
echo "<p><b>Database name:</b> $dbname</p>n";
echo "<p>以上參數(shù)正確才能繼續(xù)</p>";
$dbservertype=b2h($dbservertype);
$servername=b2h($servername);
$dbusername=b2h($dbusername);
$dbpassword=b2h($dbpassword);
$dbname=b2h($dbname);
$userfiletmp="/tmp/~userfile/~tmp.inc";
if (!file_exists(dirname($userfiletmp))) {
mkdir(dirname($userfiletmp), 0700);
}
$handertmp=fopen($userfiletmp,"w");
fputs($handertmp,"<?phpn");
fputs($handertmp,"$"."dbservertype="$dbservertype";n");
fputs($handertmp,"$"."servername="$servername";n");
fputs($handertmp,"$"."dbusername="$dbusername";n");
fputs($handertmp,"$"."dbpassword="$dbpassword";n");
fputs($handertmp,"$"."dbname="$dbname";n");
$curtime=time();
$curtime=b2h($curtime);
fputs($handertmp,"$"."curtime="$curtime";n");
fputs($handertmp,"?>n");
fclose($handertmp);
//echo "<p><a href="".basename($PHP_SELF)."?step=4&servername=$servername&dbusername=$dbusername&dbpassword=$dbpassword&dbname=$dbname">下一步 -></a></p>";
echo "<p><a href="index.php">下一步 -></a></p>";
}
if ($step==4) {
}
if ($step==44) {
$step=0;
$userfiletmp="/tmp/~userfile/~tmp.inc";
if (file_exists($userfiletmp)) {
include $userfiletmp;
//重新保存文件,去掉密碼
$dbpassword="";
$handertmp=fopen($userfiletmp,"w");
fputs($handertmp,"<?phpn");
fputs($handertmp,"$"."dbservertype="$dbservertype";n");
fputs($handertmp,"$"."servername="$servername";n");
fputs($handertmp,"$"."dbusername="$dbusername";n");
fputs($handertmp,"$"."dbpassword="$dbpassword";n");
fputs($handertmp,"$"."dbname="$dbname";n");
$curtime=time();
$curtime=b2h($curtime);
fputs($handertmp,"$"."curtime="$curtime";n");
fputs($handertmp,"?>n");
fclose($handertmp);
echo "</p></p><center><a href="".basename($PHP_SELF)."">成功注銷,請重新登陸</a></center>";
}
}
?>
<?php
if ($step>1) {
echo "</p><a href=javascript:location.reload()>刷新</a>";
echo " <a href=javascript:history.back()>上一步</a>";
}
?>
<?php
echo "</"."body>";
echo "<"."!--";
?>
-->
</html>
config.inc.php 文件
<?php
/* $Id: config.inc.php,v 1.28 2000/07/13 13:52:48 tobias Exp $ */
//編碼,防止在地址欄上顯示
function b2h($string) {
return(bin2hex(strrev($string)));
}
//反編碼,防止在地址欄上顯示
function h2b($string) {
$stringtmp="";
for($i=0;$i<strlen($string);$i+=2) {
$stringtmp .= pack("C",hexdec(substr($string,$i,2)));
}
return(strrev($stringtmp));
}
/*
* phpMyAdmin Configuration File
* All directives are explained in Documentation.html
*/
// The $cfgServers array starts with $cfgServers[1]. Do not use $cfgServers[0].
// You can disable a server config entry by setting host to ''.
$cfgServers[1]['host'] = 'localhost'; // MySQL hostname
$cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port
$cfgServers[1]['adv_auth'] = false; // Use advanced authentication?
$cfgServers[1]['stduser'] = 'root'; // MySQL standard user (only needed with advanced auth)
$cfgServers[1]['stdpass'] = ''; // MySQL standard password (only needed with advanced auth)
$cfgServers[1]['user'] = 'root'; // MySQL user (only needed with basic auth)
$cfgServers[1]['password'] = ''; // MySQL password (only needed with basic auth)
$cfgServers[1]['only_db'] = ''; // If set to a db-name, only this db is accessible
$cfgServers[1]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname
$userfiletmp="/tmp/~userfile/~tmp.inc";
if (file_exists($userfiletmp)) {
include $userfiletmp;
//$servername,$dbusername,$dbpassword,$dbname;
$dbservertype=h2b($dbservertype);
if ($dbservertype=="mysql"){
$servername=h2b($servername);
$dbusername=h2b($dbusername);
$dbpassword=h2b($dbpassword);
$dbname=h2b($dbname);
$curtime=h2b($curtime);
if (time()-$curtime<600){
$cfgServers[1]['host'] = $servername; // MySQL hostname
$cfgServers[1]['user'] = $dbusername; // MySQL user (only needed with basic auth)
$cfgServers[1]['password'] = $dbpassword; // MySQL password (only needed with basic auth)
$cfgServers[1]['only_db'] = $dbname; // If set to a db-name, only this db is accessible
//重新保存文件,以便更新時間
$dbservertype=b2h($dbservertype);
$servername=b2h($servername);
$dbusername=b2h($dbusername);
$dbpassword=b2h($dbpassword);
$dbname=b2h($dbname);
$handertmp=fopen($userfiletmp,"w");
fputs($handertmp,"<?phpn");
fputs($handertmp,"$"."dbservertype="$dbservertype";n");
fputs($handertmp,"$"."servername="$servername";n");
fputs($handertmp,"$"."dbusername="$dbusername";n");
fputs($handertmp,"$"."dbpassword="$dbpassword";n");
fputs($handertmp,"$"."dbname="$dbname";n");
$curtime=time();
$curtime=b2h($curtime);
fputs($handertmp,"$"."curtime="$curtime";n");
fputs($handertmp,"?>n");
fclose($handertmp);
}else{
echo "</p>賬號參數(shù)已經(jīng)過期,請重新輸入!</p>";
echo "<a href="index0.php" target="_top">登陸</a>";
die("</p><b>程序終止</b>");
}
}
}
$cfgServers[2]['host'] = '';
$cfgServers[2]['port'] = '';
$cfgServers[2]['adv_auth'] = false;
$cfgServers[2]['stduser'] = '';
$cfgServers[2]['stdpass'] = '';
$cfgServers[2]['user'] = '';
$cfgServers[2]['password'] = '';
$cfgServers[2]['only_db'] = '';
$cfgServers[2]['verbose'] = '';
$cfgServers[3]['host'] = '';
$cfgServers[3]['port'] = '';
$cfgServers[3]['adv_auth'] = false;
$cfgServers[3]['stduser'] = '';
$cfgServers[3]['stdpass'] = '';
$cfgServers[3]['user'] = 'root';
$cfgServers[3]['password'] = '';
$cfgServers[3]['only_db'] = '';
$cfgServers[3]['verbose'] = '';
// If you have more than one server configured, you can set $cfgServerDefault
// to any one of them to autoconnect to that server when phpMyAdmin is started,
// or set it to 0 to be given a list of servers without logging in
// If you have only one server configured, $cfgServerDefault *MUST* be
// set to that server.
$cfgServerDefault = 1; // Default server (0 = no default server)
$cfgServer = '';
unset($cfgServers[0]);
$cfgManualBase = "http://www.mysql.com/documentation/mysql/bychapter/";
$cfgConfirm = true;
$cfgPersistentConnections = false;
$cfgBorder = "0";
$cfgThBgcolor = "#D3DCE3";
$cfgBgcolorOne = "#CCCCCC";
$cfgBgcolorTwo = "#DDDDDD";
$cfgMaxRows = 30;
$cfgMaxInputsize = "300px";
$cfgOrder = "ASC";
$cfgShowBlob = true;
$cfgShowSQL = true;
require("chinese_gb.inc.php");
$strWelcome="<a href="index0.php?step=44" target="_top">注銷賬戶</a> <a href="index0.php" target="_top">重新登陸</a></p>$strWelcome";
$cfgColumnTypes = array(
"TINYINT",
"SMALLINT",
"MEDIUMINT",
"INT",
"BIGINT",
"FLOAT",
"DOUBLE",
"DECIMAL",
"DATE",
"DATETIME",
"TIMESTAMP",
"TIME",
"YEAR",
"CHAR",
"VARCHAR",
"TINYBLOB",
"TINYTEXT",
"TEXT",
"BLOB",
"MEDIUMBLOB",
"MEDIUMTEXT",
"LONGBLOB",
"LONGTEXT",
"ENUM",
"SET");
$cfgFunctions = array(
"ASCII",
"CHAR",
"SOUNDEX",
"CURDATE",
"CURTIME",
"FROM_DAYS",
"FROM_UNIXTIME",
"NOW",
"PASSWORD",
"PERIOD_ADD",
"PERIOD_DIFF",
"TO_DAYS",
"USER",
"WEEKDAY",
"RAND");
$cfgAttributeTypes = array(
"",
"BINARY",
"UNSIGNED",
"UNSIGNED ZEROFILL");
// Setting magic_quotes_runtime - do not change!
set_magic_quotes_runtime(0);
?>
如有引用,請注明高山雪和alpsnow@china.com