From 5b995d339da87a21a281cef4f1a9fef92f5b07b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Rosen=C3=B6gger?= Date: Mon, 1 Feb 2016 20:02:15 +0100 Subject: [PATCH] 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 --- config_overview.php | 2 +- dump.php | 2 +- inc/functions.php | 22 +++--- inc/functions_dump.php | 40 +++++----- inc/functions_global.php | 30 ++++---- inc/functions_imexport.php | 36 ++++----- inc/functions_restore.php | 14 ++-- inc/functions_sql.php | 70 +++++++++--------- inc/home/databases.php | 42 +++++------ inc/home/mysql_variables.php | 20 ++--- inc/home/protection_delete.php | Bin 243 -> 243 bytes inc/home/system.php | 28 +++---- inc/mysql.php | 36 ++++----- inc/sql_importexport.php | 4 +- inc/sqlbrowser/mysql_search.php | 12 +-- inc/sqlbrowser/sql_dataview.php | 12 +-- .../sql_record_insert_inputmask.php | 4 +- .../sql_record_update_inputmask.php | 2 +- inc/sqlbrowser/sql_tables.php | 16 ++-- inc/tabellenabfrage.php | 12 +-- refresh_dblist.php | 4 +- restore.php | 14 ++-- sql.php | 2 +- 23 files changed, 210 insertions(+), 214 deletions(-) diff --git a/config_overview.php b/config_overview.php index c81ab69..e04820b 100644 --- a/config_overview.php +++ b/config_overview.php @@ -355,7 +355,7 @@ if (isset($_POST['save'])) { if (MSD_mysql_connect()) { - $res=@mysql_selectdb($to_add,$config['dbconnection']); + $res=@((bool)mysqli_query($config['dbconnection'], "USE " . $to_add)); if (!$res === false) { $databases['Name'][] = $to_add; diff --git a/dump.php b/dump.php index e26c3aa..9296166 100644 --- a/dump.php +++ b/dump.php @@ -217,7 +217,7 @@ else { WriteToDumpFile(); // save data we have up to now // 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); WriteLog($read_create_error); if ($config['stop_with_error']>0) diff --git a/inc/functions.php b/inc/functions.php index 85a1ab5..f4f031a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -162,8 +162,8 @@ function SetDefault($load_default = false) //DB-Liste holen MSD_mysql_connect(); - $res = mysql_query('SHOW DATABASES', $config['dbconnection']); - WHILE ($row = mysql_fetch_row($res)) { + $res = mysqli_query( $config['dbconnection'], 'SHOW DATABASES'); + WHILE ($row = mysqli_fetch_row($res)) { $found_dbs[] = $row[0]; } $found_dbs = array_merge($oldDbArray, $found_dbs); @@ -173,7 +173,7 @@ function SetDefault($load_default = false) $a = 0; for ($i = 0; $i < count($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 (isset($old_db) && $found_db == $old_db) { $databases['db_selected_index'] = $a; @@ -703,9 +703,9 @@ function SearchDatabases($printout, $db = '') $db_list[] = $db; // DB wurde manuell angegeben } // Datenbanken automatisch erkennen - $show_dbs = mysql_query("SHOW DATABASES", $config['dbconnection']); + $show_dbs = mysqli_query( $config['dbconnection'], "SHOW DATABASES"); if (!$show_dbs === false) { - WHILE ($row = mysql_fetch_row($show_dbs)) { + WHILE ($row = mysqli_fetch_row($show_dbs)) { if (trim($row[0]) > '') { $db_list[] = $row[0]; } @@ -717,7 +717,7 @@ function SearchDatabases($printout, $db = '') $databases['db_selected_index'] = 0; for ($i = 0; $i < sizeof($db_list); $i++) { // 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['praefix'][$i] = ''; $databases['command_before_dump'][$i] = ''; @@ -789,14 +789,10 @@ function my_quotes($value) function db_escape($string) { global $config; - if (function_exists('mysql_real_escape_string')) { - $string = mysql_real_escape_string($string, $config['dbconnection']); + if (function_exists('mysqli_real_escape_string')) { + $string = mysqli_real_escape_string( $config['dbconnection'], $string); } else { - if (function_exists('mysql_escape_string')) { - $string = mysql_escape_string($string, $config['dbconnection']); - } else { - $string = addslashes($string); - } + $string = addslashes($string); } return $string; diff --git a/inc/functions_dump.php b/inc/functions_dump.php index 8c2b233..1a30aea 100644 --- a/inc/functions_dump.php +++ b/inc/functions_dump.php @@ -72,18 +72,18 @@ function GetStatusLine($kind="php") $r=0; $t_zeile="$mysql_commentstring\n$mysql_commentstring TABLE-INFO\r\n"; MSD_mysql_connect(); - $res=mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`"); - $numrows=intval(@mysql_num_rows($res)); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dump['dbindex']]."`"); + $numrows=intval(@mysqli_num_rows($res)); 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 $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) { // 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); WriteLog($read_create_error); if ($config['stop_with_error']>0) @@ -95,7 +95,7 @@ function GetStatusLine($kind="php") } else { - $row2=mysql_fetch_array($res2); + $row2=mysqli_fetch_array($res2); $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']])) @@ -129,9 +129,9 @@ function get_def($db,$table,$withdata=1) } else $def.="DROP TABLE IF EXISTS `$table`;\n"; - mysql_select_db($db); - $result=mysql_query('SHOW CREATE TABLE `'.$table.'`',$config['dbconnection']); - $row=@mysql_fetch_row($result); + ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $db)); + $result=mysqli_query($config['dbconnection'], 'SHOW CREATE TABLE `'.$table.'`'); + $row=@mysqli_fetch_row($result); if ($row===false) return false; $def.=$row[1].';'."\n\n"; if ($withdata==1) @@ -152,12 +152,12 @@ function get_content($db,$table) $table_ready=0; $query='SELECT * FROM `'.$table.'` LIMIT '.$dump['zeilen_offset'].','.($dump['restzeilen']+1); - mysql_select_db($db); - $result=mysql_query($query,$config['dbconnection']); - $ergebnisse=@mysql_num_rows($result); + ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $db)); + $result=mysqli_query($config['dbconnection'], $query); + $ergebnisse=@mysqli_num_rows($result); if ($ergebnisse!==false) { - $num_felder=mysql_num_fields($result); + $num_felder=(($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false); $first=1; if ($ergebnisse>$dump['restzeilen']) @@ -176,7 +176,7 @@ function get_content($db,$table) $ax=0; for($x=0;$x<$ergebnisse;$x++) { - $row=mysql_fetch_row($result); + $row=mysqli_fetch_row($result); $ax++; $insert='INSERT INTO `'.$table.'` '.$complete.'VALUES ('; @@ -185,7 +185,7 @@ function get_content($db,$table) { if (!isset($row[$j])) $insert.='NULL,'; 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 $insert.='\'\','; } @@ -211,7 +211,7 @@ function get_content($db,$table) WriteToDumpFile(); } } - @mysql_free_result($result); + @((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false); } function WriteToDumpFile() @@ -275,7 +275,7 @@ function ExecuteCommand($when) if (substr(strtolower($cd),0,7)!='system:') { $cad=array(); - @mysql_select_db($databases['Name'][$dump['dbindex']]); + @((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dump['dbindex']])); if (strpos($cd,';')) { $cad=explode(';',$cd); @@ -287,12 +287,12 @@ function ExecuteCommand($when) { if (trim($cad[$i])>'') { - $result=@mysql_query($cad[$i],$config['dbconnection']); + $result=@mysqli_query($config['dbconnection'], $cad[$i]); if ($result===false) { - WriteLog("Error executing Query '$cad[$i]'! MySQL returns: ".trim(mysql_error())); - ErrorLog("Error executing Query '$cad[$i]'!",$databases['Name'][$dump['dbindex']],$cad[$i],mysql_error(),0); + 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],((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)),0); $dump['errors']++; $out.='Error executing Query '.$cad[$i].''.$lf; } diff --git a/inc/functions_global.php b/inc/functions_global.php index 1e2cc88..f35ae3e 100644 --- a/inc/functions_global.php +++ b/inc/functions_global.php @@ -114,14 +114,14 @@ function DBDetailInfo($index) MSD_mysql_connect(); 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]; - $res=@mysql_query('SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`'); - if ($res) $databases['Detailinfo']['tables']=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`'); + if ($res) $databases['Detailinfo']['tables']=mysqli_num_rows($res); if ($databases['Detailinfo']['tables']>0) { $s1=$s2=0; - while ($row= mysql_fetch_array($res, MYSQL_ASSOC)) + while ($row= mysqli_fetch_array($res, MYSQLI_ASSOC)) { $s1+=$row['Rows']; $s2+=$row['Data_length']+$row['Index_length']; @@ -423,9 +423,9 @@ function EmptyDB($dbn) { global $config; $t_sql=array(); - @mysql_query('SET FOREIGN_KEY_CHECKS=0'); - $res=mysql_query('SHOW TABLE STATUS FROM `'.$dbn.'`',$config['dbconnection']) or die('EmptyDB: '.mysql_error()); - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + @mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=0'); + $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=mysqli_fetch_array($res, MYSQLI_ASSOC)) { if (substr(strtoupper($row['Comment']),0,4)=='VIEW') { @@ -440,10 +440,10 @@ function EmptyDB($dbn) { for ($i=0; $i= 4.1 $config['mysql_can_change_encoding']=true; $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) { - WHILE ($row=mysql_fetch_row($res)) + WHILE ($row=mysqli_fetch_row($res)) { $config['mysql_possible_character_sets'][]=$row[0].' - '.$row[1]; } @@ -1219,11 +1219,11 @@ function get_sql_encodings() } $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) { - WHILE ($row=mysql_fetch_row($res)) + WHILE ($row=mysqli_fetch_row($res)) { $config['mysql_standard_character_set']=$row[1]; } diff --git a/inc/functions_imexport.php b/inc/functions_imexport.php index 5834497..7cf7008 100644 --- a/inc/functions_imexport.php +++ b/inc/functions_imexport.php @@ -38,12 +38,12 @@ function ExportCSV() $res=MSD_query($sqlt); if ($res) { - $numfields=mysql_numrows($res); + $numfields=mysqli_num_rows($res); if ($sql['export']['namefirstline'] == 1) { 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'] : '' ); else $t.=$row[0] . ( ( $feld + 1 < $numfields ) ? $sql['export']['trenn'] : '' ); } @@ -55,10 +55,10 @@ function ExportCSV() $res=MSD_query($sqlt); if ($res) { - $numrows=mysql_numrows($res); + $numrows=mysqli_num_rows($res); for ($data=0; $data < $numrows; $data++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); for ($feld=0; $feld < $numfields; $feld++) { if (!isset($row[$feld]) || is_null($row[$feld])) @@ -145,7 +145,7 @@ function DoImport() if ($sql['import']['tablecreate'] == 0) { $res=MSD_query("show fields FROM " . $sql['import']['table']); - $tabellenfelder=mysql_num_rows($res); + $tabellenfelder=mysqli_num_rows($res); if ($importfelder != $tabellenfelder) { $r.='
' . sprintf($lang['L_CSV_FIELDCOUNT_NOMATCH'],$tabellenfelder,$importfelder); @@ -206,11 +206,11 @@ function ImportCreateTable() { global $sql,$lang,$db,$config; $tbl=Array(); - $tabellen=mysql_list_tables($db,$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM $db"); + $num_tables=mysqli_num_rows($tabellen); 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; $sql['import']['table']=$sql['import']['table'] . $i; @@ -237,7 +237,7 @@ function ImportCreateTable() 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") . "'"; - $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; } @@ -258,13 +258,13 @@ function ExportXML() $res=MSD_query($sqlt); if ($res) { - $numfields=mysql_num_rows($res); + $numfields=mysqli_num_rows($res); if ($sql['export']['xmlstructure'] == 1) { $t.=str_repeat($tab,$level++) . '' . "\n"; for ($feld=0; $feld < $numfields; $feld++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $t.=str_repeat($tab,$level++) . '' . "\n"; $t.=str_repeat($tab,$level) . '' . $row['Field'] . '' . "\n"; $t.=str_repeat($tab,$level) . '' . $row['Type'] . '' . "\n"; @@ -282,12 +282,12 @@ function ExportXML() $res=MSD_query($sqlt); if ($res) { - $numrows=mysql_numrows($res); + $numrows=mysqli_num_rows($res); for ($data=0; $data < $numrows; $data++) { $t.=str_repeat($tab,$level) . "\n"; $level++; - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); for ($feld=0; $feld < $numfields; $feld++) { $t.=str_repeat($tab,$level) . '' . $row[$feld] . '' . "\n"; @@ -336,10 +336,10 @@ function ExportHTML() { $field=$fieldname=$fieldtyp=Array(); $structure="\n"; - $numfields=mysql_numrows($res); + $numfields=mysqli_num_rows($res); for ($feld=0; $feld < $numfields; $feld++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $field[$feld]=$row[0]; if ($feld == 0) @@ -347,7 +347,7 @@ function ExportHTML() $structure.="\n"; 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; $fieldtyp[$i]=$str->type; $structure.="\n"; @@ -369,7 +369,7 @@ function ExportHTML() $res=MSD_query($dsql); if ($res) { - $anz=mysql_num_rows($res); + $anz=mysqli_num_rows($res); $content.="

Daten ($anz Datensätze)

\n"; $content.="
" . $str->name . "
\n"; for ($feld=0; $feld < count($field); $feld++) @@ -386,7 +386,7 @@ function ExportHTML() } for ($d=0; $d < $anz; $d++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $content.="\n"; for ($i=0; $i < count($row); $i++) { diff --git a/inc/functions_restore.php b/inc/functions_restore.php index 749f5c4..04bdc17 100644 --- a/inc/functions_restore.php +++ b/inc/functions_restore.php @@ -276,23 +276,23 @@ function submit_create_action($sql) } } - $res=@mysql_query($sql); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], $sql); if ($res===false) { // erster Versuch fehlgeschlagen -> zweiter Versuch - vielleicht versteht der Server die Inline-Kommentare nicht? $sql=del_inline_comments($sql); - $res=@mysql_query(downgrade($sql)); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql)); if ($res===false) { // wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x? // versuchen wir es mal mit der alten Syntax - $res=@mysql_query(downgrade($sql)); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql)); } } if ($res===false) { // 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("
Fatal error: Couldn't create table or view `".$tablename."´"); } return $tablename; @@ -302,11 +302,11 @@ function get_insert_syntax($table) { $insert=''; $sql='SHOW COLUMNS FROM `'.$table.'`'; - $res=mysql_query($sql); + $res=mysqli_query($GLOBALS["___mysqli_ston"], $sql); if ($res) { $insert='INSERT INTO `'.$table.'` ('; - while ($row=mysql_fetch_object($res)) + while ($row=mysqli_fetch_object($res)) { $insert.='`'.$row->Field.'`,'; } @@ -316,7 +316,7 @@ function get_insert_syntax($table) { global $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; } diff --git a/inc/functions_sql.php b/inc/functions_sql.php index 2f28dbd..aba3d00 100644 --- a/inc/functions_sql.php +++ b/inc/functions_sql.php @@ -79,15 +79,15 @@ function SQL_ComboBox() function Table_ComboBox() { 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; if (is_resource($tabellen)) { - $num_tables=mysql_num_rows($tabellen); + $num_tables=mysqli_num_rows($tabellen); } $s=$nl . $nl . '' . $nl . $nl; @@ -97,12 +97,12 @@ function Table_ComboBox() function TableComboBox($default='') { global $db,$config,$lang,$nl; - $tabellen=mysql_list_tables($db,$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM $db"); + $num_tables=mysqli_num_rows($tabellen); $s='' . $nl; 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.='' . $nl; } return $s; @@ -113,8 +113,8 @@ function DB_Exists($db) global $config; if (!isset($config['dbconnection'])) MSD_mysql_connect(); $erg=false; - $dbs=mysql_list_dbs($config['dbconnection']); - while ($row=mysql_fetch_object($dbs)) + $dbs=(($___mysqli_tmp = mysqli_query($config['dbconnection'], "SHOW DATABASES")) ? $___mysqli_tmp : false); + while ($row=mysqli_fetch_object($dbs)) { if (strtolower($row->Database) == strtolower($db)) { @@ -134,7 +134,7 @@ function Table_Exists($db, $table) if ($res) { $tables=array(); - WHILE ($row=mysql_fetch_row($res)) + WHILE ($row=mysqli_fetch_row($res)) { $tables[]=$row[0]; } @@ -207,16 +207,16 @@ function DB_Copy($source, $destination, $drop_source=0, $insert_data=1) } } $SQL_Array.="USE `$destination` ;\n"; - $tabellen=mysql_list_tables($source,$config['dbconnection']); - $num_tables=mysql_num_rows($tabellen); + $tabellen=mysqli_query($config['dbconnection'], "SHOW TABLES FROM $source"); + $num_tables=mysqli_num_rows($tabellen); 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`"; $res=MSD_query($sqlt); if ($res) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $c=$row[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"; @@ -226,7 +226,7 @@ function DB_Copy($source, $destination, $drop_source=0, $insert_data=1) return false; } } - mysql_select_db($destination); + ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $destination)); $res=MSD_DoSQL($SQL_Array); if ($drop_source == 1 && $res) MSD_query("DROP DATABASE `$source`;"); return $res; @@ -239,7 +239,7 @@ function Table_Copy($source, $destination, $insert_data, $destinationdb="") $SQL_Array=$t=""; $sqlc="SHOW CREATE TABLE $source"; $res=MSD_query($sqlc); - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $c=$row[1]; $a1=strpos($c,"`"); $a2=strpos($c,"`",$a1 + 1); @@ -483,16 +483,16 @@ function GetCreateTable($db, $tabelle) { global $config; 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) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); if (isset($row['Create Table'])) return $row['Create Table']; elseif (isset($row['Create View'])) return $row['Create View']; else return false; } 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 { - $res=mysql_query("SHOW ENGINES"); - $num=mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW ENGINES"); + $num=mysqli_num_rows($res); for ($i=0; $i < $num; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $r.=''; } } @@ -608,13 +608,13 @@ function CharsetCombo($default="") else { if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $res=mysql_query("SHOW Charset"); - $num=mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW Charset"); + $num=mysqli_num_rows($res); $r=''; $charsets=array(); for ($i=0; $i < $num; $i++) { - $charsets[]=mysql_fetch_array($res); + $charsets[]=mysqli_fetch_array($res); } if (is_array($charsets)) @@ -634,14 +634,14 @@ function GetCollationArray() global $config; if (!isset($config['dbconnection'])) MSD_mysql_connect(); - $res=mysql_query("SHOW Collation"); - $num=@mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], "SHOW Collation"); + $num=@mysqli_num_rows($res); $r=Array(); if (is_array($r)) { 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]['Charset']=isset($row['Charset']) ? $row['Charset'] : ''; $r[$i]['Id']=isset($row['Id']) ? $row['Id'] : ''; @@ -840,7 +840,7 @@ function getFieldinfos($db, $tabelle) $t=GetCreateTable($db,$tabelle); $sqlf="SHOW FULL FIELDS FROM `$db`.`$tabelle`;"; $res=MSD_query($sqlf); - $anz_fields=mysql_num_rows($res); + $anz_fields=mysqli_num_rows($res); $fields_infos['_primarykeys_']=array(); $fields_infos['_key_']=array(); @@ -867,7 +867,7 @@ function getFieldinfos($db, $tabelle) $fields_infos[$i]['type']=''; $fields_infos[$i]['privileges']=''; - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); //v($row); if (isset($row['Collation'])) $fields_infos[$i]['collate']=$row['Collation']; 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 $sql='SHOW KEYS FROM `' . $db . '`.`' . $tabelle . '`'; $res=MSD_query($sql); - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { //v($row); $key_name=isset($row['Key_name']) ? $row['Key_name'] : ''; @@ -947,12 +947,12 @@ function getExtendedFieldInfo($db, $table) $t=GetCreateTable($db,$table); $sqlf="SHOW FULL FIELDS FROM `$db`.`$table`;"; $res=MSD_query($sqlf); - $num_fields=mysql_num_rows($res); + $num_fields=mysqli_num_rows($res); $f=array(); //will hold all info for ($x=0; $x < $num_fields; $x++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); //v($row); $i=$row['Field']; // define name of field as index of array //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 $sql='SHOW KEYS FROM `' . $db . '`.`' . $table . '`'; $res=MSD_query($sql); - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { //echo "
Keys of $table: ";v($row); $key_name=isset($row['Key_name']) ? $row['Key_name'] : ''; @@ -1077,7 +1077,7 @@ function getPrimaryKeys($db, $table) $keys=Array(); $sqlk="SHOW KEYS FROM `" . $db . "`.`" . $table . "`;"; $res=MSD_query($sqlk); - while ($row=mysql_fetch_array($res)) + while ($row=mysqli_fetch_array($res)) { //wenn Primaerschluessel if ($row['Key_name'] == "PRIMARY") $keys['name'][]=$row['Column_name']; @@ -1105,7 +1105,7 @@ function getAllFields($db, $table) $fields=Array(); $sqlk="DESCRIBE `" . $db . "`.`" . $table . "`;"; $res=MSD_query($sqlk); - while ($row=mysql_fetch_array($res)) + while ($row=mysqli_fetch_array($res)) { $fields[]=$row['Field']; } diff --git a/inc/home/databases.php b/inc/home/databases.php index 67a5378..7143c97 100644 --- a/inc/home/databases.php +++ b/inc/home/databases.php @@ -14,7 +14,7 @@ for ($i=0; $i'; SetDefault(); include ($config['files']['parameter']); @@ -23,16 +23,16 @@ for ($i=0; $i"") { $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; $dba='

'.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_OPTIMIZED'].'.

'; @@ -63,7 +63,7 @@ for ($i=0; $iassign_block_vars('DB_NOT_FOUND',array( 'ROWCLASS' => $rowclass, @@ -73,9 +73,9 @@ for ($i=0; $iassign_block_vars('ROW',array( 'ROWCLASS' => $rowclass, 'NR' => ($i+1), @@ -101,9 +101,9 @@ if (isset($_GET['dbid'])) $dbid=$_GET['dbid']; $numrows=0; - $res=@mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`"); - mysql_select_db($databases['Name'][$dbid]); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`"); + ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dbid])); + if ($res) $numrows=mysqli_num_rows($res); $tpl->assign_vars(array( 'DB_NAME' => $databases['Name'][$dbid], 'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]), @@ -120,10 +120,10 @@ if (isset($_GET['dbid'])) $sum_records=$sum_data_length=''; 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 $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) { $row['Rows']=0; @@ -131,7 +131,7 @@ if (isset($_GET['dbid'])) } else { - $row2=mysql_fetch_array($res2); + $row2=mysqli_fetch_array($res2); $row['Rows']=$row2['count_records']; $rowclass=($i%2) ? 'dbrow' : 'dbrow1'; } @@ -163,16 +163,16 @@ if (isset($_GET['dbid'])) 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')) { // 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) { - $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()); else $tpl->assign_block_vars('ROW.CHECK_TABLE_NOT_OK',array()); @@ -186,10 +186,10 @@ if (isset($_GET['dbid'])) if ($enableKeys==$row['Name'] || $enableKeys=="ALL") { $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']."`"); - WHILE ($row3 = mysql_fetch_array($res3, MYSQL_ASSOC)) + $res3=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`"); + WHILE ($row3 = mysqli_fetch_array($res3, MYSQLI_ASSOC)) { if ($row3['Comment']=="disabled") { $keys_disabled = true; diff --git a/inc/home/mysql_variables.php b/inc/home/mysql_variables.php index 7af4f92..3f44dbb 100644 --- a/inc/home/mysql_variables.php +++ b/inc/home/mysql_variables.php @@ -14,8 +14,8 @@ echo '

 

'; switch ($var) { case "variables": - $res=@mysql_query("SHOW variables"); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW variables"); + if ($res) $numrows=mysqli_num_rows($res); if ($numrows==0) { echo $lang['L_INFO_NOVARS']; @@ -25,7 +25,7 @@ switch ($var) echo '
'; for ($i=0; $i<$numrows; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $cl=($i%2) ? "dbrow" : "dbrow1"; echo ''; } @@ -33,8 +33,8 @@ switch ($var) echo '
Name'.$lang['L_INHALT'].'
'.$row[0].''.$row[1].'
'; break; case "status": - $res=@mysql_query("SHOW STATUS"); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW STATUS"); + if ($res) $numrows=mysqli_num_rows($res); if ($numrows==0) { echo $lang['L_INFO_NOSTATUS']; @@ -45,7 +45,7 @@ switch ($var) for ($i=0; $i<$numrows; $i++) { $cl=($i%2) ? "dbrow" : "dbrow1"; - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); echo ''.$row[0].''.$row[1].''; } } @@ -59,7 +59,7 @@ switch ($var) $wait=(isset($_GET['wait'])) ? $_GET['wait'] : 0; if ($wait==0) { - $ret=mysql_query("KILL ".$_GET['killid']); + $ret=mysqli_query($GLOBALS["___mysqli_ston"], "KILL ".$_GET['killid']); $wait=2; } else @@ -77,8 +77,8 @@ switch ($var) } $killid=$wait=0; - $res=@mysql_query("SHOW FULL PROCESSLIST "); - if ($res) $numrows=mysql_num_rows($res); + $res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW FULL PROCESSLIST "); + if ($res) $numrows=mysqli_num_rows($res); if ($numrows==0) { echo $lang['L_INFO_NOPROCESSES']; @@ -89,7 +89,7 @@ switch ($var) for ($i=0; $i<$numrows; $i++) { $cl=($i%2) ? "dbrow" : "dbrow1"; - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); echo ''.$row[0].''.$row[1].' '.$row[2].''.$row[3].''.$row[4].''.$row[5].' '.$row[6].''.$row[7].' diff --git a/inc/home/protection_delete.php b/inc/home/protection_delete.php index 6c243d2dc3393fd679b1538ad11b7aedcf6e6f89..a8e4fbddb059d1b05c6e3a6efffe24962c9fcc08 100644 GIT binary patch literal 243 LcmZQz7;yjq0P_F= literal 243 zcma*hJ#NB45QgF2rx+xpu?x%r2tNfWC?FC@Gzg((ch(-o+Oc+K!}WpW0;#^{(Wm!g zJ@#Y85$Z{x$caLY`_uMz{yd&`Uk7X&2uw8|cRlrzB6k-Y zo%M>>3uY0+Ym04ffBxTmbgGZ==2Pd5B`s0SSy5b6)qD;nL14Cmj(-S>QU*>@z}=-7 ZX!(r;$q*e6B@;-5Km!@4?v?&Nd;)RHQ1<`; diff --git a/inc/home/system.php b/inc/home/system.php index 94f00b1..61b57fb 100644 --- a/inc/home/system.php +++ b/inc/home/system.php @@ -2,18 +2,18 @@ if (!defined('MSD_VERSION')) die('No direct access.'); $sysaction=(isset($_GET['dosys'])) ? $_GET['dosys'] : 0; $msg=""; -$res=@mysql_query("SHOW VARIABLES LIKE 'datadir'",$config['dbconnection']); +$res=@mysqli_query($config['dbconnection'], "SHOW VARIABLES LIKE 'datadir'"); if ($res) { - $row=mysql_fetch_array($res); + $row=mysqli_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']); + $res=@mysqli_query($config['dbconnection'], "FLUSH PRIVILEGES"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; @@ -25,8 +25,8 @@ switch ($sysaction) break; case 2: //FLUSH STATUS $msg="> operating FLUSH STATUS
"; - $res=@mysql_query("FLUSH STATUS",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "FLUSH STATUS"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; @@ -38,8 +38,8 @@ switch ($sysaction) break; case 3: //FLUSH HOSTS $msg="> operating FLUSH HOSTS
"; - $res=@mysql_query("FLUSH HOSTS",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "FLUSH HOSTS"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; @@ -52,15 +52,15 @@ switch ($sysaction) break; case 4: //SHOW MASTER LOGS $msg="> operating SHOW MASTER LOGS
"; - $res=@mysql_query("SHOW MASTER LOGS",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "SHOW MASTER LOGS"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; } else { - $numrows=mysql_num_rows($res); + $numrows=mysqli_num_rows($res); if ($numrows==0||$numrows===false) { $msg.='> there are no master log-files'; @@ -70,7 +70,7 @@ switch ($sysaction) $msg.='> there are '.$numrows.' logfiles
'; for ($i=0; $i<$numrows; $i++) { - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); $msg.='> '.$row[0].'   '.(($data_dir) ? byte_output(@filesize($data_dir.$row[0])) : '').'
'; } } @@ -78,8 +78,8 @@ switch ($sysaction) break; case 5: //RESET MASTER $msg="> operating RESET MASTER
"; - $res=@mysql_query("RESET MASTER",$config['dbconnection']); - $meldung=mysql_error($config['dbconnection']); + $res=@mysqli_query($config['dbconnection'], "RESET MASTER"); + $meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); if ($meldung!="") { $msg.='> MySQL-Error: '.$meldung; diff --git a/inc/mysql.php b/inc/mysql.php index 4b3b14e..f1738e4 100644 --- a/inc/mysql.php +++ b/inc/mysql.php @@ -254,22 +254,22 @@ function MSD_mysql_connect($encoding='utf8', $keycheck_off=false, $actual_table= } $port=( isset($config['dbport']) && !empty($config['dbport']) ) ? ':' . $config['dbport'] : ''; $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 (!isset($config['mysql_standard_character_set']) || $config['mysql_standard_character_set'] == '') get_sql_encodings(); 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; else $config['mysql_can_change_encoding']=true; } if ($keycheck_off) { // 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 - 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']; } @@ -277,7 +277,7 @@ function MSD_mysql_connect($encoding='utf8', $keycheck_off=false, $actual_table= function GetMySQLVersion() { $res=MSD_query("select version()"); - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $version=$row[0]; if (!defined('MSD_MYSQL_VERSION')) define('MSD_MYSQL_VERSION',$version); $versions=explode('.',$version); @@ -293,8 +293,8 @@ function MSD_query($query, $error_output=true) global $config; if (!isset($config['dbconnection'])) MSD_mysql_connect(); //echo "
Query: ".htmlspecialchars($query); - $res=mysql_query($query,$config['dbconnection']); - if (false === $res && $error_output) SQLError($query,mysql_error($config['dbconnection'])); + $res=mysqli_query($config['dbconnection'], $query); + 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; } @@ -366,9 +366,9 @@ function Fieldlist($db, $tbl) if ($res) { $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=substr($fl,0,strlen($fl) - 1) . ')'; @@ -383,14 +383,14 @@ function getDBInfos() for ($ii=0; $ii < count($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()); - $num_tables=mysql_num_rows($tabellen); + $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=mysqli_num_rows($tabellen); // Array mit den gewünschten Tabellen zusammenstellen... wenn Präfix angegeben, werden die anderen einfach nicht übernommen if ($num_tables > 0) { 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['Comment']) && substr(strtoupper($row['Comment']),0,4) == 'VIEW') $dump['table_types'][]='VIEW'; else $dump['table_types'][]=strtoupper($row['Engine']); @@ -403,11 +403,11 @@ function getDBInfos() } if ($config['optimize_tables_beforedump'] == 1 && $dump['table_offset'] == -1 && $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'] . '`'; - $res = mysql_query('OPTIMIZE TABLE `' . $row['Name'] . '`'); + $res = mysqli_query($GLOBALS["___mysqli_ston"], 'OPTIMIZE TABLE `' . $row['Name'] . '`'); 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 $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) { - $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); WriteLog($read_error); if ($config['stop_with_error'] > 0) @@ -449,7 +449,7 @@ function getDBInfos() } else { - $row2=@mysql_fetch_array($res2); + $row2=@mysqli_fetch_array($res2); $row['Rows']=$row2['count_records']; $dump['totalrecords']+=$row['Rows']; } diff --git a/inc/sql_importexport.php b/inc/sql_importexport.php index e747424..2d420d4 100644 --- a/inc/sql_importexport.php +++ b/inc/sql_importexport.php @@ -209,11 +209,11 @@ else $res=MSD_query($sqlt); if ($res) { - $sql['export']['tablecount']=mysql_numrows($res); + $sql['export']['tablecount']=mysqli_num_rows($res); $sql['export']['recordcount']=0; for ($i=0; $i < $sql['export']['tablecount']; $i++) { - $row=mysql_fetch_array($res); + $row=mysqli_fetch_array($res); $tblstr.='' . "\n"; $sql['export']['recordcount']+=$row['Rows']; } diff --git a/inc/sqlbrowser/mysql_search.php b/inc/sqlbrowser/mysql_search.php index a928145..579817c 100644 --- a/inc/sqlbrowser/mysql_search.php +++ b/inc/sqlbrowser/mysql_search.php @@ -4,10 +4,10 @@ if (!defined('MSD_VERSION')) die('No direct access.'); $sql='SHOW TABLES FROM `'.$db.'`'; $tables=ARRAY(); $link=MSD_mysql_connect(); -$res=mysql_query($sql,$link); +$res=mysqli_query($link, $sql); if (!$res===false) { - WHILE ($row=mysql_fetch_array($res,MYSQL_NUM)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_NUM)) { $tables[]=$row[0]; } @@ -70,12 +70,12 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl // Felder ermitteln $sql='SHOW COLUMNS FROM `'.$db.'`.`'.$tables[$tabelle].'`'; - $res=mysql_query($sql,$link); + $res=mysqli_query($link, $sql); unset($felder); if (!$res===false) { // Felder der Tabelle ermitteln - WHILE ($row=mysql_fetch_object($res)) + WHILE ($row=mysqli_fetch_object($res)) { $felder[]=$row->Field; } @@ -130,10 +130,10 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl else $sql='SELECT * FROM `'.$db.'`.`'.$tables[$tabelle].'` LIMIT '.$offset.','.$anzahl_ergebnisse; - $res=@mysql_query($sql,$link); + $res=@mysqli_query($link, $sql); if ($res) { - WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC)) + WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { //Treffer markieren foreach ($row as $key=>$val) diff --git a/inc/sqlbrowser/sql_dataview.php b/inc/sqlbrowser/sql_dataview.php index 283db0c..2c0afa2 100644 --- a/inc/sqlbrowser/sql_dataview.php +++ b/inc/sqlbrowser/sql_dataview.php @@ -100,7 +100,7 @@ else $res=@MSD_query($sql_temp,false); if ($res) { - if ($row=mysql_fetch_object($res)) + if ($row=mysqli_fetch_object($res)) { $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 ); if (!$skip_mysql_execution) $res=MSD_query($sqltmp); -$numrows=@mysql_num_rows($res); +$numrows=@mysqli_num_rows($res); if ($numrowsabs == -1) $numrowsabs=$numrows; if ($limitende > $numrowsabs) $limitende=$numrowsabs; @@ -149,7 +149,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) { //Infos und Header holen //1.Datensatz fuer Feldinfos - $row=mysql_fetch_row($res); + $row=mysqli_fetch_row($res); //Kompaktmodus-Switcher $t='' . ( ( $tdcompact == 1 ) ? $lang['L_SQL_VIEW_STANDARD'] : $lang['L_SQL_VIEW_COMPACT'] ) . ''; $t.='   ' . $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++) { - $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); } @@ -214,14 +214,14 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1) $temp=array(); //und jetzt Daten holen - mysql_data_seek($res,0); + mysqli_data_seek($res, 0); $s=$keysort; $s=array_flip($keysort); ksort($s); 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) { // Spalten sortieren, wenn wir uns in einer Tabellenuebersicht befinden diff --git a/inc/sqlbrowser/sql_record_insert_inputmask.php b/inc/sqlbrowser/sql_record_insert_inputmask.php index 0cec6f0..9afe299 100644 --- a/inc/sqlbrowser/sql_record_insert_inputmask.php +++ b/inc/sqlbrowser/sql_record_insert_inputmask.php @@ -6,12 +6,12 @@ $tpl->set_filenames(array( $sqledit="SHOW FIELDS FROM `$tablename`"; $res=MSD_query($sqledit); -$num=mysql_numrows($res); +$num=mysqli_num_rows($res); $feldnamen=""; for ($x=0; $x<$num; $x++) { - $row=mysql_fetch_object($res); + $row=mysqli_fetch_object($res); $feldnamen.=$row->Field.'|'; $tpl->assign_block_vars('ROW',array( 'CLASS' => ($x%2) ? 1 : 2, diff --git a/inc/sqlbrowser/sql_record_update_inputmask.php b/inc/sqlbrowser/sql_record_update_inputmask.php index 73402b7..82818f5 100644 --- a/inc/sqlbrowser/sql_record_update_inputmask.php +++ b/inc/sqlbrowser/sql_record_update_inputmask.php @@ -9,7 +9,7 @@ $fields=getExtendedFieldInfo($db,$tablename); $sqledit="SELECT * FROM `$tablename` WHERE ".$recordkey; $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 diff --git a/inc/sqlbrowser/sql_tables.php b/inc/sqlbrowser/sql_tables.php index b9a10fc..cfc18d9 100644 --- a/inc/sqlbrowser/sql_tables.php +++ b/inc/sqlbrowser/sql_tables.php @@ -278,10 +278,10 @@ if (isset($_POST['newfield_posted'])) $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]."` ;"; $res=MSD_query($sqlt); -$anz_tabellen=mysql_numrows($res); +$anz_tabellen=mysqli_num_rows($res); $p="sql.php?db=".$databases['Name'][$dbid]."&dbid=$dbid&tablename=$table_edit_name&context=2"; echo '
'; @@ -299,7 +299,7 @@ else echo '  '; @@ -310,7 +310,7 @@ if ($table_edit_name!="") { $sqlf="SHOW FULL FIELDS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name` ;"; $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); if (MSD_NEW_VERSION) $t_engine=(isset($fields_infos['_tableinfo_']['ENGINE'])) ? $fields_infos['_tableinfo_']['ENGINE'] : "MyISAM"; @@ -462,7 +462,7 @@ if ($table_edit_name!="") '; $sqlk="SHOW KEYS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name`;"; $res=MSD_query($sqlk); - $num=mysql_numrows($res); + $num=mysqli_num_rows($res); if ($num==0) { echo ''.$lang['L_SQL_TABLENOINDEXES'].''; @@ -471,7 +471,7 @@ if ($table_edit_name!="") { for ($i=0; $i<$num; $i++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); if (!isset($row['Comment'])) { $row['Comment'] = ''; } @@ -535,7 +535,7 @@ if ($table_edit_name!="") //body $sqlFelder="DESCRIBE `".$databases['Name'][$dbid]."`.`".$_GET['tablename']."`;"; $res=MSD_query($sqlFelder); - $num=mysql_numrows($res); + $num=mysqli_num_rows($res); if ($num==0) { echo ''.$lang['L_SQL_TABLENOINDEXES'].''; @@ -554,7 +554,7 @@ if ($table_edit_name!="") echo ''; echo ''; - while ($row=mysql_fetch_array($res, MYSQL_ASSOC)) + while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC)) { $feldArray[$row['Field']]=$row['Type']; } diff --git a/inc/tabellenabfrage.php b/inc/tabellenabfrage.php index 08c03b3..79f4d74 100644 --- a/inc/tabellenabfrage.php +++ b/inc/tabellenabfrage.php @@ -21,24 +21,24 @@ if ($tblr == 'Backup') $button_name='dump_tbl'; //Info aus der Datenbank lesen MSD_mysql_connect(); - $res=mysql_query('SHOW TABLE STATUS FROM `' . $databases['db_actual'] . '`'); - $numrows=mysql_num_rows($res); + $res=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW TABLE STATUS FROM `' . $databases['db_actual'] . '`'); + $numrows=mysqli_num_rows($res); $tbl_zeile=''; for ($i=0; $i < $numrows; $i++) { - $row=mysql_fetch_array($res,MYSQL_ASSOC); + $row=mysqli_fetch_array($res, MYSQLI_ASSOC); //v($row); // 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'] . "`"; - $res2=@mysql_query($sql_2); + $res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2); 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']='' . $lang['L_ERROR'] . ': ' . $read_error . ''; } else { - $row2=@mysql_fetch_array($res2); + $row2=@mysqli_fetch_array($res2); $row['Rows']=$row2['count_records']; } diff --git a/refresh_dblist.php b/refresh_dblist.php index 78e0781..1882628 100644 --- a/refresh_dblist.php +++ b/refresh_dblist.php @@ -44,7 +44,7 @@ foreach ($configFiles as $configFile) { include($config['paths']['config'] . $configFile . '.php'); $out = ''; 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; } SetDefault(); @@ -61,4 +61,4 @@ function output($message, $verbose) $message = str_replace("\n", NEWLINE, $message); echo $message . NEWLINE; } -} \ No newline at end of file +} diff --git a/restore.php b/restore.php index 819b163..5755f9b 100644 --- a/restore.php +++ b/restore.php @@ -78,7 +78,7 @@ $pageheader=MSDheader().headline($lang['L_RESTORE']); $aus1=$page_parameter=''; $RestoreFertig=$eingetragen=$dauer=$filegroesse=0; 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 $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 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']) { @@ -128,22 +128,22 @@ if ($restore['filehandle']) if ($sql_command>'') { //WriteLog(htmlspecialchars($sql_command)); - $res=mysql_query($sql_command,$config['dbconnection']); + $res=mysqli_query($config['dbconnection'], $sql_command); if (!$res===false) { - $anzsql=mysql_affected_rows($config['dbconnection']); + $anzsql=mysqli_affected_rows($config['dbconnection']); // Anzahl der eingetragenen Datensaetze ermitteln (Indexaktionen nicht zaehlen) $command=strtoupper(substr($sql_command,0,7)); if ($command=='INSERT ') { - $anzsql=mysql_affected_rows($config['dbconnection']); + $anzsql=mysqli_affected_rows($config['dbconnection']); if ($anzsql>0) $restore['eintraege_ready']+=$anzsql; } } else { // 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 (strtolower(substr($meldung,0,15))=='duplicate entry') diff --git a/sql.php b/sql.php index f0262b3..2eb3438 100644 --- a/sql.php +++ b/sql.php @@ -124,7 +124,7 @@ if ($sql_to_display_data==1) if (isset($_POST['tableselect'])&&$_POST['tableselect']!='1') $tablename=$_POST['tableselect']; MSD_mysql_connect(); -mysql_select_db($db,$config['dbconnection']); +((bool)mysqli_query($config['dbconnection'], "USE " . $db)); ///*** EDIT / UPDATES / INSERTS ***/// ///*** ***///
#'.$lang['L_PRIMARYKEY_FIELD'].''.$lang['L_INFO_SIZE'].'