".$databases["db_selected_index"]."";
//$config["disabled"]=ini_get("disable_functions");
//vars
$td='
';
$action=(isset($_GET["action"])) ? $_GET["action"] : "status";
$checkit=(isset($_GET["checkit"])) ? urldecode($_GET["checkit"]) : "";
$repair=(isset($_GET["repair"])) ? $_GET["repair"] : 0;
$is_htaccess=(file_exists(".htaccess"));
if($is_htaccess) $htaccess_exist=file(".htaccess");
$dba=$hta_dir=$Overwrite=$msg="";
//MySQL-Verbindung herstellen
MSD_mysql_connect();
if(isset($_GET["help"]) && $_GET["help"]==1) {
echo 'Verzeichnis-Hilfe';
if($_GET["dir"]=="config") $helpdir=$config["paths"]["config"];
if($_GET["dir"]=="backup") $helpdir=$config["paths"]["backup"];
if($_GET["dir"]=="structure") $helpdir=$config["paths"]["structure"];
if($_GET["dir"]=="log") $helpdir=$config["paths"]["log"];
echo 'Hilfe zu '.$_GET["dir"].'-Verzeichnis ('.$helpdir.')
';
@chmod($helpdir, 0777);
if(!is_writable($helpdir)) {
echo "Verzeichnis $helpdir ist nicht schreibbar. chmod scheitert. ";
} else {
echo "Verzeichnis $helpdir ist schreibbar. ";
}
exit;
}
if(isset($_POST["htaccess"]) || $action=="schutz") {
if($is_htaccess) $Overwrite=''.$lang["htaccess8"].' ';
$cry_txt=array($lang["htaccess5"],$lang["htaccess6"],$lang["htaccess7"]);
$step=(isset($_POST["step"]))?$_POST["step"]:0;
$cryptart=(isset($_POST["cryptart"])) ? $_POST["cryptart"] :0;
$uname=(isset($_POST["username"])) ? $_POST["username"] : "";
$upass1=(isset($_POST["userpass1"])) ? $_POST["userpass1"] : "";
$upass2=(isset($_POST["userpass2"])) ? $_POST["userpass2"] : "";
if($step==1) {
$msg="";
if($uname=="") $msg=$lang["htaccess9"];
if(($upass1!=$upass2) || ($upass1=="")) $msg.=$lang["htaccess10"];
if($msg!="") {
$msg=''.$msg.' ';
$step=0;
} else {
$msg=''.$lang["htaccess11"].' ';
}
} elseif($step==2) {
$htaccess = "AuthName \"MySQLDump\"\nAuthType Basic\nAuthUserFile ". $config["paths"]["root"]."/.htpasswd\n\nrequire valid-user\n";
if($cryptart==0) $userpass=crypt($upass1);
elseif($cryptart==1) $userpass=md5($upass1);
else $userpass=$upass1;
$htpasswd = $uname.":".$userpass;
if($file_htpasswd=@fopen(".htpasswd","w")) {
fputs($file_htpasswd,$htpasswd);
fclose($file_htpasswd);
$file_htaccess=@fopen(".htaccess","w");
fputs($file_htaccess,$htaccess);
fclose($file_htaccess);
$msg= $lang["htaccess12"].'
'.$lang["htaccess13"].' .htaccess:'."\n".htmlspecialchars($htaccess).'
'.$lang["htaccess13"].' .htpasswd:'."\n". htmlspecialchars($htpasswd)." ";
} else {$msg=''.$lang["htaccess14"].'
'.$lang["htaccess13"].' .htaccess:'."\n".htmlspecialchars($htaccess).'
'.$lang["htaccess13"].' .htpasswd:'."\n". htmlspecialchars($htpasswd).' ';}
}
//Ausgabe
echo ''.$lang["htaccess1"].''.$Overwrite;
if($step<2){
if($step==0) {
$un='';
$p1='';
$p2='';
$cry=''.$cry_txt[0].' '.$cry_txt[1];
} else {
$un=$uname.'';
$p1='***************';
$p2='***************';
$cry=''.$cry_txt[$cryptart];
}
echo $msg.'';
} else echo $msg;
echo "
";
include("inc/footer.php");
die();
}
if(isset($_POST["error_submit"])) {
$debug_adress="debug@daniel-schlichtholz.de";
//$debug_adress="admin@localhost";
if(!isset($_POST["error_absender"]) || $_POST["error_absender"]=="") {
echo ''.$lang["mailabsendererror"].' ';
echo 'back ...';
die;
}
if($_POST["error_name"]=="")$_POST["error_name"]=$_POST["error_absender"];
$header="From: ".$_POST["error_name"]." <".$_POST["error_absender"].">\n";
$header .= "Reply-To: ".$_POST["error_absender"]."\n";
$header .= "X-Mailer: PHP/" . phpversion(). "\n";
$header .= "X-Sender-IP: $REMOTE_ADDR\n";
$header .= "Content-Type: text/html";
$subject=stripslashes($_POST["error_subject"]);
$body="======================================= Art: ".$_POST["error_kind"]."
";
$body.=$lang['Ausgabe'].": ".stripslashes(nl2br($_POST["error_aus"]))."
";
$body.=$lang['Zusatz'].": ".nl2br($_POST["error_zusatz"])."
";
$body.=$lang['Variabeln'].": ".nl2br($_POST["error_vars"]);
$body.=" =======================================
";
if (@mail($debug_adress, $subject, $body, $header)) {
echo $lang['berichtsent']."
";
} else {
echo ''.$lang["mailerror"].' ';
$body=$lang['autobericht']." '".$_POST["error_name"]."'
".$body;
$b=str_replace(" ","\n",$body);
$b=str_replace("","\n",$b);
$b=rawurlencode(strip_tags($b));
echo $lang['berichtman1'].' Debug-Team';
}
}
if($action=="edithtaccess") {
$htaccessdontexist=0;
if((isset($_GET["create"]) && $_GET["create"]==1 ) || (isset($_POST["create"]) && $_POST["create"]==1)) {
$fp = fopen("$hta_dir.htaccess", "w");
fwrite ($fp,"# created by MySQLDumper ".$config["version"]."\n");
fclose ($fp);
}
if(isset($_POST["newload"])){
$hta_dir=(isset($_POST["newhtadir"])) ? $_POST["newhtadir"] : "";
} else $hta_dir=(isset($_POST["hta_dir"])) ? $_POST["hta_dir"] : "";
if($hta_dir !="" && substr($hta_dir,-1)!="/")$hta_dir.="/";
if(isset($_POST["submit"]) && isset($_POST["thta"])){
$fp = fopen("$hta_dir.htaccess", "w");
fwrite ($fp,$_POST["thta"]);
fclose ($fp);
}
if(file_exists("$hta_dir.htaccess")){
$htaccess_exist=file("$hta_dir.htaccess");
} else {
$htaccessdontexist=1;
}
echo ''.$lang["htaccess16"].'';
echo ''.$lang['htaccess32'].' ';
echo '';
} else {
echo ''.$hta_dir.'.htaccess existiert nicht. Soll sie erstellt werden ? ';
echo '';
}
echo ' zurück';
//echo "$_POST[thta] ";
exit;
}
if($action=="phpinfo") {
phpinfo();
echo 'Home ';
exit;
}
if($action=="extinfo") {
echo ErrorReport();
exit;
}
if($action=="db") {
for($i=0;$i'.$lang["db"]." ".$databases["Name"][$i]." ".$lang["info_cleared"]."";
break;
}
if(isset($_POST["kill".$i])) {
$res=mysql_query("DROP DATABASE `".$databases["Name"][$i]."`") or die(mysql_error()."");
$dba= ''.$lang["db"]." ".$databases["Name"][$i]." ".$lang["info_deleted"]." ";
SetDefault(true);
include ($config["files"]["parameter"]);
echo '';
break;
}
if(isset($_POST["optimize".$i])) {
mysql_select_db($databases["Name"][$i],$config["dbconnection"]);
$res = mysql_list_tables($databases["Name"][$i],$config["dbconnection"]);
$tabellen="";
WHILE ($row=mysql_fetch_row($res)) $tabellen.=$row[0].",";
$tabellen=substr($tabellen,0,(strlen($tabellen)-1));
if ($tabellen>"")
{
$query="OPTIMIZE TABLE ".$tabellen;
$res=mysql_query($query) or die(mysql_error()."");
}
$_GET["dbid"]=$i;
$dba= ''.$lang["db"].' '.$databases["Name"][$i].' '.$lang["info_optimized"].'. ';
break;
}
if(isset($_POST["check".$i])) {
$checkit="ALL";$_GET["dbid"]=$i;
}
}
}
if($action=="newdb") {
if(isset($_POST["submit"])) {
if ($_POST["dbneu"]==""){
$dba=''.$lang["dbnoempty"].' ';
} else {
$sql_command="CREATE DATABASE `".$_POST["dbneu"]."`";
$res=mysql_query($sql_command,$config["dbconnection"]);
$meldung=mysql_error($config["dbconnection"]);
if ($meldung!="")
$dba='MySQL-Error: '.$meldung.' ';
else {
SetDefault(true);
include ($config["files"]["parameter"]);
$dba=''.$lang["db"]." '".$_POST["dbneu"]."' ".$lang["info_created"]." ";
echo '';
}
}
}
$action="db";
}
//Hier beginnt die Ausgabe
echo "Home";
echo '';
echo $td.'';
echo $td.'';
echo $td.'';
echo $td.'';
echo '
';
if($action=="status") {
//Infos über Backups
$Sum_Files=$Sum_Size=0;
$Last_BU=Array();
$sm=($config["safe_mode"]==1) ? " (Safemode)" : "";
$dh = opendir($config["paths"]["backup"]);
while (false !== ($filename = readdir($dh)))
{
if ($filename != "." && $filename != ".." && !is_dir($config["paths"]["backup"].$filename)){
$files[] = $filename;
$Sum_Files++;
$Sum_Size+=filesize($config["paths"]["backup"].$filename);
$ft=filectime($config["paths"]["backup"].$filename);
if(!isset($Last_BU[2]) || (isset($Last_BU[2]) && $ft>$Last_BU[2])){
$Last_BU[0]=$filename;
$Last_BU[1]=date("d.m.Y h:i",$ft);
$Last_BU[2]=$ft;
}
}
}
require("inc/runtime.php");
$status=''.$lang['Statusinformationen'].'';
$status.= DirectoryWarnings();
//Versionen
$status.=''.$lang['Versionsinformationen'].'';
$status.='MySQL Dumper-Version: '.$config["version"].' ';
$status.='MySQL-Version: '.MSD_MYSQL_VERSION.' ';
$status.='PHP-Version: '.PHP_VERSION.' '.(($config["zlib"]) ? '': ' '.$lang["phpbug"].'. ').'[Info] '.$sm;
$status.=' PHP-Extensions: '.$config["phpextensions"].'';
if($config["disabled"]!="") $status.=' '.$lang['disabledfunctions'].': '.$config["disabled"].'';
if(!extension_loaded("ftp")) $status.= ' '.$lang['noftppossible'].'';
if(!$config["zlib"]) $status.= ' '.$lang['nogzpossible'].'';
//MySQLDumper Informationen
$status.=''.$lang['MySQL Dumper Informationen'].''.$lang["info_location"].' "'.$_SERVER["SERVER_NAME"].'" ('.($config["paths"]["root"]).') ';
$status.=$lang["info_actdb"].": ".$databases["db_actual"]." ";
$status.='['.$lang['Fehlerbericht'].']
';
if($config["no_htaccess"]==0) $status.=''.$lang["htaccess1"].' '.(($is_htaccess) ? '' : ''.$lang["htaccess15"].'');
if($is_htaccess) $status.='*** '.$lang["htaccess16"].' ***';
else $status.=' +++ '.$lang["htaccess17"].' +++';
//History
$status.='
History'.$lang['backupfilesanzahl'].' '.$Sum_Files.' Backups ('.byte_output($Sum_Size).') ';
$status.=$lang["fm_freespace"].': '.MD_FreeDiskSpace().' ';
if($Sum_Files>0) $status.=$lang['lastbackup'].' '.$lang["vom"].' '.((isset($Last_BU[1])) ? $Last_BU[1] : " - ").'
'.((isset($Last_BU[1])) ? '' : " - ").''.((isset($Last_BU[0])) ? $Last_BU[0] : " - ").' ';
$status.=' ';
echo $status;
} elseif($action=="db") {
//Datenbanken
echo ''.$lang["info_databases"].'';
echo $dba.' ';
if(!isset($config["dbconnection"])) MSD_mysql_connect();
for($i=0;$i'.$databases["Name"][$i].' | '.$lang["info_nodb"].' | ';
} else {
mysql_select_db($databases["Name"][$i],$config["dbconnection"]);
$tabellen = mysql_list_tables($databases["Name"][$i],$config["dbconnection"]);
$num_tables = mysql_num_rows($tabellen);
$cl=($i==$databases["db_selected_index"]) ? "#ccffff" : "white";
echo '';
echo ($i==$databases["db_selected_index"]) ? "".$databases["Name"][$i]."" : $databases["Name"][$i];
echo ' | '.$num_tables.' '.$lang["info_table1"];
echo ($num_tables>1) ? $lang["info_table2"] : '';
echo ' | ';
echo ' ';
}
}
echo ' ';
echo ' ';
echo ' ';
} elseif($action=="sys") {
$sysaction=(isset($_GET["dosys"])) ? $_GET["dosys"] : 0;
$msg="";
$res=@mysql_query("SHOW VARIABLES LIKE 'datadir'",$config["dbconnection"]);
if($res) {
$row = mysql_fetch_array($res);
$data_dir=$row[1];
}
switch($sysaction) {
case 1: //FLUSH PRIVILEGES
$msg="> operating FLUSH PRIVILEGES ";
$res=@mysql_query("FLUSH PRIVILEGES",$config["dbconnection"]);
$meldung=mysql_error($config["dbconnection"]);
if($meldung!="") {
$msg.='> MySQL-Error: '.$meldung;
} else {
$msg.="> Privileges were reloaded.";
}
break;
case 2: //FLUSH STATUS
$msg="> operating FLUSH STATUS ";
$res=@mysql_query("FLUSH STATUS",$config["dbconnection"]);
$meldung=mysql_error($config["dbconnection"]);
if($meldung!="") {
$msg.='> MySQL-Error: '.$meldung;
} else {
$msg.="> Status was reset.";
}
break;
case 3: //FLUSH HOSTS
$msg="> operating FLUSH HOSTS ";
$res=@mysql_query("FLUSH HOSTS",$config["dbconnection"]);
$meldung=mysql_error($config["dbconnection"]);
if($meldung!="") {
$msg.='> MySQL-Error: '.$meldung;
} else {
$msg.="> Hosts were reloaded.";;
}
break;
case 4: //SHOW MASTER LOGS
$msg="> operating SHOW MASTER LOGS ";
$res=@mysql_query("SHOW MASTER LOGS",$config["dbconnection"]);
$meldung=mysql_error($config["dbconnection"]);
if($meldung!="") {
$msg.='> MySQL-Error: '.$meldung;
} else {
$numrows=mysql_num_rows($res);
if($numrows==0) {
$msg.='> there are no master log-files';
}else{
$msg.='> there are '.$numrows.' logfiles ';
for($i=0;$i<$numrows;$i++) {
$row=mysql_fetch_row($res);
$msg.='> '.$row[0].' '.(($data_dir) ? byte_output(filesize($data_dir.$row[0])) : '').' ';
}
}
}
break;
case 5: //RESET MASTER
$msg="> operating RESET MASTER ";
$res=@mysql_query("RESET MASTER",$config["dbconnection"]);
$meldung=mysql_error($config["dbconnection"]);
if($meldung!="") {
$msg.='> MySQL-Error: '.$meldung;
} else {
$msg.="> All Masterlogs were deleted.";
}
break;
}
echo 'Mysql-Befehle';
echo '';
echo ' ';
echo '';
echo '> MysSQL Dumper v'.$config["version"].' - Output Console
';
echo ($msg!="") ? $msg : '> waiting for operation ... ';
echo ' ';
} elseif($action=="vars") {
$var=(isset($_GET["var"])) ? $_GET["var"] : "prozesse";
$Titelausgabe=array("variables"=>$lang['Variabeln'],"status"=>$lang['Status'],"prozesse"=>$lang['Prozesse']);
echo ''.$lang['mysqlvars'].'';
echo ''.$Titelausgabe[$var].' ';
echo ''.$lang['Prozesse'].' ';
echo ''.$lang['Status'].' ';
echo ''.$lang['Variabeln'].' ';
echo ' | ';
echo '';
//Variabeln
switch($var) {
case "variables":
$res=@mysql_query("SHOW variables");
if($res) $numrows=mysql_num_rows($res);
if($numrows==0) {echo $lang["info_novars"];} else {
echo 'Name | '.$lang['Inhalt'].' | ';
for ($i = 0; $i < $numrows; $i++) {
$row = mysql_fetch_array($res);
echo "$row[0] | $row[1] | ";
}
}
echo ' ';
break;
case "status":
$res=@mysql_query("SHOW STATUS");
if($res) $numrows=mysql_num_rows($res);
if($numrows==0) {echo $lang["info_nostatus"];} else {
echo 'Name | '.$lang['Inhalt'].' | ';
for ($i = 0; $i < $numrows; $i++) {
$row = mysql_fetch_array($res);
echo "$row[0] | $row[1] | ";
}
}
echo ' ';
break;
case "prozesse":
if($config["processlist_refresh"]<1000)$config["processlist_refresh"]=2000;
if(isset($_GET["killid"]) && $_GET["killid"]>0) {
$killid=(isset($_GET["killid"])) ? $_GET["killid"] : 0;
$wait=(isset($_GET["wait"])) ? $_GET["wait"] : 0;
if($wait==0) {
$ret=mysql_query("KILL ".$_GET["killid"]);
$wait=2;
} else $wait+=2;
if($wait==0) {
echo ''.$lang["processkill1"].$_GET["killid"].$lang["processkill2"].$ret.' ';
} else {
echo ''.$lang["processkill3"].$wait.$lang["processkill4"].$_GET["killid"].$lang["processkill2"].$ret.' ';
}
}
$killid=$wait=0;
$res=@mysql_query("SHOW FULL PROCESSLIST ");
if($res) $numrows=mysql_num_rows($res);
if($numrows==0) {echo $lang["info_noprocesses"];} else {
echo 'ID | User | Host | DB | Command | Time | State | Info | RT: '.round($config["processlist_refresh"]/1000).' sec | ';
for ($i = 0; $i < $numrows; $i++) {
$row = mysql_fetch_array($res);
echo "$row[0] | $row[1] | $row[2] | $row[3] | $row[4] | $row[5] | $row[6] | $row[7] | kill | ";
if($row[0]==$killid && $row[4]=="Killed") {
$wait=$killid=0;
}
}
}
echo ' ';
echo '';
echo '';
break;
}
echo ' | ';
}
//Datenbankdetails
if (isset($_GET["dbid"]))
{
$dbid=$_GET["dbid"];
echo '
'.$lang["info_dbdetail"].'"'.$databases["Name"][$dbid].'"';
//@mysql_query("USE ".$databases["Name"][$dbid]);
$res=@mysql_query("SHOW TABLE STATUS FROM `".$databases["Name"][$dbid]."`");
if($res) $numrows=mysql_num_rows($res);
if($numrows==0) {
echo $lang["info_dbempty"];
} else {
echo $numrows.' '.$lang["info_table1"];
echo ($numrows>1) ? $lang["info_table2"] : '';
echo '
Nr. | '.
$lang["info_table1"].' | '.
$lang["info_records"].' | '.
$lang["info_size"].' | '.
$lang["info_lastupdate"].' | '.
$lang["info_optimized"].' | Status | '.
' ';
$last_update="2000-01-01 00:00:00";
$s=$s1=$s2="";
for ($i = 0; $i < $numrows; $i++)
{
$row = mysql_fetch_array($res);
$akt_size=$row["Data_length"]+$row["Index_length"];
echo ''.($i+1).' | '.
$row["Name"].' | '.
number_format($row["Rows"],0,",",".").' | '.
number_format($akt_size,0,",",".").
' Bytes | '.
$row["Update_time"].' | ';
if ($row["Data_free"]==0) echo '';
else echo ' '.$lang["no"].' ';
echo ' | ';
if($checkit==$row["Name"] || $repair==1) {
$tmp_res=mysql_query("REPAIR TABLE `".$row["Name"]."`");
}
if(($checkit==$row["Name"] || $checkit=="ALL") && $akt_size>0) {
$tmp_res=mysql_query("CHECK TABLE `".$row["Name"]."`");
if($tmp_res) {
$tmp_row = mysql_fetch_row($tmp_res);
echo ($tmp_row[3]=="OK") ? '' : ' repair ';
} else echo "CHECK TABLE `".$row["Name"]."`";
} else {
if($akt_size>0) echo 'check';
else echo "-";
}
echo ' | ';
if(isset($row["Update_time"])) if(strtotime($row["Update_time"])>strtotime($last_update)) $last_update=$row["Update_time"];
$s1=$s1+$row["Rows"];
$s2=$s2+$row["Data_length"]+$row["Index_length"];
}
echo ''.$lang["info_sum"].' | '.number_format($s1,0,",",".").' | '.number_format($s2,0,",",".").' Bytes | '.$last_update.' | ';
echo ' | ';
}
$edb=$lang["info_emptydb1"].' `'.$databases["Name"][$dbid].'` '.$lang["info_emptydb2"];
$kdb=$lang["info_emptydb1"].' `'.$databases["Name"][$dbid].'` '.$lang["info_killdb"];
echo ' |