1
0
Fork 0

Convert to mysqli

This commit converts all mysql_* function to the appropriate counterparts
in mysqli.
I used this tool for most of it:
https://github.com/philip/MySQLConverterTool
This makes it possible to continue using MysqlDumper with PHP 7.0
Dieser Commit ist enthalten in:
Hannes Rosenögger 2016-02-01 20:02:15 +01:00
Ursprung dd0e8aede7
Commit 5b995d339d
23 geänderte Dateien mit 210 neuen und 214 gelöschten Zeilen

Datei anzeigen

@ -355,7 +355,7 @@ if (isset($_POST['save']))
{ {
if (MSD_mysql_connect()) if (MSD_mysql_connect())
{ {
$res=@mysql_selectdb($to_add,$config['dbconnection']); $res=@((bool)mysqli_query($config['dbconnection'], "USE " . $to_add));
if (!$res === false) if (!$res === false)
{ {
$databases['Name'][] = $to_add; $databases['Name'][] = $to_add;

Datei anzeigen

@ -217,7 +217,7 @@ else
{ {
WriteToDumpFile(); // save data we have up to now WriteToDumpFile(); // save data we have up to now
// error reading table definition // error reading table definition
$read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$table,$adbname).': '.mysql_error($config['dbconnection']); $read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$table,$adbname).': '.((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
Errorlog("DUMP",$databases['db_actual'],'',$read_create_error,0); Errorlog("DUMP",$databases['db_actual'],'',$read_create_error,0);
WriteLog($read_create_error); WriteLog($read_create_error);
if ($config['stop_with_error']>0) if ($config['stop_with_error']>0)

Datei anzeigen

@ -162,8 +162,8 @@ function SetDefault($load_default = false)
//DB-Liste holen //DB-Liste holen
MSD_mysql_connect(); MSD_mysql_connect();
$res = mysql_query('SHOW DATABASES', $config['dbconnection']); $res = mysqli_query( $config['dbconnection'], 'SHOW DATABASES');
WHILE ($row = mysql_fetch_row($res)) { WHILE ($row = mysqli_fetch_row($res)) {
$found_dbs[] = $row[0]; $found_dbs[] = $row[0];
} }
$found_dbs = array_merge($oldDbArray, $found_dbs); $found_dbs = array_merge($oldDbArray, $found_dbs);
@ -173,7 +173,7 @@ function SetDefault($load_default = false)
$a = 0; $a = 0;
for ($i = 0; $i < count($found_dbs); $i++) { for ($i = 0; $i < count($found_dbs); $i++) {
$found_db = $found_dbs[$i]; $found_db = $found_dbs[$i];
$use = @mysql_select_db($found_db); $use = @((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $found_db));
if ($use) { if ($use) {
if (isset($old_db) && $found_db == $old_db) { if (isset($old_db) && $found_db == $old_db) {
$databases['db_selected_index'] = $a; $databases['db_selected_index'] = $a;
@ -703,9 +703,9 @@ function SearchDatabases($printout, $db = '')
$db_list[] = $db; // DB wurde manuell angegeben $db_list[] = $db; // DB wurde manuell angegeben
} }
// Datenbanken automatisch erkennen // Datenbanken automatisch erkennen
$show_dbs = mysql_query("SHOW DATABASES", $config['dbconnection']); $show_dbs = mysqli_query( $config['dbconnection'], "SHOW DATABASES");
if (!$show_dbs === false) { if (!$show_dbs === false) {
WHILE ($row = mysql_fetch_row($show_dbs)) { WHILE ($row = mysqli_fetch_row($show_dbs)) {
if (trim($row[0]) > '') { if (trim($row[0]) > '') {
$db_list[] = $row[0]; $db_list[] = $row[0];
} }
@ -717,7 +717,7 @@ function SearchDatabases($printout, $db = '')
$databases['db_selected_index'] = 0; $databases['db_selected_index'] = 0;
for ($i = 0; $i < sizeof($db_list); $i++) { for ($i = 0; $i < sizeof($db_list); $i++) {
// Test-Select um zu sehen, ob Berechtigungen existieren // Test-Select um zu sehen, ob Berechtigungen existieren
if (!@mysql_query("SHOW TABLES FROM `" . $db_list[$i] . "`", $config['dbconnection']) === false) { if (!@mysqli_query( $config['dbconnection'], "SHOW TABLES FROM `" . $db_list[$i] . "`") === false) {
$databases['Name'][$i] = $db_list[$i]; $databases['Name'][$i] = $db_list[$i];
$databases['praefix'][$i] = ''; $databases['praefix'][$i] = '';
$databases['command_before_dump'][$i] = ''; $databases['command_before_dump'][$i] = '';
@ -789,14 +789,10 @@ function my_quotes($value)
function db_escape($string) function db_escape($string)
{ {
global $config; global $config;
if (function_exists('mysql_real_escape_string')) { if (function_exists('mysqli_real_escape_string')) {
$string = mysql_real_escape_string($string, $config['dbconnection']); $string = mysqli_real_escape_string( $config['dbconnection'], $string);
} else { } else {
if (function_exists('mysql_escape_string')) { $string = addslashes($string);
$string = mysql_escape_string($string, $config['dbconnection']);
} else {
$string = addslashes($string);
}
} }
return $string; return $string;

Datei anzeigen

@ -72,18 +72,18 @@ function GetStatusLine($kind="php")
$r=0; $r=0;
$t_zeile="$mysql_commentstring\n$mysql_commentstring TABLE-INFO\r\n"; $t_zeile="$mysql_commentstring\n$mysql_commentstring TABLE-INFO\r\n";
MSD_mysql_connect(); MSD_mysql_connect();
$res=mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`"); $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`");
$numrows=intval(@mysql_num_rows($res)); $numrows=intval(@mysqli_num_rows($res));
for($i=0;$i<$numrows;$i++) for($i=0;$i<$numrows;$i++)
{ {
$erg=mysql_fetch_array($res); $erg=mysqli_fetch_array($res);
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
$sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dump['dbindex']]."`.`".$erg['Name']."`"; $sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dump['dbindex']]."`.`".$erg['Name']."`";
$res2=@mysql_query($sql_2); $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
if ($res2===false) if ($res2===false)
{ {
// error reading table definition // error reading table definition
$read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$databases['Name'][$dump['dbindex']],$erg['Name']).': '.mysql_error($config['dbconnection']); $read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$databases['Name'][$dump['dbindex']],$erg['Name']).': '.((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
Errorlog("DUMP",$databases['Name'][$dump['dbindex']],'',$read_create_error,0); Errorlog("DUMP",$databases['Name'][$dump['dbindex']],'',$read_create_error,0);
WriteLog($read_create_error); WriteLog($read_create_error);
if ($config['stop_with_error']>0) if ($config['stop_with_error']>0)
@ -95,7 +95,7 @@ function GetStatusLine($kind="php")
} }
else else
{ {
$row2=mysql_fetch_array($res2); $row2=mysqli_fetch_array($res2);
$erg['Rows']=$row2['count_records']; $erg['Rows']=$row2['count_records'];
if (($databases['db_actual_tableselected']==''||($databases['db_actual_tableselected']!=''&&(in_array($erg[0],$t_array))))&&(substr($erg[0],0,strlen($databases['praefix'][$dump['dbindex']]))==$databases['praefix'][$dump['dbindex']])) if (($databases['db_actual_tableselected']==''||($databases['db_actual_tableselected']!=''&&(in_array($erg[0],$t_array))))&&(substr($erg[0],0,strlen($databases['praefix'][$dump['dbindex']]))==$databases['praefix'][$dump['dbindex']]))
@ -129,9 +129,9 @@ function get_def($db,$table,$withdata=1)
} }
else else
$def.="DROP TABLE IF EXISTS `$table`;\n"; $def.="DROP TABLE IF EXISTS `$table`;\n";
mysql_select_db($db); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $db));
$result=mysql_query('SHOW CREATE TABLE `'.$table.'`',$config['dbconnection']); $result=mysqli_query($config['dbconnection'], 'SHOW CREATE TABLE `'.$table.'`');
$row=@mysql_fetch_row($result); $row=@mysqli_fetch_row($result);
if ($row===false) return false; if ($row===false) return false;
$def.=$row[1].';'."\n\n"; $def.=$row[1].';'."\n\n";
if ($withdata==1) if ($withdata==1)
@ -152,12 +152,12 @@ function get_content($db,$table)
$table_ready=0; $table_ready=0;
$query='SELECT * FROM `'.$table.'` LIMIT '.$dump['zeilen_offset'].','.($dump['restzeilen']+1); $query='SELECT * FROM `'.$table.'` LIMIT '.$dump['zeilen_offset'].','.($dump['restzeilen']+1);
mysql_select_db($db); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $db));
$result=mysql_query($query,$config['dbconnection']); $result=mysqli_query($config['dbconnection'], $query);
$ergebnisse=@mysql_num_rows($result); $ergebnisse=@mysqli_num_rows($result);
if ($ergebnisse!==false) if ($ergebnisse!==false)
{ {
$num_felder=mysql_num_fields($result); $num_felder=(($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false);
$first=1; $first=1;
if ($ergebnisse>$dump['restzeilen']) if ($ergebnisse>$dump['restzeilen'])
@ -176,7 +176,7 @@ function get_content($db,$table)
$ax=0; $ax=0;
for($x=0;$x<$ergebnisse;$x++) for($x=0;$x<$ergebnisse;$x++)
{ {
$row=mysql_fetch_row($result); $row=mysqli_fetch_row($result);
$ax++; $ax++;
$insert='INSERT INTO `'.$table.'` '.$complete.'VALUES ('; $insert='INSERT INTO `'.$table.'` '.$complete.'VALUES (';
@ -185,7 +185,7 @@ function get_content($db,$table)
{ {
if (!isset($row[$j])) $insert.='NULL,'; if (!isset($row[$j])) $insert.='NULL,';
else else
if ($row[$j]!='') $insert.='\''.mysql_real_escape_string($row[$j]).'\','; if ($row[$j]!='') $insert.='\''.((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $row[$j]) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : "")).'\',';
else else
$insert.='\'\','; $insert.='\'\',';
} }
@ -211,7 +211,7 @@ function get_content($db,$table)
WriteToDumpFile(); WriteToDumpFile();
} }
} }
@mysql_free_result($result); @((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false);
} }
function WriteToDumpFile() function WriteToDumpFile()
@ -275,7 +275,7 @@ function ExecuteCommand($when)
if (substr(strtolower($cd),0,7)!='system:') if (substr(strtolower($cd),0,7)!='system:')
{ {
$cad=array(); $cad=array();
@mysql_select_db($databases['Name'][$dump['dbindex']]); @((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dump['dbindex']]));
if (strpos($cd,';')) if (strpos($cd,';'))
{ {
$cad=explode(';',$cd); $cad=explode(';',$cd);
@ -287,12 +287,12 @@ function ExecuteCommand($when)
{ {
if (trim($cad[$i])>'') if (trim($cad[$i])>'')
{ {
$result=@mysql_query($cad[$i],$config['dbconnection']); $result=@mysqli_query($config['dbconnection'], $cad[$i]);
if ($result===false) if ($result===false)
{ {
WriteLog("Error executing Query '$cad[$i]'! MySQL returns: ".trim(mysql_error())); WriteLog("Error executing Query '$cad[$i]'! MySQL returns: ".trim(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
ErrorLog("Error executing Query '$cad[$i]'!",$databases['Name'][$dump['dbindex']],$cad[$i],mysql_error(),0); ErrorLog("Error executing Query '$cad[$i]'!",$databases['Name'][$dump['dbindex']],$cad[$i],((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)),0);
$dump['errors']++; $dump['errors']++;
$out.='<span class="error">Error executing Query '.$cad[$i].'</span>'.$lf; $out.='<span class="error">Error executing Query '.$cad[$i].'</span>'.$lf;
} }

Datei anzeigen

@ -114,14 +114,14 @@ function DBDetailInfo($index)
MSD_mysql_connect(); MSD_mysql_connect();
if (isset($databases['Name'][$index])) if (isset($databases['Name'][$index]))
{ {
mysql_select_db($databases['Name'][$index]); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$index]));
$databases['Detailinfo']['Name']=$databases['Name'][$index]; $databases['Detailinfo']['Name']=$databases['Name'][$index];
$res=@mysql_query('SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`'); $res=@mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`');
if ($res) $databases['Detailinfo']['tables']=mysql_num_rows($res); if ($res) $databases['Detailinfo']['tables']=mysqli_num_rows($res);
if ($databases['Detailinfo']['tables']>0) if ($databases['Detailinfo']['tables']>0)
{ {
$s1=$s2=0; $s1=$s2=0;
while ($row= mysql_fetch_array($res, MYSQL_ASSOC)) while ($row= mysqli_fetch_array($res, MYSQLI_ASSOC))
{ {
$s1+=$row['Rows']; $s1+=$row['Rows'];
$s2+=$row['Data_length']+$row['Index_length']; $s2+=$row['Data_length']+$row['Index_length'];
@ -423,9 +423,9 @@ function EmptyDB($dbn)
{ {
global $config; global $config;
$t_sql=array(); $t_sql=array();
@mysql_query('SET FOREIGN_KEY_CHECKS=0'); @mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=0');
$res=mysql_query('SHOW TABLE STATUS FROM `'.$dbn.'`',$config['dbconnection']) or die('EmptyDB: '.mysql_error()); $res=mysqli_query($config['dbconnection'], 'SHOW TABLE STATUS FROM `'.$dbn.'`') or die('EmptyDB: '.((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
{ {
if (substr(strtoupper($row['Comment']),0,4)=='VIEW') if (substr(strtoupper($row['Comment']),0,4)=='VIEW')
{ {
@ -440,10 +440,10 @@ function EmptyDB($dbn)
{ {
for ($i=0; $i<count($t_sql); $i++) for ($i=0; $i<count($t_sql); $i++)
{ {
$res=mysql_query($t_sql[$i]) or die('EmptyDB-Error: '.mysql_error()); $res=mysqli_query($GLOBALS["___mysqli_ston"], $t_sql[$i]) or die('EmptyDB-Error: '.((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
} }
} }
@mysql_query('SET FOREIGN_KEY_CHECKS=1'); @mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=1');
} }
function AutoDelete() function AutoDelete()
@ -1183,10 +1183,10 @@ function get_sql_encodings()
// MySQL < 4.1 // MySQL < 4.1
$config['mysql_can_change_encoding']=false; $config['mysql_can_change_encoding']=false;
$sqlt='SHOW VARIABLES LIKE \'character_set%\''; $sqlt='SHOW VARIABLES LIKE \'character_set%\'';
$res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); $res=MSD_query($sqlt) or die(SQLError($sqlt,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
if ($res) if ($res)
{ {
WHILE ($row=mysql_fetch_row($res)) WHILE ($row=mysqli_fetch_row($res))
{ {
if ($row[0]=='character_set') if ($row[0]=='character_set')
{ {
@ -1207,11 +1207,11 @@ function get_sql_encodings()
// MySQL-Version >= 4.1 // MySQL-Version >= 4.1
$config['mysql_can_change_encoding']=true; $config['mysql_can_change_encoding']=true;
$sqlt='SHOW CHARACTER SET'; $sqlt='SHOW CHARACTER SET';
$res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); $res=MSD_query($sqlt) or die(SQLError($sqlt,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
if ($res) if ($res)
{ {
WHILE ($row=mysql_fetch_row($res)) WHILE ($row=mysqli_fetch_row($res))
{ {
$config['mysql_possible_character_sets'][]=$row[0].' - '.$row[1]; $config['mysql_possible_character_sets'][]=$row[0].' - '.$row[1];
} }
@ -1219,11 +1219,11 @@ function get_sql_encodings()
} }
$sqlt='SHOW VARIABLES LIKE \'character_set_connection\''; $sqlt='SHOW VARIABLES LIKE \'character_set_connection\'';
$res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error())); $res=MSD_query($sqlt) or die(SQLError($sqlt,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
if ($res) if ($res)
{ {
WHILE ($row=mysql_fetch_row($res)) WHILE ($row=mysqli_fetch_row($res))
{ {
$config['mysql_standard_character_set']=$row[1]; $config['mysql_standard_character_set']=$row[1];
} }

Datei anzeigen

@ -38,12 +38,12 @@ function ExportCSV()
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
if ($res) if ($res)
{ {
$numfields=mysql_numrows($res); $numfields=mysqli_num_rows($res);
if ($sql['export']['namefirstline'] == 1) if ($sql['export']['namefirstline'] == 1)
{ {
for ($feld=0; $feld < $numfields; $feld++) for ($feld=0; $feld < $numfields; $feld++)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
if ($sql['export']['enc'] != "") $t.=$sql['export']['enc'] . $row[0] . $sql['export']['enc'] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' ); if ($sql['export']['enc'] != "") $t.=$sql['export']['enc'] . $row[0] . $sql['export']['enc'] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' );
else $t.=$row[0] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' ); else $t.=$row[0] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' );
} }
@ -55,10 +55,10 @@ function ExportCSV()
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
if ($res) if ($res)
{ {
$numrows=mysql_numrows($res); $numrows=mysqli_num_rows($res);
for ($data=0; $data < $numrows; $data++) for ($data=0; $data < $numrows; $data++)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
for ($feld=0; $feld < $numfields; $feld++) for ($feld=0; $feld < $numfields; $feld++)
{ {
if (!isset($row[$feld]) || is_null($row[$feld])) if (!isset($row[$feld]) || is_null($row[$feld]))
@ -145,7 +145,7 @@ function DoImport()
if ($sql['import']['tablecreate'] == 0) if ($sql['import']['tablecreate'] == 0)
{ {
$res=MSD_query("show fields FROM " . $sql['import']['table']); $res=MSD_query("show fields FROM " . $sql['import']['table']);
$tabellenfelder=mysql_num_rows($res); $tabellenfelder=mysqli_num_rows($res);
if ($importfelder != $tabellenfelder) if ($importfelder != $tabellenfelder)
{ {
$r.='<br>' . sprintf($lang['L_CSV_FIELDCOUNT_NOMATCH'],$tabellenfelder,$importfelder); $r.='<br>' . sprintf($lang['L_CSV_FIELDCOUNT_NOMATCH'],$tabellenfelder,$importfelder);
@ -206,11 +206,11 @@ function ImportCreateTable()
{ {
global $sql,$lang,$db,$config; global $sql,$lang,$db,$config;
$tbl=Array(); $tbl=Array();
$tabellen=mysql_list_tables($db,$config['dbconnection']); $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM $db");
$num_tables=mysql_num_rows($tabellen); $num_tables=mysqli_num_rows($tabellen);
for ($i=0; $i < $num_tables; $i++) for ($i=0; $i < $num_tables; $i++)
{ {
$tbl[]=strtolower(mysql_tablename($tabellen,$i)); $tbl[]=strtolower(((mysqli_data_seek($tabellen, $i) && (($___mysqli_tmp = mysqli_fetch_row($tabellen)) !== NULL)) ? array_shift($___mysqli_tmp) : false));
} }
$i=0; $i=0;
$sql['import']['table']=$sql['import']['table'] . $i; $sql['import']['table']=$sql['import']['table'] . $i;
@ -237,7 +237,7 @@ function ImportCreateTable()
else $create=substr($create,0,strlen($create) - 2); else $create=substr($create,0,strlen($create) - 2);
$create.=') ' . ( ( MSD_NEW_VERSION ) ? 'ENGINE' : 'TYPE' ) . "=MyISAM COMMENT='imported at " . date("l dS of F Y H:i:s A") . "'"; $create.=') ' . ( ( MSD_NEW_VERSION ) ? 'ENGINE' : 'TYPE' ) . "=MyISAM COMMENT='imported at " . date("l dS of F Y H:i:s A") . "'";
$res=mysql_query($create,$config['dbconnection']) || die(SQLError($create,mysql_error())); $res=mysqli_query($config['dbconnection'], $create) || die(SQLError($create,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
return 1; return 1;
} }
@ -258,13 +258,13 @@ function ExportXML()
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
if ($res) if ($res)
{ {
$numfields=mysql_num_rows($res); $numfields=mysqli_num_rows($res);
if ($sql['export']['xmlstructure'] == 1) if ($sql['export']['xmlstructure'] == 1)
{ {
$t.=str_repeat($tab,$level++) . '<structure>' . "\n"; $t.=str_repeat($tab,$level++) . '<structure>' . "\n";
for ($feld=0; $feld < $numfields; $feld++) for ($feld=0; $feld < $numfields; $feld++)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$t.=str_repeat($tab,$level++) . '<field no="' . $feld . '">' . "\n"; $t.=str_repeat($tab,$level++) . '<field no="' . $feld . '">' . "\n";
$t.=str_repeat($tab,$level) . '<name>' . $row['Field'] . '</name>' . "\n"; $t.=str_repeat($tab,$level) . '<name>' . $row['Field'] . '</name>' . "\n";
$t.=str_repeat($tab,$level) . '<type>' . $row['Type'] . '</type>' . "\n"; $t.=str_repeat($tab,$level) . '<type>' . $row['Type'] . '</type>' . "\n";
@ -282,12 +282,12 @@ function ExportXML()
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
if ($res) if ($res)
{ {
$numrows=mysql_numrows($res); $numrows=mysqli_num_rows($res);
for ($data=0; $data < $numrows; $data++) for ($data=0; $data < $numrows; $data++)
{ {
$t.=str_repeat($tab,$level) . "<row>\n"; $t.=str_repeat($tab,$level) . "<row>\n";
$level++; $level++;
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
for ($feld=0; $feld < $numfields; $feld++) for ($feld=0; $feld < $numfields; $feld++)
{ {
$t.=str_repeat($tab,$level) . '<field no="' . $feld . '">' . $row[$feld] . '</field>' . "\n"; $t.=str_repeat($tab,$level) . '<field no="' . $feld . '">' . $row[$feld] . '</field>' . "\n";
@ -336,10 +336,10 @@ function ExportHTML()
{ {
$field=$fieldname=$fieldtyp=Array(); $field=$fieldname=$fieldtyp=Array();
$structure="<table class=\"Table\">\n"; $structure="<table class=\"Table\">\n";
$numfields=mysql_numrows($res); $numfields=mysqli_num_rows($res);
for ($feld=0; $feld < $numfields; $feld++) for ($feld=0; $feld < $numfields; $feld++)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
$field[$feld]=$row[0]; $field[$feld]=$row[0];
if ($feld == 0) if ($feld == 0)
@ -347,7 +347,7 @@ function ExportHTML()
$structure.="<tr class=\"Header\">\n"; $structure.="<tr class=\"Header\">\n";
for ($i=0; $i < count($row); $i++) for ($i=0; $i < count($row); $i++)
{ {
$str=mysql_fetch_field($res,$i); $str=(((($___mysqli_tmp = mysqli_fetch_field_direct($res, 0)) && is_object($___mysqli_tmp)) ? ( (!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && (!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && (!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && (!is_null($___mysqli_type = $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0)) ) : false ) ? $___mysqli_tmp : false);
$fieldname[$i]=$str->name; $fieldname[$i]=$str->name;
$fieldtyp[$i]=$str->type; $fieldtyp[$i]=$str->type;
$structure.="<th>" . $str->name . "</th>\n"; $structure.="<th>" . $str->name . "</th>\n";
@ -369,7 +369,7 @@ function ExportHTML()
$res=MSD_query($dsql); $res=MSD_query($dsql);
if ($res) if ($res)
{ {
$anz=mysql_num_rows($res); $anz=mysqli_num_rows($res);
$content.="<h3>Daten ($anz Datens&auml;tze)</h3>\n"; $content.="<h3>Daten ($anz Datens&auml;tze)</h3>\n";
$content.="<table class=\"Table\">\n"; $content.="<table class=\"Table\">\n";
for ($feld=0; $feld < count($field); $feld++) for ($feld=0; $feld < count($field); $feld++)
@ -386,7 +386,7 @@ function ExportHTML()
} }
for ($d=0; $d < $anz; $d++) for ($d=0; $d < $anz; $d++)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
$content.="<tr>\n"; $content.="<tr>\n";
for ($i=0; $i < count($row); $i++) for ($i=0; $i < count($row); $i++)
{ {

Datei anzeigen

@ -276,23 +276,23 @@ function submit_create_action($sql)
} }
} }
$res=@mysql_query($sql); $res=@mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if ($res===false) if ($res===false)
{ {
// erster Versuch fehlgeschlagen -> zweiter Versuch - vielleicht versteht der Server die Inline-Kommentare nicht? // erster Versuch fehlgeschlagen -> zweiter Versuch - vielleicht versteht der Server die Inline-Kommentare nicht?
$sql=del_inline_comments($sql); $sql=del_inline_comments($sql);
$res=@mysql_query(downgrade($sql)); $res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql));
if ($res===false) if ($res===false)
{ {
// wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x? // wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x?
// versuchen wir es mal mit der alten Syntax // versuchen wir es mal mit der alten Syntax
$res=@mysql_query(downgrade($sql)); $res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql));
} }
} }
if ($res===false) if ($res===false)
{ {
// wenn wir hier angekommen sind hat nichts geklappt -> Fehler ausgeben und abbrechen // wenn wir hier angekommen sind hat nichts geklappt -> Fehler ausgeben und abbrechen
SQLError($sql,mysql_error()); SQLError($sql,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
die("<br>Fatal error: Couldn't create table or view `".$tablename."´"); die("<br>Fatal error: Couldn't create table or view `".$tablename."´");
} }
return $tablename; return $tablename;
@ -302,11 +302,11 @@ function get_insert_syntax($table)
{ {
$insert=''; $insert='';
$sql='SHOW COLUMNS FROM `'.$table.'`'; $sql='SHOW COLUMNS FROM `'.$table.'`';
$res=mysql_query($sql); $res=mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if ($res) if ($res)
{ {
$insert='INSERT INTO `'.$table.'` ('; $insert='INSERT INTO `'.$table.'` (';
while ($row=mysql_fetch_object($res)) while ($row=mysqli_fetch_object($res))
{ {
$insert.='`'.$row->Field.'`,'; $insert.='`'.$row->Field.'`,';
} }
@ -316,7 +316,7 @@ function get_insert_syntax($table)
{ {
global $restore; global $restore;
v($restore); v($restore);
SQLError($sql,mysql_error()); SQLError($sql,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
} }
return $insert; return $insert;
} }

Datei anzeigen

@ -79,15 +79,15 @@ function SQL_ComboBox()
function Table_ComboBox() function Table_ComboBox()
{ {
global $db,$config,$lang,$nl; global $db,$config,$lang,$nl;
$tabellen=mysql_query('SHOW TABLES FROM `' . $db . '`',$config['dbconnection']); $tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `' . $db . '`');
$num_tables = 0; $num_tables = 0;
if (is_resource($tabellen)) { if (is_resource($tabellen)) {
$num_tables=mysql_num_rows($tabellen); $num_tables=mysqli_num_rows($tabellen);
} }
$s=$nl . $nl . '<select class="SQLCombo" name="tablecombo" onchange="this.form.sqltextarea.value=this.options[this.selectedIndex].value;this.form.execsql.click();">' . $nl . '<option value="" selected> --- </option>' . $nl; $s=$nl . $nl . '<select class="SQLCombo" name="tablecombo" onchange="this.form.sqltextarea.value=this.options[this.selectedIndex].value;this.form.execsql.click();">' . $nl . '<option value="" selected> --- </option>' . $nl;
for ($i=0; $i < $num_tables; $i++) for ($i=0; $i < $num_tables; $i++)
{ {
$t=mysql_fetch_row($tabellen); $t=mysqli_fetch_row($tabellen);
$s.='<option value="SELECT * FROM `' . $db . '`.`' . $t[0] . '`">' . $lang['L_TABLE'] . ' `' . $t[0] . '`</option>' . $nl; $s.='<option value="SELECT * FROM `' . $db . '`.`' . $t[0] . '`">' . $lang['L_TABLE'] . ' `' . $t[0] . '`</option>' . $nl;
} }
$s.='</select>' . $nl . $nl; $s.='</select>' . $nl . $nl;
@ -97,12 +97,12 @@ function Table_ComboBox()
function TableComboBox($default='') function TableComboBox($default='')
{ {
global $db,$config,$lang,$nl; global $db,$config,$lang,$nl;
$tabellen=mysql_list_tables($db,$config['dbconnection']); $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM $db");
$num_tables=mysql_num_rows($tabellen); $num_tables=mysqli_num_rows($tabellen);
$s='<option value="" ' . ( ( $default == '' ) ? 'selected' : '' ) . '> </option>' . $nl; $s='<option value="" ' . ( ( $default == '' ) ? 'selected' : '' ) . '> </option>' . $nl;
for ($i=0; $i < $num_tables; $i++) for ($i=0; $i < $num_tables; $i++)
{ {
$t=mysql_tablename($tabellen,$i); $t=((mysqli_data_seek($tabellen, $i) && (($___mysqli_tmp = mysqli_fetch_row($tabellen)) !== NULL)) ? array_shift($___mysqli_tmp) : false);
$s.='<option value="`' . $t . '`"' . ( ( $default == '`' . $t . '`' ) ? 'selected' : '' ) . '>`' . $t . '`</option>' . $nl; $s.='<option value="`' . $t . '`"' . ( ( $default == '`' . $t . '`' ) ? 'selected' : '' ) . '>`' . $t . '`</option>' . $nl;
} }
return $s; return $s;
@ -113,8 +113,8 @@ function DB_Exists($db)
global $config; global $config;
if (!isset($config['dbconnection'])) MSD_mysql_connect(); if (!isset($config['dbconnection'])) MSD_mysql_connect();
$erg=false; $erg=false;
$dbs=mysql_list_dbs($config['dbconnection']); $dbs=(($___mysqli_tmp = mysqli_query($config['dbconnection'], "SHOW DATABASES")) ? $___mysqli_tmp : false);
while ($row=mysql_fetch_object($dbs)) while ($row=mysqli_fetch_object($dbs))
{ {
if (strtolower($row->Database) == strtolower($db)) if (strtolower($row->Database) == strtolower($db))
{ {
@ -134,7 +134,7 @@ function Table_Exists($db, $table)
if ($res) if ($res)
{ {
$tables=array(); $tables=array();
WHILE ($row=mysql_fetch_row($res)) WHILE ($row=mysqli_fetch_row($res))
{ {
$tables[]=$row[0]; $tables[]=$row[0];
} }
@ -207,16 +207,16 @@ function DB_Copy($source, $destination, $drop_source=0, $insert_data=1)
} }
} }
$SQL_Array.="USE `$destination` ;\n"; $SQL_Array.="USE `$destination` ;\n";
$tabellen=mysql_list_tables($source,$config['dbconnection']); $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM $source");
$num_tables=mysql_num_rows($tabellen); $num_tables=mysqli_num_rows($tabellen);
for ($i=0; $i < $num_tables; $i++) for ($i=0; $i < $num_tables; $i++)
{ {
$table=mysql_tablename($tabellen,$i); $table=((mysqli_data_seek($tabellen, $i) && (($___mysqli_tmp = mysqli_fetch_row($tabellen)) !== NULL)) ? array_shift($___mysqli_tmp) : false);
$sqlt="SHOW CREATE TABLE `$source`.`$table`"; $sqlt="SHOW CREATE TABLE `$source`.`$table`";
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
if ($res) if ($res)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
$c=$row[1]; $c=$row[1];
if (substr($c,-1) == ";") $c=substr($c,0,strlen($c) - 1); if (substr($c,-1) == ";") $c=substr($c,0,strlen($c) - 1);
$SQL_Array.=( $insert_data == 1 ) ? "$c SELECT * FROM `$source`.`$table` ;\n" : "$c ;\n"; $SQL_Array.=( $insert_data == 1 ) ? "$c SELECT * FROM `$source`.`$table` ;\n" : "$c ;\n";
@ -226,7 +226,7 @@ function DB_Copy($source, $destination, $drop_source=0, $insert_data=1)
return false; return false;
} }
} }
mysql_select_db($destination); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $destination));
$res=MSD_DoSQL($SQL_Array); $res=MSD_DoSQL($SQL_Array);
if ($drop_source == 1 && $res) MSD_query("DROP DATABASE `$source`;"); if ($drop_source == 1 && $res) MSD_query("DROP DATABASE `$source`;");
return $res; return $res;
@ -239,7 +239,7 @@ function Table_Copy($source, $destination, $insert_data, $destinationdb="")
$SQL_Array=$t=""; $SQL_Array=$t="";
$sqlc="SHOW CREATE TABLE $source"; $sqlc="SHOW CREATE TABLE $source";
$res=MSD_query($sqlc); $res=MSD_query($sqlc);
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
$c=$row[1]; $c=$row[1];
$a1=strpos($c,"`"); $a1=strpos($c,"`");
$a2=strpos($c,"`",$a1 + 1); $a2=strpos($c,"`",$a1 + 1);
@ -483,16 +483,16 @@ function GetCreateTable($db, $tabelle)
{ {
global $config; global $config;
if (!isset($config['dbconnection'])) MSD_mysql_connect(); if (!isset($config['dbconnection'])) MSD_mysql_connect();
$res=mysql_query("SHOW CREATE TABLE `$db`.`$tabelle`"); $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW CREATE TABLE `$db`.`$tabelle`");
if ($res) if ($res)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
if (isset($row['Create Table'])) return $row['Create Table']; if (isset($row['Create Table'])) return $row['Create Table'];
elseif (isset($row['Create View'])) return $row['Create View']; elseif (isset($row['Create View'])) return $row['Create View'];
else return false; else return false;
} }
else else
return mysql_error(); return ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
} }
@ -587,11 +587,11 @@ function EngineCombo($default="")
} }
else else
{ {
$res=mysql_query("SHOW ENGINES"); $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW ENGINES");
$num=mysql_num_rows($res); $num=mysqli_num_rows($res);
for ($i=0; $i < $num; $i++) for ($i=0; $i < $num; $i++)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$r.='<option value="' . $row['Engine'] . '" ' . ( ( $row['Engine'] == $default ) ? "selected" : "" ) . '>' . $row['Engine'] . '</option>'; $r.='<option value="' . $row['Engine'] . '" ' . ( ( $row['Engine'] == $default ) ? "selected" : "" ) . '>' . $row['Engine'] . '</option>';
} }
} }
@ -608,13 +608,13 @@ function CharsetCombo($default="")
else else
{ {
if (!isset($config['dbconnection'])) MSD_mysql_connect(); if (!isset($config['dbconnection'])) MSD_mysql_connect();
$res=mysql_query("SHOW Charset"); $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW Charset");
$num=mysql_num_rows($res); $num=mysqli_num_rows($res);
$r='<option value="" ' . ( ( $default == "" ) ? "selected" : "" ) . '></option>'; $r='<option value="" ' . ( ( $default == "" ) ? "selected" : "" ) . '></option>';
$charsets=array(); $charsets=array();
for ($i=0; $i < $num; $i++) for ($i=0; $i < $num; $i++)
{ {
$charsets[]=mysql_fetch_array($res); $charsets[]=mysqli_fetch_array($res);
} }
if (is_array($charsets)) if (is_array($charsets))
@ -634,14 +634,14 @@ function GetCollationArray()
global $config; global $config;
if (!isset($config['dbconnection'])) MSD_mysql_connect(); if (!isset($config['dbconnection'])) MSD_mysql_connect();
$res=mysql_query("SHOW Collation"); $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW Collation");
$num=@mysql_num_rows($res); $num=@mysqli_num_rows($res);
$r=Array(); $r=Array();
if (is_array($r)) if (is_array($r))
{ {
for ($i=0; $i < $num; $i++) for ($i=0; $i < $num; $i++)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$r[$i]['Collation']=isset($row['Collation']) ? $row['Collation'] : ''; $r[$i]['Collation']=isset($row['Collation']) ? $row['Collation'] : '';
$r[$i]['Charset']=isset($row['Charset']) ? $row['Charset'] : ''; $r[$i]['Charset']=isset($row['Charset']) ? $row['Charset'] : '';
$r[$i]['Id']=isset($row['Id']) ? $row['Id'] : ''; $r[$i]['Id']=isset($row['Id']) ? $row['Id'] : '';
@ -840,7 +840,7 @@ function getFieldinfos($db, $tabelle)
$t=GetCreateTable($db,$tabelle); $t=GetCreateTable($db,$tabelle);
$sqlf="SHOW FULL FIELDS FROM `$db`.`$tabelle`;"; $sqlf="SHOW FULL FIELDS FROM `$db`.`$tabelle`;";
$res=MSD_query($sqlf); $res=MSD_query($sqlf);
$anz_fields=mysql_num_rows($res); $anz_fields=mysqli_num_rows($res);
$fields_infos['_primarykeys_']=array(); $fields_infos['_primarykeys_']=array();
$fields_infos['_key_']=array(); $fields_infos['_key_']=array();
@ -867,7 +867,7 @@ function getFieldinfos($db, $tabelle)
$fields_infos[$i]['type']=''; $fields_infos[$i]['type']='';
$fields_infos[$i]['privileges']=''; $fields_infos[$i]['privileges']='';
$row=mysql_fetch_array($res,MYSQL_ASSOC); $row=mysqli_fetch_array($res, MYSQLI_ASSOC);
//v($row); //v($row);
if (isset($row['Collation'])) $fields_infos[$i]['collate']=$row['Collation']; if (isset($row['Collation'])) $fields_infos[$i]['collate']=$row['Collation'];
if (isset($row['COLLATE'])) $fields_infos[$i]['collate']=$row['COLLATE']; // MySQL <4.1 if (isset($row['COLLATE'])) $fields_infos[$i]['collate']=$row['COLLATE']; // MySQL <4.1
@ -898,7 +898,7 @@ function getFieldinfos($db, $tabelle)
// now get key definitions of the table and add info to fields // now get key definitions of the table and add info to fields
$sql='SHOW KEYS FROM `' . $db . '`.`' . $tabelle . '`'; $sql='SHOW KEYS FROM `' . $db . '`.`' . $tabelle . '`';
$res=MSD_query($sql); $res=MSD_query($sql);
WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
{ {
//v($row); //v($row);
$key_name=isset($row['Key_name']) ? $row['Key_name'] : ''; $key_name=isset($row['Key_name']) ? $row['Key_name'] : '';
@ -947,12 +947,12 @@ function getExtendedFieldInfo($db, $table)
$t=GetCreateTable($db,$table); $t=GetCreateTable($db,$table);
$sqlf="SHOW FULL FIELDS FROM `$db`.`$table`;"; $sqlf="SHOW FULL FIELDS FROM `$db`.`$table`;";
$res=MSD_query($sqlf); $res=MSD_query($sqlf);
$num_fields=mysql_num_rows($res); $num_fields=mysqli_num_rows($res);
$f=array(); //will hold all info $f=array(); //will hold all info
for ($x=0; $x < $num_fields; $x++) for ($x=0; $x < $num_fields; $x++)
{ {
$row=mysql_fetch_array($res,MYSQL_ASSOC); $row=mysqli_fetch_array($res, MYSQLI_ASSOC);
//v($row); //v($row);
$i=$row['Field']; // define name of field as index of array $i=$row['Field']; // define name of field as index of array
//define field defaults - this way the index of the array is defined anyway //define field defaults - this way the index of the array is defined anyway
@ -997,7 +997,7 @@ function getExtendedFieldInfo($db, $table)
// now get key definitions of the table and add info to field-array // now get key definitions of the table and add info to field-array
$sql='SHOW KEYS FROM `' . $db . '`.`' . $table . '`'; $sql='SHOW KEYS FROM `' . $db . '`.`' . $table . '`';
$res=MSD_query($sql); $res=MSD_query($sql);
WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
{ {
//echo "<br>Keys of $table: ";v($row); //echo "<br>Keys of $table: ";v($row);
$key_name=isset($row['Key_name']) ? $row['Key_name'] : ''; $key_name=isset($row['Key_name']) ? $row['Key_name'] : '';
@ -1077,7 +1077,7 @@ function getPrimaryKeys($db, $table)
$keys=Array(); $keys=Array();
$sqlk="SHOW KEYS FROM `" . $db . "`.`" . $table . "`;"; $sqlk="SHOW KEYS FROM `" . $db . "`.`" . $table . "`;";
$res=MSD_query($sqlk); $res=MSD_query($sqlk);
while ($row=mysql_fetch_array($res)) while ($row=mysqli_fetch_array($res))
{ {
//wenn Primaerschluessel //wenn Primaerschluessel
if ($row['Key_name'] == "PRIMARY") $keys['name'][]=$row['Column_name']; if ($row['Key_name'] == "PRIMARY") $keys['name'][]=$row['Column_name'];
@ -1105,7 +1105,7 @@ function getAllFields($db, $table)
$fields=Array(); $fields=Array();
$sqlk="DESCRIBE `" . $db . "`.`" . $table . "`;"; $sqlk="DESCRIBE `" . $db . "`.`" . $table . "`;";
$res=MSD_query($sqlk); $res=MSD_query($sqlk);
while ($row=mysql_fetch_array($res)) while ($row=mysqli_fetch_array($res))
{ {
$fields[]=$row['Field']; $fields[]=$row['Field'];
} }

Datei anzeigen

@ -14,7 +14,7 @@ for ($i=0; $i<count($databases['Name']); $i++)
} }
if (isset($_POST['kill'.$i])) if (isset($_POST['kill'.$i]))
{ {
$res=mysql_query('DROP DATABASE `'.$databases['Name'][$i].'`') or die(mysql_error()); $res=mysqli_query($GLOBALS["___mysqli_ston"], 'DROP DATABASE `'.$databases['Name'][$i].'`') or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
$dba='<p class="green">'.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_DELETED'].'</p>'; $dba='<p class="green">'.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_DELETED'].'</p>';
SetDefault(); SetDefault();
include ($config['files']['parameter']); include ($config['files']['parameter']);
@ -23,16 +23,16 @@ for ($i=0; $i<count($databases['Name']); $i++)
} }
if (isset($_POST['optimize'.$i])) if (isset($_POST['optimize'.$i]))
{ {
mysql_select_db($databases['Name'][$i], $config['dbconnection']); ((bool)mysqli_query( $config['dbconnection'], "USE " . $databases['Name'][$i]));
$res=mysql_query('SHOW TABLES FROM `'.$databases['Name'][$i].'`',$config['dbconnection']); $res=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`');
$tabellen=''; $tabellen='';
WHILE ($row=mysql_fetch_row($res)) WHILE ($row=mysqli_fetch_row($res))
$tabellen.='`'.$row[0].'`,'; $tabellen.='`'.$row[0].'`,';
$tabellen=substr($tabellen,0,(strlen($tabellen)-1)); $tabellen=substr($tabellen,0,(strlen($tabellen)-1));
if ($tabellen>"") if ($tabellen>"")
{ {
$query="OPTIMIZE TABLE ".$tabellen; $query="OPTIMIZE TABLE ".$tabellen;
$res=mysql_query($query) or die(mysql_error().""); $res=mysqli_query($GLOBALS["___mysqli_ston"], $query) or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))."");
} }
$_GET['dbid']=$i; $_GET['dbid']=$i;
$dba='<p class="green">'.$lang['L_DB'].' <b>'.$databases['Name'][$i].'</b> '.$lang['L_INFO_OPTIMIZED'].'.</p>'; $dba='<p class="green">'.$lang['L_DB'].' <b>'.$databases['Name'][$i].'</b> '.$lang['L_INFO_OPTIMIZED'].'.</p>';
@ -63,7 +63,7 @@ for ($i=0; $i<count($databases['Name']); $i++)
if ($i==$databases['db_selected_index']) $rowclass="dbrowsel"; if ($i==$databases['db_selected_index']) $rowclass="dbrowsel";
//gibts die Datenbank überhaupt? //gibts die Datenbank überhaupt?
if (!mysql_select_db($databases['Name'][$i],$config['dbconnection'])) if (!((bool)mysqli_query($config['dbconnection'], "USE " . $databases['Name'][$i])))
{ {
$tpl->assign_block_vars('DB_NOT_FOUND',array( $tpl->assign_block_vars('DB_NOT_FOUND',array(
'ROWCLASS' => $rowclass, 'ROWCLASS' => $rowclass,
@ -73,9 +73,9 @@ for ($i=0; $i<count($databases['Name']); $i++)
} }
else else
{ {
mysql_select_db($databases['Name'][$i],$config['dbconnection']); ((bool)mysqli_query($config['dbconnection'], "USE " . $databases['Name'][$i]));
$tabellen=mysql_query('SHOW TABLES FROM `'.$databases['Name'][$i].'`',$config['dbconnection']); $tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`');
$num_tables=mysql_num_rows($tabellen); $num_tables=mysqli_num_rows($tabellen);
$tpl->assign_block_vars('ROW',array( $tpl->assign_block_vars('ROW',array(
'ROWCLASS' => $rowclass, 'ROWCLASS' => $rowclass,
'NR' => ($i+1), 'NR' => ($i+1),
@ -101,9 +101,9 @@ if (isset($_GET['dbid']))
$dbid=$_GET['dbid']; $dbid=$_GET['dbid'];
$numrows=0; $numrows=0;
$res=@mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`"); $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`");
mysql_select_db($databases['Name'][$dbid]); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dbid]));
if ($res) $numrows=mysql_num_rows($res); if ($res) $numrows=mysqli_num_rows($res);
$tpl->assign_vars(array( $tpl->assign_vars(array(
'DB_NAME' => $databases['Name'][$dbid], 'DB_NAME' => $databases['Name'][$dbid],
'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]), 'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]),
@ -120,10 +120,10 @@ if (isset($_GET['dbid']))
$sum_records=$sum_data_length=''; $sum_records=$sum_data_length='';
for ($i=0; $i<$numrows; $i++) for ($i=0; $i<$numrows; $i++)
{ {
$row=mysql_fetch_array($res,MYSQL_ASSOC); $row=mysqli_fetch_array($res, MYSQLI_ASSOC);
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
$sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dbid]."`.`".$row['Name']."`"; $sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dbid]."`.`".$row['Name']."`";
$res2=@mysql_query($sql_2); $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
if ($res2===false) if ($res2===false)
{ {
$row['Rows']=0; $row['Rows']=0;
@ -131,7 +131,7 @@ if (isset($_GET['dbid']))
} }
else else
{ {
$row2=mysql_fetch_array($res2); $row2=mysqli_fetch_array($res2);
$row['Rows']=$row2['count_records']; $row['Rows']=$row2['count_records'];
$rowclass=($i%2) ? 'dbrow' : 'dbrow1'; $rowclass=($i%2) ? 'dbrow' : 'dbrow1';
} }
@ -163,16 +163,16 @@ if (isset($_GET['dbid']))
if ($checkit==$row['Name']||$repair==1) if ($checkit==$row['Name']||$repair==1)
{ {
$tmp_res=mysql_query("REPAIR TABLE `".$row['Name']."`"); $tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], "REPAIR TABLE `".$row['Name']."`");
} }
if (($checkit==$row['Name']||$checkit=='ALL')) if (($checkit==$row['Name']||$checkit=='ALL'))
{ {
// table needs to be checked // table needs to be checked
$tmp_res=mysql_query('CHECK TABLE `'.$row['Name'].'`'); $tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], 'CHECK TABLE `'.$row['Name'].'`');
if ($tmp_res) if ($tmp_res)
{ {
$tmp_row=mysql_fetch_row($tmp_res); $tmp_row=mysqli_fetch_row($tmp_res);
if ($tmp_row[3]=='OK') $tpl->assign_block_vars('ROW.CHECK_TABLE_OK',array()); if ($tmp_row[3]=='OK') $tpl->assign_block_vars('ROW.CHECK_TABLE_OK',array());
else else
$tpl->assign_block_vars('ROW.CHECK_TABLE_NOT_OK',array()); $tpl->assign_block_vars('ROW.CHECK_TABLE_NOT_OK',array());
@ -186,10 +186,10 @@ if (isset($_GET['dbid']))
if ($enableKeys==$row['Name'] || $enableKeys=="ALL") if ($enableKeys==$row['Name'] || $enableKeys=="ALL")
{ {
$sSql= "ALTER TABLE `".$databases['Name'][$dbid]."`.`".$row['Name']."` ENABLE KEYS"; $sSql= "ALTER TABLE `".$databases['Name'][$dbid]."`.`".$row['Name']."` ENABLE KEYS";
$tmp_res=mysql_query($sSql); $tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], $sSql);
} }
$res3=mysql_query('SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`"); $res3=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`");
WHILE ($row3 = mysql_fetch_array($res3, MYSQL_ASSOC)) WHILE ($row3 = mysqli_fetch_array($res3, MYSQLI_ASSOC))
{ {
if ($row3['Comment']=="disabled") { if ($row3['Comment']=="disabled") {
$keys_disabled = true; $keys_disabled = true;

Datei anzeigen

@ -14,8 +14,8 @@ echo '<p>&nbsp;</p>';
switch ($var) switch ($var)
{ {
case "variables": case "variables":
$res=@mysql_query("SHOW variables"); $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW variables");
if ($res) $numrows=mysql_num_rows($res); if ($res) $numrows=mysqli_num_rows($res);
if ($numrows==0) if ($numrows==0)
{ {
echo $lang['L_INFO_NOVARS']; echo $lang['L_INFO_NOVARS'];
@ -25,7 +25,7 @@ switch ($var)
echo '<table class="bdr"><tr class="thead"><th><strong>Name</strong></th><th><strong>'.$lang['L_INHALT'].'</strong></th></tr>'; echo '<table class="bdr"><tr class="thead"><th><strong>Name</strong></th><th><strong>'.$lang['L_INHALT'].'</strong></th></tr>';
for ($i=0; $i<$numrows; $i++) for ($i=0; $i<$numrows; $i++)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$cl=($i%2) ? "dbrow" : "dbrow1"; $cl=($i%2) ? "dbrow" : "dbrow1";
echo '<tr class="'.$cl.'"><td align="left">'.$row[0].'</td><td align="left">'.$row[1].'</td></tr>'; echo '<tr class="'.$cl.'"><td align="left">'.$row[0].'</td><td align="left">'.$row[1].'</td></tr>';
} }
@ -33,8 +33,8 @@ switch ($var)
echo '</table>'; echo '</table>';
break; break;
case "status": case "status":
$res=@mysql_query("SHOW STATUS"); $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW STATUS");
if ($res) $numrows=mysql_num_rows($res); if ($res) $numrows=mysqli_num_rows($res);
if ($numrows==0) if ($numrows==0)
{ {
echo $lang['L_INFO_NOSTATUS']; echo $lang['L_INFO_NOSTATUS'];
@ -45,7 +45,7 @@ switch ($var)
for ($i=0; $i<$numrows; $i++) for ($i=0; $i<$numrows; $i++)
{ {
$cl=($i%2) ? "dbrow" : "dbrow1"; $cl=($i%2) ? "dbrow" : "dbrow1";
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
echo '<tr class="'.$cl.'"><td align="left" valign="top">'.$row[0].'</td><td align="left" valign="top">'.$row[1].'</td></tr>'; echo '<tr class="'.$cl.'"><td align="left" valign="top">'.$row[0].'</td><td align="left" valign="top">'.$row[1].'</td></tr>';
} }
} }
@ -59,7 +59,7 @@ switch ($var)
$wait=(isset($_GET['wait'])) ? $_GET['wait'] : 0; $wait=(isset($_GET['wait'])) ? $_GET['wait'] : 0;
if ($wait==0) if ($wait==0)
{ {
$ret=mysql_query("KILL ".$_GET['killid']); $ret=mysqli_query($GLOBALS["___mysqli_ston"], "KILL ".$_GET['killid']);
$wait=2; $wait=2;
} }
else else
@ -77,8 +77,8 @@ switch ($var)
} }
$killid=$wait=0; $killid=$wait=0;
$res=@mysql_query("SHOW FULL PROCESSLIST "); $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW FULL PROCESSLIST ");
if ($res) $numrows=mysql_num_rows($res); if ($res) $numrows=mysqli_num_rows($res);
if ($numrows==0) if ($numrows==0)
{ {
echo $lang['L_INFO_NOPROCESSES']; echo $lang['L_INFO_NOPROCESSES'];
@ -89,7 +89,7 @@ switch ($var)
for ($i=0; $i<$numrows; $i++) for ($i=0; $i<$numrows; $i++)
{ {
$cl=($i%2) ? "dbrow" : "dbrow1"; $cl=($i%2) ? "dbrow" : "dbrow1";
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
echo '<tr><td>'.$row[0].'</td><td>'.$row[1].'</td> echo '<tr><td>'.$row[0].'</td><td>'.$row[1].'</td>
<td>'.$row[2].'</td><td>'.$row[3].'</td><td>'.$row[4].'</td><td>'.$row[5].'</td> <td>'.$row[2].'</td><td>'.$row[3].'</td><td>'.$row[4].'</td><td>'.$row[5].'</td>
<td>'.$row[6].'</td><td>'.$row[7].'</td> <td>'.$row[6].'</td><td>'.$row[7].'</td>

Binäre Datei nicht angezeigt.

Datei anzeigen

@ -2,18 +2,18 @@
if (!defined('MSD_VERSION')) die('No direct access.'); if (!defined('MSD_VERSION')) die('No direct access.');
$sysaction=(isset($_GET['dosys'])) ? $_GET['dosys'] : 0; $sysaction=(isset($_GET['dosys'])) ? $_GET['dosys'] : 0;
$msg=""; $msg="";
$res=@mysql_query("SHOW VARIABLES LIKE 'datadir'",$config['dbconnection']); $res=@mysqli_query($config['dbconnection'], "SHOW VARIABLES LIKE 'datadir'");
if ($res) if ($res)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$data_dir=$row[1]; $data_dir=$row[1];
} }
switch ($sysaction) switch ($sysaction)
{ {
case 1: //FLUSH PRIVILEGES case 1: //FLUSH PRIVILEGES
$msg="&gt; operating FLUSH PRIVILEGES<br>"; $msg="&gt; operating FLUSH PRIVILEGES<br>";
$res=@mysql_query("FLUSH PRIVILEGES",$config['dbconnection']); $res=@mysqli_query($config['dbconnection'], "FLUSH PRIVILEGES");
$meldung=mysql_error($config['dbconnection']); $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!="") if ($meldung!="")
{ {
$msg.='&gt; MySQL-Error: '.$meldung; $msg.='&gt; MySQL-Error: '.$meldung;
@ -25,8 +25,8 @@ switch ($sysaction)
break; break;
case 2: //FLUSH STATUS case 2: //FLUSH STATUS
$msg="&gt; operating FLUSH STATUS<br>"; $msg="&gt; operating FLUSH STATUS<br>";
$res=@mysql_query("FLUSH STATUS",$config['dbconnection']); $res=@mysqli_query($config['dbconnection'], "FLUSH STATUS");
$meldung=mysql_error($config['dbconnection']); $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!="") if ($meldung!="")
{ {
$msg.='&gt; MySQL-Error: '.$meldung; $msg.='&gt; MySQL-Error: '.$meldung;
@ -38,8 +38,8 @@ switch ($sysaction)
break; break;
case 3: //FLUSH HOSTS case 3: //FLUSH HOSTS
$msg="&gt; operating FLUSH HOSTS<br>"; $msg="&gt; operating FLUSH HOSTS<br>";
$res=@mysql_query("FLUSH HOSTS",$config['dbconnection']); $res=@mysqli_query($config['dbconnection'], "FLUSH HOSTS");
$meldung=mysql_error($config['dbconnection']); $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!="") if ($meldung!="")
{ {
$msg.='&gt; MySQL-Error: '.$meldung; $msg.='&gt; MySQL-Error: '.$meldung;
@ -52,15 +52,15 @@ switch ($sysaction)
break; break;
case 4: //SHOW MASTER LOGS case 4: //SHOW MASTER LOGS
$msg="> operating SHOW MASTER LOGS<br>"; $msg="> operating SHOW MASTER LOGS<br>";
$res=@mysql_query("SHOW MASTER LOGS",$config['dbconnection']); $res=@mysqli_query($config['dbconnection'], "SHOW MASTER LOGS");
$meldung=mysql_error($config['dbconnection']); $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!="") if ($meldung!="")
{ {
$msg.='&gt; MySQL-Error: '.$meldung; $msg.='&gt; MySQL-Error: '.$meldung;
} }
else else
{ {
$numrows=mysql_num_rows($res); $numrows=mysqli_num_rows($res);
if ($numrows==0||$numrows===false) if ($numrows==0||$numrows===false)
{ {
$msg.='&gt; there are no master log-files'; $msg.='&gt; there are no master log-files';
@ -70,7 +70,7 @@ switch ($sysaction)
$msg.='&gt; there are '.$numrows.' logfiles<br>'; $msg.='&gt; there are '.$numrows.' logfiles<br>';
for ($i=0; $i<$numrows; $i++) for ($i=0; $i<$numrows; $i++)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
$msg.='&gt; '.$row[0].'&nbsp;&nbsp;&nbsp;'.(($data_dir) ? byte_output(@filesize($data_dir.$row[0])) : '').'<br>'; $msg.='&gt; '.$row[0].'&nbsp;&nbsp;&nbsp;'.(($data_dir) ? byte_output(@filesize($data_dir.$row[0])) : '').'<br>';
} }
} }
@ -78,8 +78,8 @@ switch ($sysaction)
break; break;
case 5: //RESET MASTER case 5: //RESET MASTER
$msg="&gt; operating RESET MASTER<br>"; $msg="&gt; operating RESET MASTER<br>";
$res=@mysql_query("RESET MASTER",$config['dbconnection']); $res=@mysqli_query($config['dbconnection'], "RESET MASTER");
$meldung=mysql_error($config['dbconnection']); $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!="") if ($meldung!="")
{ {
$msg.='&gt; MySQL-Error: '.$meldung; $msg.='&gt; MySQL-Error: '.$meldung;

Datei anzeigen

@ -254,22 +254,22 @@ function MSD_mysql_connect($encoding='utf8', $keycheck_off=false, $actual_table=
} }
$port=( isset($config['dbport']) && !empty($config['dbport']) ) ? ':' . $config['dbport'] : ''; $port=( isset($config['dbport']) && !empty($config['dbport']) ) ? ':' . $config['dbport'] : '';
$socket=( isset($config['dbsocket']) && !empty($config['dbsocket']) ) ? ':' . $config['dbsocket'] : ''; $socket=( isset($config['dbsocket']) && !empty($config['dbsocket']) ) ? ':' . $config['dbsocket'] : '';
$config['dbconnection']=@mysql_connect($config['dbhost'] . $port . $socket,$config['dbuser'],$config['dbpass']) or die(SQLError("Error establishing a database connection!", mysql_error())); $config['dbconnection']=@($GLOBALS["___mysqli_ston"] = mysqli_connect($config['dbhost'] . $port . $socket, $config['dbuser'], $config['dbpass'])) or die(SQLError("Error establishing a database connection!", ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
if (!defined('MSD_MYSQL_VERSION')) GetMySQLVersion(); if (!defined('MSD_MYSQL_VERSION')) GetMySQLVersion();
if (!isset($config['mysql_standard_character_set']) || $config['mysql_standard_character_set'] == '') get_sql_encodings(); if (!isset($config['mysql_standard_character_set']) || $config['mysql_standard_character_set'] == '') get_sql_encodings();
if ($config['mysql_standard_character_set'] != $encoding) if ($config['mysql_standard_character_set'] != $encoding)
{ {
$set_encoding=@mysql_query('SET NAMES \'' . $encoding . '\'',$config['dbconnection']); $set_encoding=@mysqli_query($config['dbconnection'], 'SET NAMES \'' . $encoding . '\'');
if ($set_encoding === false) $config['mysql_can_change_encoding']=false; if ($set_encoding === false) $config['mysql_can_change_encoding']=false;
else $config['mysql_can_change_encoding']=true; else $config['mysql_can_change_encoding']=true;
} }
if ($keycheck_off) { if ($keycheck_off) {
// only called with this param when restoring // only called with this param when restoring
mysql_query('SET FOREIGN_KEY_CHECKS=0',$config['dbconnection']); mysqli_query($config['dbconnection'], 'SET FOREIGN_KEY_CHECKS=0');
// also set SQL-Mode NO_AUTO_VALUE_ON_ZERO for magento users // also set SQL-Mode NO_AUTO_VALUE_ON_ZERO for magento users
mysql_query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"', $config['dbconnection']); mysqli_query( $config['dbconnection'], 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"');
} }
return $config['dbconnection']; return $config['dbconnection'];
} }
@ -277,7 +277,7 @@ function MSD_mysql_connect($encoding='utf8', $keycheck_off=false, $actual_table=
function GetMySQLVersion() function GetMySQLVersion()
{ {
$res=MSD_query("select version()"); $res=MSD_query("select version()");
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$version=$row[0]; $version=$row[0];
if (!defined('MSD_MYSQL_VERSION')) define('MSD_MYSQL_VERSION',$version); if (!defined('MSD_MYSQL_VERSION')) define('MSD_MYSQL_VERSION',$version);
$versions=explode('.',$version); $versions=explode('.',$version);
@ -293,8 +293,8 @@ function MSD_query($query, $error_output=true)
global $config; global $config;
if (!isset($config['dbconnection'])) MSD_mysql_connect(); if (!isset($config['dbconnection'])) MSD_mysql_connect();
//echo "<br>Query: ".htmlspecialchars($query); //echo "<br>Query: ".htmlspecialchars($query);
$res=mysql_query($query,$config['dbconnection']); $res=mysqli_query($config['dbconnection'], $query);
if (false === $res && $error_output) SQLError($query,mysql_error($config['dbconnection'])); if (false === $res && $error_output) SQLError($query,((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
return $res; return $res;
} }
@ -366,9 +366,9 @@ function Fieldlist($db, $tbl)
if ($res) if ($res)
{ {
$fl='('; $fl='(';
for ($i=0; $i < mysql_num_rows($res); $i++) for ($i=0; $i < mysqli_num_rows($res); $i++)
{ {
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
$fl.='`' . $row[0] . '`,'; $fl.='`' . $row[0] . '`,';
} }
$fl=substr($fl,0,strlen($fl) - 1) . ')'; $fl=substr($fl,0,strlen($fl) - 1) . ')';
@ -383,14 +383,14 @@ function getDBInfos()
for ($ii=0; $ii < count($databases['multi']); $ii++) for ($ii=0; $ii < count($databases['multi']); $ii++)
{ {
$dump['dbindex']=$flipped[$databases['multi'][$ii]]; $dump['dbindex']=$flipped[$databases['multi'][$ii]];
$tabellen=mysql_query('SHOW TABLE STATUS FROM `' . $databases['Name'][$dump['dbindex']] . '`',$config['dbconnection']) or die('getDBInfos: ' . mysql_error()); $tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLE STATUS FROM `' . $databases['Name'][$dump['dbindex']] . '`') or die('getDBInfos: ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
$num_tables=mysql_num_rows($tabellen); $num_tables=mysqli_num_rows($tabellen);
// Array mit den gewünschten Tabellen zusammenstellen... wenn Präfix angegeben, werden die anderen einfach nicht übernommen // Array mit den gewünschten Tabellen zusammenstellen... wenn Präfix angegeben, werden die anderen einfach nicht übernommen
if ($num_tables > 0) if ($num_tables > 0)
{ {
for ($i=0; $i < $num_tables; $i++) for ($i=0; $i < $num_tables; $i++)
{ {
$row=mysql_fetch_array($tabellen); $row=mysqli_fetch_array($tabellen);
if (isset($row['Type'])) $row['Engine']=$row['Type']; if (isset($row['Type'])) $row['Engine']=$row['Type'];
if (isset($row['Comment']) && substr(strtoupper($row['Comment']),0,4) == 'VIEW') $dump['table_types'][]='VIEW'; if (isset($row['Comment']) && substr(strtoupper($row['Comment']),0,4) == 'VIEW') $dump['table_types'][]='VIEW';
else $dump['table_types'][]=strtoupper($row['Engine']); else $dump['table_types'][]=strtoupper($row['Engine']);
@ -403,11 +403,11 @@ function getDBInfos()
} }
if ($config['optimize_tables_beforedump'] == 1 && $dump['table_offset'] == -1 if ($config['optimize_tables_beforedump'] == 1 && $dump['table_offset'] == -1
&& $databases['Name'][$dump['dbindex']]!='information_schema') { && $databases['Name'][$dump['dbindex']]!='information_schema') {
mysql_select_db($databases['Name'][$dump['dbindex']]); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dump['dbindex']]));
$opt = 'OPTIMIZE TABLE `' . $row['Name'] . '`'; $opt = 'OPTIMIZE TABLE `' . $row['Name'] . '`';
$res = mysql_query('OPTIMIZE TABLE `' . $row['Name'] . '`'); $res = mysqli_query($GLOBALS["___mysqli_ston"], 'OPTIMIZE TABLE `' . $row['Name'] . '`');
if ($res === false) { if ($res === false) {
die("Error in ".$opt." -> ".mysql_error()); die("Error in ".$opt." -> ".((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
} }
} }
@ -436,10 +436,10 @@ function getDBInfos()
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
$sql_2="SELECT count(*) as `count_records` FROM `" . $databases['Name'][$dump['dbindex']] . "`.`" . $row['Name'] . "`"; $sql_2="SELECT count(*) as `count_records` FROM `" . $databases['Name'][$dump['dbindex']] . "`.`" . $row['Name'] . "`";
$res2=@mysql_query($sql_2); $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
if ($res2 === false) if ($res2 === false)
{ {
$read_error='(' . mysql_errno() . ') ' . mysql_error(); $read_error='(' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_errno($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)) . ') ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
SQLError($read_error,$sql_2); SQLError($read_error,$sql_2);
WriteLog($read_error); WriteLog($read_error);
if ($config['stop_with_error'] > 0) if ($config['stop_with_error'] > 0)
@ -449,7 +449,7 @@ function getDBInfos()
} }
else else
{ {
$row2=@mysql_fetch_array($res2); $row2=@mysqli_fetch_array($res2);
$row['Rows']=$row2['count_records']; $row['Rows']=$row2['count_records'];
$dump['totalrecords']+=$row['Rows']; $dump['totalrecords']+=$row['Rows'];
} }

Datei anzeigen

@ -209,11 +209,11 @@ else
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
if ($res) if ($res)
{ {
$sql['export']['tablecount']=mysql_numrows($res); $sql['export']['tablecount']=mysqli_num_rows($res);
$sql['export']['recordcount']=0; $sql['export']['recordcount']=0;
for ($i=0; $i < $sql['export']['tablecount']; $i++) for ($i=0; $i < $sql['export']['tablecount']; $i++)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
$tblstr.='<option value="' . $row['Name'] . '" ' . ( ( isset($sql['export']['tables']) && in_array($row['Name'],$sql['export']['tables']) ) ? "selected" : "" ) . '>' . $row['Name'] . ' (' . $row['Rows'] . ')</option>' . "\n"; $tblstr.='<option value="' . $row['Name'] . '" ' . ( ( isset($sql['export']['tables']) && in_array($row['Name'],$sql['export']['tables']) ) ? "selected" : "" ) . '>' . $row['Name'] . ' (' . $row['Rows'] . ')</option>' . "\n";
$sql['export']['recordcount']+=$row['Rows']; $sql['export']['recordcount']+=$row['Rows'];
} }

Datei anzeigen

@ -4,10 +4,10 @@ if (!defined('MSD_VERSION')) die('No direct access.');
$sql='SHOW TABLES FROM `'.$db.'`'; $sql='SHOW TABLES FROM `'.$db.'`';
$tables=ARRAY(); $tables=ARRAY();
$link=MSD_mysql_connect(); $link=MSD_mysql_connect();
$res=mysql_query($sql,$link); $res=mysqli_query($link, $sql);
if (!$res===false) if (!$res===false)
{ {
WHILE ($row=mysql_fetch_array($res,MYSQL_NUM)) WHILE ($row=mysqli_fetch_array($res, MYSQLI_NUM))
{ {
$tables[]=$row[0]; $tables[]=$row[0];
} }
@ -70,12 +70,12 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl
// Felder ermitteln // Felder ermitteln
$sql='SHOW COLUMNS FROM `'.$db.'`.`'.$tables[$tabelle].'`'; $sql='SHOW COLUMNS FROM `'.$db.'`.`'.$tables[$tabelle].'`';
$res=mysql_query($sql,$link); $res=mysqli_query($link, $sql);
unset($felder); unset($felder);
if (!$res===false) if (!$res===false)
{ {
// Felder der Tabelle ermitteln // Felder der Tabelle ermitteln
WHILE ($row=mysql_fetch_object($res)) WHILE ($row=mysqli_fetch_object($res))
{ {
$felder[]=$row->Field; $felder[]=$row->Field;
} }
@ -130,10 +130,10 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl
else else
$sql='SELECT * FROM `'.$db.'`.`'.$tables[$tabelle].'` LIMIT '.$offset.','.$anzahl_ergebnisse; $sql='SELECT * FROM `'.$db.'`.`'.$tables[$tabelle].'` LIMIT '.$offset.','.$anzahl_ergebnisse;
$res=@mysql_query($sql,$link); $res=@mysqli_query($link, $sql);
if ($res) if ($res)
{ {
WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
{ {
//Treffer markieren //Treffer markieren
foreach ($row as $key=>$val) foreach ($row as $key=>$val)

Datei anzeigen

@ -100,7 +100,7 @@ else
$res=@MSD_query($sql_temp,false); $res=@MSD_query($sql_temp,false);
if ($res) if ($res)
{ {
if ($row=mysql_fetch_object($res)) if ($row=mysqli_fetch_object($res))
{ {
$numrowsabs=$row->anzahl; $numrowsabs=$row->anzahl;
} }
@ -116,7 +116,7 @@ else
$sqltmp=$sql['sql_statement'] . $sql['order_statement'] . ( strpos(strtolower($sql['sql_statement'] . $sql['order_statement']),' limit ') ? '' : $limit ); $sqltmp=$sql['sql_statement'] . $sql['order_statement'] . ( strpos(strtolower($sql['sql_statement'] . $sql['order_statement']),' limit ') ? '' : $limit );
if (!$skip_mysql_execution) $res=MSD_query($sqltmp); if (!$skip_mysql_execution) $res=MSD_query($sqltmp);
$numrows=@mysql_num_rows($res); $numrows=@mysqli_num_rows($res);
if ($numrowsabs == -1) $numrowsabs=$numrows; if ($numrowsabs == -1) $numrowsabs=$numrows;
if ($limitende > $numrowsabs) $limitende=$numrowsabs; if ($limitende > $numrowsabs) $limitende=$numrowsabs;
@ -149,7 +149,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1)
{ {
//Infos und Header holen //Infos und Header holen
//1.Datensatz fuer Feldinfos //1.Datensatz fuer Feldinfos
$row=mysql_fetch_row($res); $row=mysqli_fetch_row($res);
//Kompaktmodus-Switcher //Kompaktmodus-Switcher
$t='<td colspan="' . ( count($row) + 1 ) . '" align="left"><a href="sql.php?db=' . $db . '&amp;tablename=' . $tablename . '&amp;dbid=' . $dbid . '&amp;order=' . urlencode($order) . '&amp;orderdir=' . $orderdir . '&amp;limitstart=' . $limitstart . '&amp;sql_statement=' . urlencode($sql['sql_statement']) . '&amp;tdc=' . ( ( $tdcompact == 0 ) ? '1' : '0' ) . '">' . ( ( $tdcompact == 1 ) ? $lang['L_SQL_VIEW_STANDARD'] : $lang['L_SQL_VIEW_COMPACT'] ) . '</a>'; $t='<td colspan="' . ( count($row) + 1 ) . '" align="left"><a href="sql.php?db=' . $db . '&amp;tablename=' . $tablename . '&amp;dbid=' . $dbid . '&amp;order=' . urlencode($order) . '&amp;orderdir=' . $orderdir . '&amp;limitstart=' . $limitstart . '&amp;sql_statement=' . urlencode($sql['sql_statement']) . '&amp;tdc=' . ( ( $tdcompact == 0 ) ? '1' : '0' ) . '">' . ( ( $tdcompact == 1 ) ? $lang['L_SQL_VIEW_STANDARD'] : $lang['L_SQL_VIEW_COMPACT'] ) . '</a>';
$t.='&nbsp;&nbsp;&nbsp;' . $lang['L_SQL_QUERYENTRY'] . ' ' . count($row) . ' ' . $lang['L_SQL_COLUMNS']; $t.='&nbsp;&nbsp;&nbsp;' . $lang['L_SQL_QUERYENTRY'] . ' ' . count($row) . ' ' . $lang['L_SQL_COLUMNS'];
@ -159,7 +159,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1)
for ($x=0; $x < count($row); $x++) for ($x=0; $x < count($row); $x++)
{ {
$temp[$x]['data']=mysql_fetch_field($res,$x); $temp[$x]['data']=(((($___mysqli_tmp = mysqli_fetch_field_direct($res, 0)) && is_object($___mysqli_tmp)) ? ( (!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && (!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && (!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && (!is_null($___mysqli_type = $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0)) ) : false ) ? $___mysqli_tmp : false);
$temp[$x]['sort']=add_sortkey($temp[$x]['data']->name); $temp[$x]['sort']=add_sortkey($temp[$x]['data']->name);
} }
@ -214,14 +214,14 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1)
$temp=array(); $temp=array();
//und jetzt Daten holen //und jetzt Daten holen
mysql_data_seek($res,0); mysqli_data_seek($res, 0);
$s=$keysort; $s=$keysort;
$s=array_flip($keysort); $s=array_flip($keysort);
ksort($s); ksort($s);
for ($i=0; $i < $numrows; $i++) for ($i=0; $i < $numrows; $i++)
{ {
$data[0]=mysql_fetch_array($res,MYSQL_ASSOC); $data[0]=mysqli_fetch_array($res, MYSQLI_ASSOC);
if ($showtables == 1 && $tabellenansicht == 1) if ($showtables == 1 && $tabellenansicht == 1)
{ {
// Spalten sortieren, wenn wir uns in einer Tabellenuebersicht befinden // Spalten sortieren, wenn wir uns in einer Tabellenuebersicht befinden

Datei anzeigen

@ -6,12 +6,12 @@ $tpl->set_filenames(array(
$sqledit="SHOW FIELDS FROM `$tablename`"; $sqledit="SHOW FIELDS FROM `$tablename`";
$res=MSD_query($sqledit); $res=MSD_query($sqledit);
$num=mysql_numrows($res); $num=mysqli_num_rows($res);
$feldnamen=""; $feldnamen="";
for ($x=0; $x<$num; $x++) for ($x=0; $x<$num; $x++)
{ {
$row=mysql_fetch_object($res); $row=mysqli_fetch_object($res);
$feldnamen.=$row->Field.'|'; $feldnamen.=$row->Field.'|';
$tpl->assign_block_vars('ROW',array( $tpl->assign_block_vars('ROW',array(
'CLASS' => ($x%2) ? 1 : 2, 'CLASS' => ($x%2) ? 1 : 2,

Datei anzeigen

@ -9,7 +9,7 @@ $fields=getExtendedFieldInfo($db,$tablename);
$sqledit="SELECT * FROM `$tablename` WHERE ".$recordkey; $sqledit="SELECT * FROM `$tablename` WHERE ".$recordkey;
$res=MSD_query($sqledit); $res=MSD_query($sqledit);
$record=mysql_fetch_array($res,MYSQL_ASSOC); // get the record $record=mysqli_fetch_array($res, MYSQLI_ASSOC); // get the record
$num=sizeof($record); // get the nr of fields of the record $num=sizeof($record); // get the nr of fields of the record

Datei anzeigen

@ -278,10 +278,10 @@ if (isset($_POST['newfield_posted']))
$fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name); $fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name);
} }
} }
mysql_select_db($databases['Name'][$dbid]); ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dbid]));
$sqlt="SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."` ;"; $sqlt="SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."` ;";
$res=MSD_query($sqlt); $res=MSD_query($sqlt);
$anz_tabellen=mysql_numrows($res); $anz_tabellen=mysqli_num_rows($res);
$p="sql.php?db=".$databases['Name'][$dbid]."&amp;dbid=$dbid&amp;tablename=$table_edit_name&amp;context=2"; $p="sql.php?db=".$databases['Name'][$dbid]."&amp;dbid=$dbid&amp;tablename=$table_edit_name&amp;context=2";
echo '<form action="sql.php?db='.$databases['Name'][$dbid].'&amp;dbid='.$dbid.'&amp;tablename='.$table_edit_name.'&amp;context=2" method="post">'; echo '<form action="sql.php?db='.$databases['Name'][$dbid].'&amp;dbid='.$dbid.'&amp;tablename='.$table_edit_name.'&amp;context=2" method="post">';
@ -299,7 +299,7 @@ else
echo '<td colspan="2"><select name="tableselect" onchange="this.form.submit()"><option value="1" SELECTED></option>'; echo '<td colspan="2"><select name="tableselect" onchange="this.form.submit()"><option value="1" SELECTED></option>';
for ($i=0; $i<$anz_tabellen; $i++) for ($i=0; $i<$anz_tabellen; $i++)
{ {
$row=mysql_fetch_array($res); $row=mysqli_fetch_array($res);
echo '<option value="'.$row['Name'].'">'.$row['Name'].'</option>'; echo '<option value="'.$row['Name'].'">'.$row['Name'].'</option>';
} }
echo '</select>&nbsp;&nbsp;</td>'; echo '</select>&nbsp;&nbsp;</td>';
@ -310,7 +310,7 @@ if ($table_edit_name!="")
{ {
$sqlf="SHOW FULL FIELDS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name` ;"; $sqlf="SHOW FULL FIELDS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name` ;";
$res=MSD_query($sqlf); $res=MSD_query($sqlf);
$anz_fields=mysql_num_rows($res); $anz_fields=mysqli_num_rows($res);
$fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name); $fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name);
if (MSD_NEW_VERSION) $t_engine=(isset($fields_infos['_tableinfo_']['ENGINE'])) ? $fields_infos['_tableinfo_']['ENGINE'] : "MyISAM"; if (MSD_NEW_VERSION) $t_engine=(isset($fields_infos['_tableinfo_']['ENGINE'])) ? $fields_infos['_tableinfo_']['ENGINE'] : "MyISAM";
@ -462,7 +462,7 @@ if ($table_edit_name!="")
</tr>'; </tr>';
$sqlk="SHOW KEYS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name`;"; $sqlk="SHOW KEYS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name`;";
$res=MSD_query($sqlk); $res=MSD_query($sqlk);
$num=mysql_numrows($res); $num=mysqli_num_rows($res);
if ($num==0) if ($num==0)
{ {
echo '<tr><td colspan="6">'.$lang['L_SQL_TABLENOINDEXES'].'</td></tr>'; echo '<tr><td colspan="6">'.$lang['L_SQL_TABLENOINDEXES'].'</td></tr>';
@ -471,7 +471,7 @@ if ($table_edit_name!="")
{ {
for ($i=0; $i<$num; $i++) for ($i=0; $i<$num; $i++)
{ {
$row=mysql_fetch_array($res,MYSQL_ASSOC); $row=mysqli_fetch_array($res, MYSQLI_ASSOC);
if (!isset($row['Comment'])) { if (!isset($row['Comment'])) {
$row['Comment'] = ''; $row['Comment'] = '';
} }
@ -535,7 +535,7 @@ if ($table_edit_name!="")
//body //body
$sqlFelder="DESCRIBE `".$databases['Name'][$dbid]."`.`".$_GET['tablename']."`;"; $sqlFelder="DESCRIBE `".$databases['Name'][$dbid]."`.`".$_GET['tablename']."`;";
$res=MSD_query($sqlFelder); $res=MSD_query($sqlFelder);
$num=mysql_numrows($res); $num=mysqli_num_rows($res);
if ($num==0) if ($num==0)
{ {
echo '<tr><td>'.$lang['L_SQL_TABLENOINDEXES'].'</td></tr>'; echo '<tr><td>'.$lang['L_SQL_TABLENOINDEXES'].'</td></tr>';
@ -554,7 +554,7 @@ if ($table_edit_name!="")
echo '<table class="bdr">'; echo '<table class="bdr">';
echo '<tr class="thead"><th>#</th><th>'.$lang['L_PRIMARYKEY_FIELD'].'</th><th>'.$lang['L_INFO_SIZE'].'</th>'; echo '<tr class="thead"><th>#</th><th>'.$lang['L_PRIMARYKEY_FIELD'].'</th><th>'.$lang['L_INFO_SIZE'].'</th>';
while ($row=mysql_fetch_array($res, MYSQL_ASSOC)) while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
{ {
$feldArray[$row['Field']]=$row['Type']; $feldArray[$row['Field']]=$row['Type'];
} }

Datei anzeigen

@ -21,24 +21,24 @@ if ($tblr == 'Backup')
$button_name='dump_tbl'; $button_name='dump_tbl';
//Info aus der Datenbank lesen //Info aus der Datenbank lesen
MSD_mysql_connect(); MSD_mysql_connect();
$res=mysql_query('SHOW TABLE STATUS FROM `' . $databases['db_actual'] . '`'); $res=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW TABLE STATUS FROM `' . $databases['db_actual'] . '`');
$numrows=mysql_num_rows($res); $numrows=mysqli_num_rows($res);
$tbl_zeile=''; $tbl_zeile='';
for ($i=0; $i < $numrows; $i++) for ($i=0; $i < $numrows; $i++)
{ {
$row=mysql_fetch_array($res,MYSQL_ASSOC); $row=mysqli_fetch_array($res, MYSQLI_ASSOC);
//v($row); //v($row);
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs // Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
$sql_2="SELECT count(*) as `count_records` FROM `" . $databases['db_actual'] . "`.`" . $row['Name'] . "`"; $sql_2="SELECT count(*) as `count_records` FROM `" . $databases['db_actual'] . "`.`" . $row['Name'] . "`";
$res2=@mysql_query($sql_2); $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
if ($res2 === false) if ($res2 === false)
{ {
$read_error='(' . mysql_errno() . ') ' . mysql_error(); $read_error='(' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_errno($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)) . ') ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
$row['Rows']='<span class="error">' . $lang['L_ERROR'] . ': ' . $read_error . '</span>'; $row['Rows']='<span class="error">' . $lang['L_ERROR'] . ': ' . $read_error . '</span>';
} }
else else
{ {
$row2=@mysql_fetch_array($res2); $row2=@mysqli_fetch_array($res2);
$row['Rows']=$row2['count_records']; $row['Rows']=$row2['count_records'];
} }

Datei anzeigen

@ -44,7 +44,7 @@ foreach ($configFiles as $configFile) {
include($config['paths']['config'] . $configFile . '.php'); include($config['paths']['config'] . $configFile . '.php');
$out = ''; $out = '';
if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) { if (isset($config['dbconnection']) && is_resource($config['dbconnection'])) {
mysql_close($config['dbconnection']); ((is_null($___mysqli_res = mysqli_close($config['dbconnection']))) ? false : $___mysqli_res);
$config['dbconnection'] = false; $config['dbconnection'] = false;
} }
SetDefault(); SetDefault();
@ -61,4 +61,4 @@ function output($message, $verbose)
$message = str_replace("\n", NEWLINE, $message); $message = str_replace("\n", NEWLINE, $message);
echo $message . NEWLINE; echo $message . NEWLINE;
} }
} }

Datei anzeigen

@ -78,7 +78,7 @@ $pageheader=MSDheader().headline($lang['L_RESTORE']);
$aus1=$page_parameter=''; $aus1=$page_parameter='';
$RestoreFertig=$eingetragen=$dauer=$filegroesse=0; $RestoreFertig=$eingetragen=$dauer=$filegroesse=0;
MSD_mysql_connect($restore['dump_encoding'],true,$restore['actual_table']); MSD_mysql_connect($restore['dump_encoding'],true,$restore['actual_table']);
@mysql_select_db($databases['db_actual']) or die($lang['L_DB_SELECT_ERROR'].$databases['db_actual'].$lang['L_DB_SELECT_ERROR2']); @((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['db_actual'])) or die($lang['L_DB_SELECT_ERROR'].$databases['db_actual'].$lang['L_DB_SELECT_ERROR2']);
// open backup file // open backup file
$restore['filehandle']=($restore['compressed']==1) ? gzopen($config['paths']['backup'].$restore['filename'],'r') : fopen($config['paths']['backup'].$restore['filename'],'r'); $restore['filehandle']=($restore['compressed']==1) ? gzopen($config['paths']['backup'].$restore['filename'],'r') : fopen($config['paths']['backup'].$restore['filename'],'r');
@ -118,9 +118,9 @@ if ($restore['filehandle'])
// Disable Keys of actual table to speed up restoring // Disable Keys of actual table to speed up restoring
if (is_array($restore['tables_to_restore'])&&sizeof($restore['tables_to_restore'])>0&&in_array($restore['actual_table'],$restore['tables_to_restore'])) if (is_array($restore['tables_to_restore'])&&sizeof($restore['tables_to_restore'])>0&&in_array($restore['actual_table'],$restore['tables_to_restore']))
{ {
@mysql_query('/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;',$config['dbconnection']); @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;');
} }
elseif (sizeof($restore['tables_to_restore'])==0&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysql_query('/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;',$config['dbconnection']); elseif (sizeof($restore['tables_to_restore'])==0&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;');
WHILE (($a<$restore['anzahl_zeilen'])&&(!$restore['fileEOF'])&&($dauer<$restore['max_zeit'])&&!$restore['EOB']) WHILE (($a<$restore['anzahl_zeilen'])&&(!$restore['fileEOF'])&&($dauer<$restore['max_zeit'])&&!$restore['EOB'])
{ {
@ -128,22 +128,22 @@ if ($restore['filehandle'])
if ($sql_command>'') if ($sql_command>'')
{ {
//WriteLog(htmlspecialchars($sql_command)); //WriteLog(htmlspecialchars($sql_command));
$res=mysql_query($sql_command,$config['dbconnection']); $res=mysqli_query($config['dbconnection'], $sql_command);
if (!$res===false) if (!$res===false)
{ {
$anzsql=mysql_affected_rows($config['dbconnection']); $anzsql=mysqli_affected_rows($config['dbconnection']);
// Anzahl der eingetragenen Datensaetze ermitteln (Indexaktionen nicht zaehlen) // Anzahl der eingetragenen Datensaetze ermitteln (Indexaktionen nicht zaehlen)
$command=strtoupper(substr($sql_command,0,7)); $command=strtoupper(substr($sql_command,0,7));
if ($command=='INSERT ') if ($command=='INSERT ')
{ {
$anzsql=mysql_affected_rows($config['dbconnection']); $anzsql=mysqli_affected_rows($config['dbconnection']);
if ($anzsql>0) $restore['eintraege_ready']+=$anzsql; if ($anzsql>0) $restore['eintraege_ready']+=$anzsql;
} }
} }
else else
{ {
// Bei MySQL-Fehlern sofort abbrechen und Info ausgeben // Bei MySQL-Fehlern sofort abbrechen und Info ausgeben
$meldung=@mysql_error($config['dbconnection']); $meldung=@((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!='') if ($meldung!='')
{ {
if (strtolower(substr($meldung,0,15))=='duplicate entry') if (strtolower(substr($meldung,0,15))=='duplicate entry')

Datei anzeigen

@ -124,7 +124,7 @@ if ($sql_to_display_data==1)
if (isset($_POST['tableselect'])&&$_POST['tableselect']!='1') $tablename=$_POST['tableselect']; if (isset($_POST['tableselect'])&&$_POST['tableselect']!='1') $tablename=$_POST['tableselect'];
MSD_mysql_connect(); MSD_mysql_connect();
mysql_select_db($db,$config['dbconnection']); ((bool)mysqli_query($config['dbconnection'], "USE " . $db));
///*** EDIT / UPDATES / INSERTS ***/// ///*** EDIT / UPDATES / INSERTS ***///
///*** ***/// ///*** ***///