merge Loic's version
This commit is contained in:
37
ChangeLog
37
ChangeLog
@@ -5,9 +5,21 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2001-07-28 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* lib.inc.php3: establish constraints for the code, to get
|
||||
PHP3 compatibility
|
||||
* tbl_qbe.php3: add checks for unset variables
|
||||
|
||||
2001-07-27 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* tbl_select.php3 and dynamic field size
|
||||
|
||||
2001-07-25 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* Backport fixes from cvs made after the fork, to Lo<4C>c's version
|
||||
|
||||
2001-07-24 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* updates to french
|
||||
* new slovak translation thanks to lubos klokner <erkac@vault-tec.sk>
|
||||
* select_lang.inc.php3, lang/: new slovak translation
|
||||
thanks to lubos klokner <erkac@vault-tec.sk>
|
||||
* main.php3: bug 443710 Create New Database option: was working
|
||||
only if stduser has Global privileges on all databases.
|
||||
* footer.inc.php3: if new cfgOBGzip is not defined
|
||||
@@ -18,10 +30,12 @@ $Source$
|
||||
of cfgSkipLockedTables and cfgLeftWidth
|
||||
|
||||
2001-07-24 Geert Lund <glund@silversoft.dk>
|
||||
* danish language file code cleanup (only changed order of stings)
|
||||
* danish language file code cleanup (only changed order of strings)
|
||||
* added $strQBEDel and $strQBEIns strings to all language files
|
||||
* tbl_qbe.php3: added language support (stripped all static text) (Feat.req.: #443959)
|
||||
* upated slovak-iso.inc.php3 to include english strings to be translated for the tbl_qbe.php3
|
||||
* tbl_qbe.php3: added language support (stripped all static text) (Feat.
|
||||
req.: #443959)
|
||||
* updated slovak-iso.inc.php3 to include english strings to be translated
|
||||
for the tbl_qbe.php3
|
||||
|
||||
2001-07-23 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* updates to italian thanks to Alessandro Astarita <aleast@libero.it>
|
||||
@@ -29,7 +43,7 @@ $Source$
|
||||
* updates to spanish thanks to Gabriel Ginard <gginard@naveglia.com>
|
||||
* updates to czech-iso and czech-win1250,thanks to Michal Cihar (nijel)
|
||||
* config.inc.php3, Documentation.html, footer.inc.php3,
|
||||
header.inc.php3, ob_lib.inc.php3:
|
||||
header.inc.php3
|
||||
bug 443318 Undefined variable: ob_mode
|
||||
fix thanks to Jeremy Brand <jeremy@nirvani.net>
|
||||
|
||||
@@ -47,6 +61,19 @@ $Source$
|
||||
* db_details.php3,tbl_properties.php3: fix incorrect size
|
||||
calculation with merge tables BUG: #442948
|
||||
|
||||
2001-07-21 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||
Started a new dev. version (or the next RC?):
|
||||
* added the ability to use special characters in databases, tables and
|
||||
fields' names with the help of backquotes.
|
||||
* added a checkbox to let the user choose whether he wants backotes or
|
||||
not in the dumps he requires.
|
||||
* navigation bar only shows what can be done.
|
||||
* fixed bug #439565 (Bug with &amp;# characters type), at least I
|
||||
hope so.
|
||||
* except 'users_details.php3' I've got to work on, all the scripts
|
||||
validates CSS2 now and, as far as possible, XHTML1.0.
|
||||
They have been rewriiten according to the PEAR standards.
|
||||
|
||||
2001-07-21 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||
* ob.lib.inc.php3, lines 50-54 & 73-76: fixed a bug with php3.
|
||||
|
||||
|
@@ -582,6 +582,12 @@
|
||||
<hr noshade="noshade" width="100%" />
|
||||
|
||||
<h2>FAQ - Frequently Asked Questions</h2>
|
||||
<p>
|
||||
<b>The error message "Warning: Cannot add header information - headers already sent by ..." is displayed, what's the problem?</b>
|
||||
<br />
|
||||
Look at the end of your config.inc.php or .php3 file, there must be no
|
||||
blank lines or spaces after the ?>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>I can't insert new rows into a table - MySQL brings up a SQL-error.</b>
|
||||
|
4
README
4
README
@@ -5,8 +5,8 @@ phpMyAdmin - Readme
|
||||
|
||||
A set of PHP-scripts to adminstrate MySQL over the WWW.
|
||||
|
||||
Version 2.2.0rc3 - 22/07/2001
|
||||
-----------------------------
|
||||
Version 2.2.0 - xx/07/2001
|
||||
--------------------------
|
||||
http://phpwizard.net/projects/phpMyAdmin/
|
||||
http://phpmyadmin.sourceforge.net/
|
||||
|
||||
|
213
config.inc.php3
213
config.inc.php3
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/*
|
||||
* phpMyAdmin Configuration File
|
||||
* All directives are explained in Documentation.html
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Bookmark Table Structure
|
||||
*
|
||||
@@ -19,11 +21,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Server(s) configuration
|
||||
*/
|
||||
// The $cfgServers array starts with $cfgServers[1]. Do not use $cfgServers[0].
|
||||
// You can disable a server config entry by setting host to ''.
|
||||
$cfgServers[1]['host'] = 'localhost'; // MySQL hostname
|
||||
$cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port
|
||||
$cfgServers[1]['adv_auth'] = false; // Use advanced authentication?
|
||||
$cfgServers[1]['adv_auth'] = FALSE; // Use advanced authentication?
|
||||
$cfgServers[1]['stduser'] = ''; // MySQL standard user (only needed with advanced auth)
|
||||
$cfgServers[1]['stdpass'] = ''; // MySQL standard password (only needed with advanced auth)
|
||||
$cfgServers[1]['user'] = 'root'; // MySQL user (only needed with basic auth)
|
||||
@@ -35,27 +41,27 @@ $cfgServers[1]['bookmarktable'] = ''; // Bookmark table - leave blank
|
||||
|
||||
$cfgServers[2]['host'] = '';
|
||||
$cfgServers[2]['port'] = '';
|
||||
$cfgServers[2]['adv_auth'] = false;
|
||||
$cfgServers[2]['adv_auth'] = FALSE;
|
||||
$cfgServers[2]['stduser'] = '';
|
||||
$cfgServers[2]['stdpass'] = '';
|
||||
$cfgServers[2]['user'] = 'root';
|
||||
$cfgServers[2]['password'] = '';
|
||||
$cfgServers[2]['only_db'] = '';
|
||||
$cfgServers[2]['verbose'] = '';
|
||||
$cfgServers[2]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support
|
||||
$cfgServers[2]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support
|
||||
$cfgServers[2]['bookmarkdb'] = '';
|
||||
$cfgServers[2]['bookmarktable'] = '';
|
||||
|
||||
$cfgServers[3]['host'] = '';
|
||||
$cfgServers[3]['port'] = '';
|
||||
$cfgServers[3]['adv_auth'] = false;
|
||||
$cfgServers[3]['adv_auth'] = FALSE;
|
||||
$cfgServers[3]['stduser'] = '';
|
||||
$cfgServers[3]['stdpass'] = '';
|
||||
$cfgServers[3]['user'] = 'root';
|
||||
$cfgServers[3]['password'] = '';
|
||||
$cfgServers[3]['only_db'] = '';
|
||||
$cfgServers[3]['verbose'] = '';
|
||||
$cfgServers[3]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support
|
||||
$cfgServers[3]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support
|
||||
$cfgServers[3]['bookmarkdb'] = '';
|
||||
$cfgServers[3]['bookmarktable'] = '';
|
||||
|
||||
// If you have more than one server configured, you can set $cfgServerDefault
|
||||
// to any one of them to autoconnect to that server when phpMyAdmin is started,
|
||||
@@ -66,95 +72,124 @@ $cfgServerDefault = 1; // Default server (0 = no def
|
||||
$cfgServer = '';
|
||||
unset($cfgServers[0]);
|
||||
|
||||
// Be sure to include no trailing slash on the path
|
||||
$cfgManualBase = "http://www.mysql.com/documentation/mysql/bychapter";
|
||||
|
||||
$cfgConfirm = true;
|
||||
$cfgPersistentConnections = false;
|
||||
|
||||
$cfgBorder = "0";
|
||||
$cfgThBgcolor = "#D3DCE3";
|
||||
$cfgBgcolorOne = "#CCCCCC";
|
||||
$cfgBgcolorTwo = "#DDDDDD";
|
||||
/**
|
||||
* Other core phpMyAdmin settings
|
||||
*/
|
||||
$cfgConfirm = TRUE;
|
||||
$cfgPersistentConnections = FALSE;
|
||||
$cfgShowBlob = FALSE;
|
||||
$cfgShowSQL = TRUE;
|
||||
$cfgSkipLockedTables = FALSE; // mark used tables, make possible to show
|
||||
// locked tables (since MySQL 3.23.30)
|
||||
$cfgMaxRows = 30;
|
||||
$cfgOrder = "ASC";
|
||||
$cfgShowBlob = true;
|
||||
$cfgShowSQL = true;
|
||||
$cfgTextareaCols = "40";
|
||||
$cfgTextareaRows = "7";
|
||||
$cfgModifyDeleteAtLeft = true;
|
||||
$cfgModifyDeleteAtRight = false;
|
||||
$cfgSkipLockedTables = false; // mark used tables, make possible to show locked tables (since 3.23.30)
|
||||
$cfgOrder = 'ASC';
|
||||
$cfgOBGzip = true; // GZIP output buffering
|
||||
|
||||
/**
|
||||
* Link to the offcial MySQL documentation
|
||||
* Be sure to include no trailing slash on the path
|
||||
*/
|
||||
$cfgManualBase = 'http://www.mysql.com/documentation/mysql/bychapter';
|
||||
|
||||
|
||||
/**
|
||||
* Language settings
|
||||
*/
|
||||
// Default language to use, if not browser-defined or user-defined
|
||||
$cfgDefaultLang = 'en';
|
||||
// Force: always use this language - must be defined in select_lang.inc.php3
|
||||
// $cfgLang = 'en';
|
||||
// Loads language file
|
||||
require('./select_lang.inc.php3');
|
||||
|
||||
|
||||
/**
|
||||
* Customization & design
|
||||
*/
|
||||
$cfgBorder = 0;
|
||||
$cfgThBgcolor = '#D3DCE3';
|
||||
$cfgBgcolorOne = '#CCCCCC';
|
||||
$cfgBgcolorTwo = '#DDDDDD';
|
||||
$cfgTextareaCols = 40;
|
||||
$cfgTextareaRows = 7;
|
||||
$cfgModifyDeleteAtLeft = TRUE;
|
||||
$cfgModifyDeleteAtRight = FALSE;
|
||||
$cfgLeftWidth = 150; // left frame width
|
||||
|
||||
$cfgDefaultLang = "en"; // default language to use, if not browser-defined or user-defined
|
||||
// $cfgLang = "en"; // force: always use this language - must be defined in select_lang.inc.php3
|
||||
require("./select_lang.inc.php3"); // load language file
|
||||
|
||||
// GZIP output buffering
|
||||
$cfgOBGzip = true;
|
||||
|
||||
/**
|
||||
* MySQL settings
|
||||
*/
|
||||
// Column types
|
||||
$cfgColumnTypes = array(
|
||||
"TINYINT",
|
||||
"SMALLINT",
|
||||
"MEDIUMINT",
|
||||
"INT",
|
||||
"BIGINT",
|
||||
"FLOAT",
|
||||
"DOUBLE",
|
||||
"DECIMAL",
|
||||
"DATE",
|
||||
"DATETIME",
|
||||
"TIMESTAMP",
|
||||
"TIME",
|
||||
"YEAR",
|
||||
"CHAR",
|
||||
"VARCHAR",
|
||||
"TINYBLOB",
|
||||
"TINYTEXT",
|
||||
"TEXT",
|
||||
"BLOB",
|
||||
"MEDIUMBLOB",
|
||||
"MEDIUMTEXT",
|
||||
"LONGBLOB",
|
||||
"LONGTEXT",
|
||||
"ENUM",
|
||||
"SET");
|
||||
|
||||
//Some functions discussed on patch #419826 added. - 05/May/2001 - Robbat2
|
||||
$cfgFunctions = array(
|
||||
"ASCII",
|
||||
"CHAR",
|
||||
"SOUNDEX",
|
||||
"ENCRYPT",
|
||||
"LCASE",
|
||||
"UCASE",
|
||||
"NOW",
|
||||
"PASSWORD",
|
||||
"ENCODE",
|
||||
"DECODE",
|
||||
"MD5",
|
||||
"RAND",
|
||||
"LAST_INSERT_ID",
|
||||
"COUNT",
|
||||
"AVG",
|
||||
"SUM",
|
||||
"CURDATE",
|
||||
"CURTIME",
|
||||
"FROM_DAYS",
|
||||
"FROM_UNIXTIME",
|
||||
"PERIOD_ADD",
|
||||
"PERIOD_DIFF",
|
||||
"TO_DAYS",
|
||||
"USER",
|
||||
"WEEKDAY");
|
||||
'TINYINT',
|
||||
'SMALLINT',
|
||||
'MEDIUMINT',
|
||||
'INT',
|
||||
'BIGINT',
|
||||
'FLOAT',
|
||||
'DOUBLE',
|
||||
'DECIMAL',
|
||||
'DATE',
|
||||
'DATETIME',
|
||||
'TIMESTAMP',
|
||||
'TIME',
|
||||
'YEAR',
|
||||
'CHAR',
|
||||
'VARCHAR',
|
||||
'TINYBLOB',
|
||||
'TINYTEXT',
|
||||
'TEXT',
|
||||
'BLOB',
|
||||
'MEDIUMBLOB',
|
||||
'MEDIUMTEXT',
|
||||
'LONGBLOB',
|
||||
'LONGTEXT',
|
||||
'ENUM',
|
||||
'SET'
|
||||
);
|
||||
|
||||
// Atributes
|
||||
$cfgAttributeTypes = array(
|
||||
"",
|
||||
"BINARY",
|
||||
"UNSIGNED",
|
||||
"UNSIGNED ZEROFILL");
|
||||
'',
|
||||
'BINARY',
|
||||
'UNSIGNED',
|
||||
'UNSIGNED ZEROFILL'
|
||||
);
|
||||
|
||||
// Setting magic_quotes_runtime - do not change!
|
||||
// Available functions
|
||||
$cfgFunctions = array(
|
||||
'ASCII',
|
||||
'CHAR',
|
||||
'SOUNDEX',
|
||||
'ENCRYPT',
|
||||
'LCASE',
|
||||
'UCASE',
|
||||
'NOW',
|
||||
'PASSWORD',
|
||||
'ENCODE',
|
||||
'DECODE',
|
||||
'MD5',
|
||||
'RAND',
|
||||
'LAST_INSERT_ID',
|
||||
'COUNT',
|
||||
'AVG',
|
||||
'SUM',
|
||||
'CURDATE',
|
||||
'CURTIME',
|
||||
'FROM_DAYS',
|
||||
'FROM_UNIXTIME',
|
||||
'PERIOD_ADD',
|
||||
'PERIOD_DIFF',
|
||||
'TO_DAYS',
|
||||
'USER',
|
||||
'WEEKDAY'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Unset magic_quotes_runtime - do not change!
|
||||
*/
|
||||
set_magic_quotes_runtime(0);
|
||||
error_reporting(63);
|
||||
?>
|
||||
|
@@ -2,13 +2,23 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
require("./header.inc.php3");
|
||||
|
||||
$result = mysql_query("CREATE DATABASE " . db_name($db)) or mysql_die();
|
||||
/**
|
||||
* Executes the db creation sql query
|
||||
*/
|
||||
$result = mysql_query('CREATE DATABASE ' . backquote($db)) or mysql_die();
|
||||
|
||||
$message = "$strDatabase " . db_name($db) . " $strHasBeenCreated";
|
||||
require("./db_details.php3");
|
||||
|
||||
/**
|
||||
* Displays the result and moves back to the calling page
|
||||
*/
|
||||
$message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated;
|
||||
require('./db_details.php3');
|
||||
|
||||
?>
|
||||
|
175
db_details.php3
175
db_details.php3
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets the variables sent to this script and diplays headers
|
||||
* Gets the variables sent to this script and displays headers
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
if (!isset($message)) {
|
||||
@@ -11,6 +12,7 @@ if (!isset($message)) {
|
||||
show_message($message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays an html table with all the tables contained into the current
|
||||
* database
|
||||
@@ -22,26 +24,26 @@ $num_tables = @mysql_numrows($tables);
|
||||
// speedup view on locked tables - staybyte - 11 June 2001
|
||||
if ($num_tables > 0 && MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) {
|
||||
// Special speedup for newer MySQL Versions (in 4.0 format changed)
|
||||
if ($cfgSkipLockedTables == true && MYSQL_MAJOR_VERSION == 3.23 && intval(MYSQL_MINOR_VERSION) >= 30) {
|
||||
$query = 'SHOW OPEN TABLES FROM ' . db_name($db);
|
||||
if ($cfgSkipLockedTables == TRUE && MYSQL_MAJOR_VERSION == 3.23 && intval(MYSQL_MINOR_VERSION) >= 30) {
|
||||
$query = 'SHOW OPEN TABLES FROM ' . backquote($db);
|
||||
$result = mysql_query($query);
|
||||
// Blending out tables in use
|
||||
if ($result != false && mysql_num_rows($result) > 0) {
|
||||
if ($result != FALSE && mysql_num_rows($result) > 0) {
|
||||
while ($tmp = mysql_fetch_array($result)) {
|
||||
// if in use memorize tablename
|
||||
if (preg_match('/in_use=[1-9]+/', $tmp['Comment'])) {
|
||||
$sot_cache[$tmp[0]] = true;
|
||||
$sot_cache[$tmp[0]] = TRUE;
|
||||
}
|
||||
}
|
||||
mysql_free_result($result);
|
||||
|
||||
if (isset($sot_cache)) {
|
||||
$query = 'SHOW TABLES FROM ' . db_name($db);
|
||||
$query = 'SHOW TABLES FROM ' . backquote($db);
|
||||
$result = mysql_query($query);
|
||||
if ($result != false && mysql_num_rows($result) > 0) {
|
||||
if ($result != FALSE && mysql_num_rows($result) > 0) {
|
||||
while ($tmp = mysql_fetch_array($result)) {
|
||||
if (!isset($sot_cache[$tmp[0]])) {
|
||||
$sts_result = mysql_query('SHOW TABLE STATUS FROM ' . db_name($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'');
|
||||
$sts_result = mysql_query('SHOW TABLE STATUS FROM ' . backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'');
|
||||
$sts_tmp = mysql_fetch_array($sts_result);
|
||||
$tbl_cache[] = $sts_tmp;
|
||||
} else { // table in use
|
||||
@@ -49,14 +51,14 @@ if ($num_tables > 0 && MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION
|
||||
}
|
||||
}
|
||||
mysql_free_result($result);
|
||||
$sot_ready = true;
|
||||
$sot_ready = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($sot_ready)) {
|
||||
$result = mysql_query('SHOW TABLE STATUS FROM ' . db_name($db));
|
||||
if ($result != false && mysql_num_rows($result) > 0) {
|
||||
$result = mysql_query('SHOW TABLE STATUS FROM ' . backquote($db));
|
||||
if ($result != FALSE && mysql_num_rows($result) > 0) {
|
||||
while ($sts_tmp = mysql_fetch_array($result)) {
|
||||
$tbl_cache[] = $sts_tmp;
|
||||
}
|
||||
@@ -88,31 +90,42 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) {
|
||||
$i = $sum_entries = $sum_size = 0;
|
||||
while (list($keyname, $sts_data) = each($tbl_cache)) {
|
||||
$table = $sts_data['Name'];
|
||||
$query = "?server=$server&lang=$lang&db=$db&table=$table&goto=db_details.php3";
|
||||
// Sets parameters for links
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&goto=db_details.php3';
|
||||
$bgcolor = ($i++ % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
echo "\n";
|
||||
?>
|
||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||
<td class="data">
|
||||
<b><?php echo $table; ?> </b>
|
||||
<td nowrap="nowrap">
|
||||
<b><?php echo htmlspecialchars($table); ?> </b>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3<?php echo $query; ?>&sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0"><?php echo $strBrowse; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0">
|
||||
<?php echo $strBrowse; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="tbl_select.php3<?php echo $query; ?>"><?php echo $strSelect; ?></a>
|
||||
<a href="tbl_select.php3?<?php echo $url_query; ?>">
|
||||
<?php echo $strSelect; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="tbl_change.php3<?php echo $query; ?>"><?php echo $strInsert; ?></a>
|
||||
<a href="tbl_change.php3?<?php echo $url_query; ?>">
|
||||
<?php echo $strInsert; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="tbl_properties.php3<?php echo $query; ?>"><?php echo $strProperties; ?></a>
|
||||
<a href="tbl_properties.php3?<?php echo $url_query; ?>">
|
||||
<?php echo $strProperties; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3<?php echo $query; ?>&reload=true&sql_query=<?php echo urlencode("DROP TABLE $table"); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . $table . ' ' . $strHasBeenDropped); ?>"><?php echo $strDrop; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&reload=true&sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenDropped); ?>">
|
||||
<?php echo $strDrop; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3<?php echo $query; ?>&sql_query=<?php echo urlencode("DELETE FROM $table"); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . $table . ' ' . $strHasBeenEmptied); ?>"><?php echo $strEmpty; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('DELETE FROM ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenEmptied); ?>">
|
||||
<?php echo $strEmpty; ?></a>
|
||||
</td>
|
||||
<?php
|
||||
echo "\n";
|
||||
@@ -143,13 +156,14 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) {
|
||||
<td align="right">
|
||||
<?php
|
||||
if (isset($mergetable)) echo "<i>";
|
||||
echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
|
||||
echo number_format($sts_data['Rows'], 0, $number_decimal_separator,
|
||||
$number_thousands_separator) . "\n";
|
||||
if (isset($mergetable)) echo "</i>";
|
||||
?>
|
||||
</td>
|
||||
<td align="right" nowrap="nowrap">
|
||||
|
||||
<a href="tbl_properties.php3<?php echo $query; ?>>#showusage"><?php echo $formated_size . ' ' . $unit; ?></a>
|
||||
<a href="tbl_properties.php3<?php echo $url_query; ?>>#showusage"><?php echo $formated_size . ' ' . $unit; ?></a>
|
||||
</td>
|
||||
<?php
|
||||
} else {
|
||||
@@ -172,10 +186,10 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) {
|
||||
<td colspan="7" align="center">
|
||||
<?php echo $strSum . "\n"; ?>
|
||||
</td>
|
||||
<td align="right">
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
|
||||
</td>
|
||||
<td align="right">
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php echo $sum_formated . ' '. $unit . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -201,7 +215,12 @@ else {
|
||||
<?php
|
||||
while ($i < $num_tables) {
|
||||
$table = mysql_tablename($tables, $i);
|
||||
$query = "?server=$server&lang=$lang&db=$db&table=$table&goto=db_details.php3";
|
||||
// Sets parameters for links
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&goto=db_details.php3';
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
echo "\n";
|
||||
?>
|
||||
@@ -210,22 +229,22 @@ else {
|
||||
<b><?php echo $table; ?></b>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3<?php echo $query; ?>&sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0"><?php echo $strBrowse; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0"><?php echo $strBrowse; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="tbl_select.php3<?php echo $query; ?>"><?php echo $strSelect; ?></a>
|
||||
<a href="tbl_select.php3?<?php echo $url_query; ?>"><?php echo $strSelect; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="tbl_change.php3<?php echo $query; ?>"><?php echo $strInsert; ?></a>
|
||||
<a href="tbl_change.php3?<?php echo $url_query; ?>"><?php echo $strInsert; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="tbl_properties.php3<?php echo $query; ?>"><?php echo $strProperties; ?></a>
|
||||
<a href="tbl_properties.php3?<?php echo $url_query; ?>"><?php echo $strProperties; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3<?php echo $query; ?>&reload=true&sql_query=<?php echo urlencode("DROP TABLE $table"); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . $table . ' ' . $strHasBeenDropped); ?>"><?php echo $strDrop; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&reload=true&sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenDropped); ?>"><?php echo $strDrop; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3<?php echo $query; ?>&sql_query=<?php echo urlencode("DELETE FROM $table"); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . $table . ' ' . $strHasBeenEmptied); ?>"><?php echo $strEmpty; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('DELETE FROM ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenEmptied); ?>"><?php echo $strEmpty; ?></a>
|
||||
</td>
|
||||
<td align="right">
|
||||
<?php count_records($db, $table); echo "\n"; ?>
|
||||
@@ -240,17 +259,25 @@ else {
|
||||
<?php
|
||||
} // end case mysql < 3.23
|
||||
|
||||
$query = "?server=$server&lang=$lang&db=$db&goto=db_details.php3";
|
||||
echo "\n";
|
||||
?>
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Database work
|
||||
*/
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&goto=db_details.php3';
|
||||
if (isset($show_query)) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$sql_query = stripslashes($sql_query);
|
||||
}
|
||||
$query_to_display = (($show_query == 'y') ? $sql_query : '');
|
||||
}
|
||||
?>
|
||||
<!-- DATABASE WORK -->
|
||||
<script src="functions.js" type="text/javascript" language="javascript"></script>
|
||||
@@ -261,7 +288,7 @@ if ($num_tables > 0) {
|
||||
?>
|
||||
<!-- Printable view of a table -->
|
||||
<li>
|
||||
<div style="margin-bottom: 10px"><a href="db_printview.php3<?php echo $query; ?>"><?php echo $strPrintView; ?></a></div>
|
||||
<div style="margin-bottom: 10px"><a href="db_printview.php3?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
@@ -275,26 +302,15 @@ if ($num_tables > 0) {
|
||||
<input type="hidden" name="pos" value="0" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="goto" value="db_details.php3" />
|
||||
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
|
||||
<input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
|
||||
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
|
||||
<?php echo $strRunSQLQuery . $db . ' ' . show_docu('manual_Reference.html#SELECT'); ?> :<br />
|
||||
<div style="margin-bottom: 5px">
|
||||
<textarea name="sql_query" wrap="virtual"
|
||||
rows="<?php echo $cfgTextareaRows; ?>"
|
||||
cols="<?php echo $cfgTextareaCols; ?>"
|
||||
>
|
||||
<?php
|
||||
if (isset($show_query)) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$sql_query = stripslashes($sql_query);
|
||||
}
|
||||
echo $show_query=="y" ? $sql_query : '';
|
||||
}
|
||||
// else if (isset($sql_query)) {
|
||||
// echo stripslashes($sql_query);
|
||||
//}
|
||||
?>
|
||||
<textarea name="sql_query" cols="<?php echo $cfgTextareaCols; ?>" rows="<?php echo $cfgTextareaRows; ?>" wrap="virtual">
|
||||
<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
|
||||
</textarea><br />
|
||||
<INPUT type=checkbox name='show_query' value="y" checked /><?php echo $strShowThisQuery; ?><br />
|
||||
<input type="checkbox" name="show_query" value="y" checked="checked" />
|
||||
<?php echo $strShowThisQuery; ?><br />
|
||||
</div>
|
||||
<?php echo "<i>$strOr</i> $strLocationTextfile"; ?> :<br />
|
||||
<div style="margin-bottom: 5px">
|
||||
@@ -309,7 +325,7 @@ if ($cfgBookmark['db'] && $cfgBookmark['table']) {
|
||||
echo ' <select name="id_bookmark">' . "\n";
|
||||
echo ' <option value=""></option>' . "\n";
|
||||
while (list($key, $value) = each($bookmark_list)) {
|
||||
echo ' <option value="' . htmlentities($value) . '">' . htmlentities($key) . '</option>' . "\n";
|
||||
echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select>' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="0" checked="checked" style="vertical-align: middle" />' . $strSubmit . "\n";
|
||||
@@ -334,7 +350,7 @@ if ($num_tables > 0) {
|
||||
?>
|
||||
<!-- Query by an example -->
|
||||
<li>
|
||||
<div style="margin-bottom: 10px"><a href="tbl_qbe.php3<?php echo $query;?>"><?php echo $strQBE; ?></a></div>
|
||||
<div style="margin-bottom: 10px"><a href="tbl_qbe.php3?<?php echo $url_query; ?>"><?php echo $strQBE; ?></a></div>
|
||||
</li>
|
||||
|
||||
<!-- Dump of a database -->
|
||||
@@ -342,14 +358,16 @@ if ($num_tables > 0) {
|
||||
<form method="post" action="tbl_dump.php3" name="db_dump">
|
||||
<?php echo $strViewDumpDB; ?><br />
|
||||
<table>
|
||||
<tr>
|
||||
<?php
|
||||
$colspan = '';
|
||||
$tables = mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
if ($num_tables > 1) {
|
||||
$colspan = ' colspan="2"';
|
||||
echo "\n";
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td>
|
||||
<select name="table_select[]" size="5" multiple="multiple">
|
||||
<?php
|
||||
$i = 0;
|
||||
@@ -362,37 +380,47 @@ if ($num_tables > 0) {
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<td valign="middle">
|
||||
<input type="radio" name="what" value="structure" checked="checked" />
|
||||
<?php echo $strStrucOnly; ?>
|
||||
<?php echo $strStrucOnly; ?><br />
|
||||
<input type="radio" name="what" value="data" />
|
||||
<?php echo $strStrucData; ?><br />
|
||||
<input type="radio" name="what" value="dataonly" />
|
||||
<?php echo $strDataOnly . "\n"; ?>
|
||||
</td>
|
||||
<td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td<?php echo $colspan; ?>>
|
||||
<input type="checkbox" name="drop" value="1" />
|
||||
<?php echo $strStrucDrop . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="what" value="data" />
|
||||
<?php echo $strStrucData; ?>
|
||||
</td>
|
||||
<td>
|
||||
<td<?php echo $colspan; ?>>
|
||||
<input type="checkbox" name="showcolumns" value="yes" />
|
||||
<?php echo $strCompleteInserts . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
// Add backquotes checkbox
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) {
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="what" value="dataonly" />
|
||||
<?php echo $strDataOnly; ?>
|
||||
<td<?php echo $colspan; ?>>
|
||||
<input type="checkbox" name="use_backquotes" value="1" />
|
||||
<?php echo $strUseBackquotes . "\n"; ?>
|
||||
</td>
|
||||
<td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end backquotes feature
|
||||
echo "\n";
|
||||
?>
|
||||
<tr>
|
||||
<td<?php echo $colspan; ?>>
|
||||
<input type="checkbox" name="asfile" value="sendit" onclick="return checkTransmitDump(this.form, 'transmit')" />
|
||||
<?php echo $strSend . "\n"; ?>
|
||||
<?php
|
||||
@@ -421,7 +449,7 @@ if ($num_tables > 0) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td<?php echo $colspan; ?>>
|
||||
<input type="submit" value="<?php echo $strGo; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -442,7 +470,7 @@ if ($num_tables > 0) {
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<?php
|
||||
echo ' ' . $strCreateNewTable . $db . ' :<br />' . "\n";
|
||||
echo ' ' . $strCreateNewTable . htmlspecialchars($db) . ' :<br />' . "\n";
|
||||
echo ' ' . $strName . ' : ' . "\n";
|
||||
echo ' ' . '<input type="text" name="table" />' . "\n";
|
||||
// echo ' ' . $strNumberIndexes. ' : ' . "\n";
|
||||
@@ -457,7 +485,8 @@ echo ' ' . ' <input type="submit" value="' . $strGo . '" />' . "\n";
|
||||
|
||||
<!-- Drop table -->
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=<?php echo $db; ?>&sql_query=<?php echo urlencode('DROP DATABASE ' . db_name($db)); ?>&zero_rows=<?php echo urlencode($strDatabase . ' ' . db_name($db) . ' ' . $strHasBeenDropped); ?>&goto=main.php3&reload=true"><?php echo $strDropDB . ' ' . $db;?></a>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=<?php echo $db; ?>&sql_query=<?php echo urlencode('DROP DATABASE ' . backquote($db)); ?>&zero_rows=<?php echo urlencode($strDatabase . ' ' . htmlspecialchars(backquote($db)) . ' ' . $strHasBeenDropped); ?>&goto=main.php3&reload=true">
|
||||
<?php echo $strDropDB . ' ' . htmlspecialchars($db); ?></a>
|
||||
<?php echo show_docu('manual_Reference.html#DROP_DATABASE') . "\n"; ?>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -467,6 +496,6 @@ echo ' ' . ' <input type="submit" value="' . $strGo . '" />' . "\n";
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php3');
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
@@ -2,50 +2,70 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
|
||||
|
||||
if(!isset($message))
|
||||
{
|
||||
include("./header.inc.php3");
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Gets the variables sent or posted to this script, then displays headers
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
if (!isset($message)) {
|
||||
include('./header.inc.php3');
|
||||
} else {
|
||||
show_message($message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list and count of the tables
|
||||
*/
|
||||
$tables = mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
|
||||
if($num_tables == 0)
|
||||
{
|
||||
|
||||
/**
|
||||
* If there is at least one table, displays the printer friendly view, else
|
||||
* an error message
|
||||
*/
|
||||
// No table
|
||||
if ($num_tables == 0) {
|
||||
echo $strNoTablesFound;
|
||||
}
|
||||
else
|
||||
{
|
||||
// At least one table
|
||||
else {
|
||||
$i = 0;
|
||||
?>
|
||||
|
||||
echo "<table border=$cfgBorder>\n";
|
||||
echo '<th>' . UCFirst($strTable) . '</th>';
|
||||
echo "<th>$strRecords</th>";
|
||||
while($i < $num_tables)
|
||||
{
|
||||
<!-- The tables list -->
|
||||
<table border="<?php echo($cfgBorder); ?>">
|
||||
<tr>
|
||||
<th><?php echo ucfirst($strTable); ?></th>
|
||||
<th><?php echo ucfirst($strRecords); ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
while ($i < $num_tables) {
|
||||
$table = mysql_tablename($tables, $i);
|
||||
$query = "?server=$server&lang=$lang&db=$db&table=$table&goto=db_details.php3";
|
||||
$bgcolor = $cfgBgcolorOne;
|
||||
$i % 2 ? 0: $bgcolor = $cfgBgcolorTwo;
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $bgcolor = $cfgBgcolorTwo;
|
||||
echo "\n";
|
||||
?>
|
||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||
|
||||
<td class=data><b><?php echo $table;?></b></td>
|
||||
<td align="right"> <?php count_records($db,$table) ?></td>
|
||||
<td nowrap="nowrap">
|
||||
<b><?php echo htmlspecialchars($table); ?> </b>
|
||||
</td>
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php count_records($db, $table); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
|
||||
require("./footer.inc.php3");
|
||||
} // end while
|
||||
echo "\n";
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} // end if
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
116
db_readdump.php3
116
db_readdump.php3
@@ -1,81 +1,117 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Increases the max. allowed time to run a script
|
||||
*/
|
||||
@set_time_limit(10000);
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
|
||||
require("./lib.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
|
||||
// set up default values
|
||||
/**
|
||||
* Set up default values for some variables and
|
||||
*/
|
||||
$view_bookmark = 0;
|
||||
$sql_bookmark = isset($sql_bookmark) ? $sql_bookmark : "";
|
||||
$sql_query = isset($sql_query) ? $sql_query : "";
|
||||
$sql_file = isset($sql_file) ? $sql_file : "none";
|
||||
$sql_bookmark = isset($sql_bookmark) ? $sql_bookmark : '';
|
||||
$sql_query = isset($sql_query) ? $sql_query : '';
|
||||
$sql_file = isset($sql_file) ? $sql_file : 'none';
|
||||
|
||||
|
||||
// Bookmark Support
|
||||
/**
|
||||
* Bookmark Support: get a query back from bookmark if required
|
||||
*/
|
||||
if (!empty($id_bookmark)) {
|
||||
switch($action_bookmark) {
|
||||
case 0:
|
||||
case 0: // bookmarked query that have to be run
|
||||
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 1: // bookmarked query that have to be displayed
|
||||
$sql_query = query_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
$view_bookmark = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 2: // bookmarked query that have to be deleted
|
||||
$sql_query = delete_bookmarks($db, $cfgBookmark, $id_bookmark);
|
||||
break;
|
||||
}
|
||||
} // end if
|
||||
|
||||
|
||||
/**
|
||||
* Prepares the sql query
|
||||
*/
|
||||
// Gets the query from a file if required
|
||||
if ($sql_file != 'none') {
|
||||
if (ereg('^php[0-9A-Za-z_.-]+$', basename($sql_file))) {
|
||||
$sql_query = fread(fopen($sql_file, 'r'), filesize($sql_file));
|
||||
if (get_magic_quotes_runtime() == 1) {
|
||||
$sql_query = stripslashes($sql_query);
|
||||
}
|
||||
|
||||
|
||||
if($sql_file != "none") {
|
||||
// do file upload
|
||||
if(ereg("^php[0-9A-Za-z_.-]+$", basename($sql_file))) {
|
||||
$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
|
||||
if (get_magic_quotes_runtime() == 1) $sql_query = stripslashes($sql_query);
|
||||
}
|
||||
}
|
||||
else if (get_magic_quotes_gpc() == 1) {
|
||||
$sql_query = stripslashes($sql_query);
|
||||
}
|
||||
|
||||
$sql_query = trim($sql_query);
|
||||
$sql_query_cpy = $sql_query; // copy the query, used for display purposes only
|
||||
// $sql_query come from the query textarea, if it's a reposted query gets its
|
||||
// 'true' value
|
||||
if (!empty($prev_sql_query)) {
|
||||
$prev_sql_query = urldecode($prev_sql_query);
|
||||
if ($sql_query == trim(htmlspecialchars($prev_sql_query))) {
|
||||
$sql_query = $prev_sql_query;
|
||||
}
|
||||
}
|
||||
|
||||
if($sql_query != "") {
|
||||
// Copy the query, used for display purposes only
|
||||
$sql_query_cpy = $sql_query;
|
||||
|
||||
|
||||
/**
|
||||
* Executes the query
|
||||
*/
|
||||
if ($sql_query != '') {
|
||||
$sql_query = remove_remarks($sql_query);
|
||||
$pieces = split_sql_file($sql_query,";");
|
||||
$piecescount=count($pieces);
|
||||
$pieces = split_sql_file($sql_query, ';');
|
||||
$pieces_count = count($pieces);
|
||||
|
||||
if (count($pieces) == 1 && !empty($pieces[0]) && $view_bookmark == 0) {
|
||||
// Only one query to run
|
||||
if ($pieces_count == 1 && !empty($pieces[0]) && $view_bookmark == 0) {
|
||||
$sql_query = trim($pieces[0]);
|
||||
if (eregi('^CREATE TABLE (.+)', $sql_query)) $reload = "true";
|
||||
|
||||
// sql.php3 will stripslash the query if get_magic_quotes_gpc
|
||||
if (get_magic_quotes_gpc() == 1) $sql_query = addslashes($sql_query);
|
||||
include("./sql.php3");
|
||||
exit;
|
||||
if (get_magic_quotes_gpc() == 1) {
|
||||
$sql_query = addslashes($sql_query);
|
||||
}
|
||||
include('./sql.php3');
|
||||
exit();
|
||||
}
|
||||
|
||||
if(mysql_select_db($db)) {
|
||||
// run multiple queries
|
||||
for ($i=0; $i<$piecescount; $i++) {
|
||||
$sql = trim($pieces[$i]);
|
||||
if(!empty($sql) and $sql[0] != "#") $result = mysql_query($sql) or mysql_die2($sql);
|
||||
if (!isset($reload) && eregi('^CREATE TABLE (.+)', $pieces[$i])) $reload = "true";
|
||||
}
|
||||
// Runs multiple queries
|
||||
else if (mysql_select_db($db)) {
|
||||
for ($i = 0; $i < $pieces_count; $i++) {
|
||||
$a_sql_query = trim($pieces[$i]);
|
||||
if (!empty($a_sql_query) && $a_sql_query[0] != '#') {
|
||||
$result = mysql_query($a_sql_query) or mysql_die2('', $a_sql_query);
|
||||
}
|
||||
if (!isset($reload) && eregi('^(DROP|CREATE) +(TABLE|DATABASE) (.+)', $a_sql_query)) {
|
||||
$reload = 'true';
|
||||
}
|
||||
} // end for
|
||||
} // end else if
|
||||
} // end if
|
||||
|
||||
// copy the original query back for display purposes
|
||||
include("./header.inc.php3");
|
||||
|
||||
/**
|
||||
* Go back to db_details.php3
|
||||
*/
|
||||
// Copy the original query back for display purposes
|
||||
$sql_query = $sql_query_cpy;
|
||||
include('./header.inc.php3');
|
||||
$message = $strSuccess;
|
||||
require("./db_details.php3");
|
||||
require('./db_details.php3');
|
||||
?>
|
||||
|
@@ -1,51 +1,60 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
/* ---- DEFINE VARIABLES & CONSTANTS ---- */
|
||||
// Overview:
|
||||
// MYSQL_MAJOR_VERSION (double) - eg: 3.23
|
||||
// MYSQL_MINOR_VERSION (double) - eg: 39
|
||||
// PHPMYADMIN_VERSION (string) - PHPMYADMIN VERSION STRING
|
||||
// PMA_INT_VERSION (int) - (eg: 30017 instead of 3.0.17 or 40006 instead of 4.0.6RC3)
|
||||
// PMA_WINDOWS (bool) - mark if phpMyAdmin running on windows server
|
||||
|
||||
/**
|
||||
* DEFINES VARIABLES & CONSTANTS
|
||||
* Overview:
|
||||
* MYSQL_MAJOR_VERSION (double) - eg: 3.23
|
||||
* MYSQL_MINOR_VERSION (double) - eg: 39
|
||||
* PHPMYADMIN_VERSION (string) - phpMyAdmin version string
|
||||
* PMA_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or
|
||||
* 40006 instead of 4.0.6RC3
|
||||
* PMA_WINDOWS (bool) - mark if phpMyAdmin running on windows
|
||||
* server
|
||||
*/
|
||||
define('PHPMYADMIN_VERSION', '2.2.0rc4');
|
||||
|
||||
define("PHPMYADMIN_VERSION", "2.2.0rc3");
|
||||
|
||||
if (!ereg("([0-9]).([0-9]).([0-9])", phpversion(), $match))
|
||||
$result=ereg("([0-9]).([0-9])",phpversion(),$match);
|
||||
if (isset($match) && !empty($match[1]))
|
||||
{
|
||||
if (!isset($match[2])) $match[2]=0;
|
||||
if (!isset($match[3])) $match[3]=0;
|
||||
define ("PMA_INT_VERSION", (int)sprintf("%d%02d%02d",$match[1],$match[2],$match[3]));
|
||||
unset ($match);
|
||||
if (!ereg('([0-9]).([0-9]).([0-9])', phpversion(), $match)) {
|
||||
$result = ereg('([0-9]).([0-9])', phpversion(), $match);
|
||||
}
|
||||
if (isset($match) && !empty($match[1])) {
|
||||
if (!isset($match[2])) {
|
||||
$match[2] = 0;
|
||||
}
|
||||
if (!isset($match[3])) {
|
||||
$match[3] = 0;
|
||||
}
|
||||
define('PMA_INT_VERSION', (int)sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));
|
||||
unset($match);
|
||||
} else {
|
||||
define('PMA_INT_VERSION', FALSE);
|
||||
}
|
||||
else define ("PMA_INT_VERSION", false);
|
||||
|
||||
if (defined("PHP_OS") && eregi("win", PHP_OS)) define ("PMA_WINDOWS", true);
|
||||
else define ("PMA_WINDOWS", false);
|
||||
if (defined('PHP_OS') && eregi('win', PHP_OS)) {
|
||||
define('PMA_WINDOWS', TRUE);
|
||||
} else {
|
||||
define('PMA_WINDOWS', FALSE);
|
||||
}
|
||||
|
||||
// MySQL Version
|
||||
$result = @mysql_query("SELECT VERSION() AS version");
|
||||
if ($result!=false && @mysql_num_rows($result)>0){
|
||||
//$result = @mysql_query('SELECT VERSION() AS version');
|
||||
$result = mysql_query('SELECT VERSION() AS version');
|
||||
if ($result != FALSE && @mysql_num_rows($result) > 0) {
|
||||
$result = mysql_query('SELECT VERSION() AS version') or mysql_die();
|
||||
$row = mysql_fetch_array($result);
|
||||
define("MYSQL_MAJOR_VERSION", (double)substr($row["version"], 0, 4));
|
||||
define("MYSQL_MINOR_VERSION", (double)substr($row["version"], 5));
|
||||
}
|
||||
else{
|
||||
$result = @mysql_query("SHOW VARIABLES like 'version'");
|
||||
if ($result!=false && @mysql_num_rows($result)>0){
|
||||
define('MYSQL_MAJOR_VERSION', (double)substr($row['version'], 0, 4));
|
||||
define('MYSQL_MINOR_VERSION', (double)substr($row['version'], 5));
|
||||
} else {
|
||||
$result = @mysql_query('SHOW VARIABLES like \'version\'');
|
||||
if ($result != FALSE && @mysql_num_rows($result) > 0){
|
||||
$row = mysql_fetch_row($result);
|
||||
define("MYSQL_MAJOR_VERSION", (double)substr($row[1], 0, 4));
|
||||
define("MYSQL_MINOR_VERSION", (double)substr($row[1], 5));
|
||||
}
|
||||
else{
|
||||
define("MYSQL_MAJOR_VERSION", 3.21);
|
||||
define("MYSQL_MINOR_VERSION", 0);
|
||||
define('MYSQL_MAJOR_VERSION', (double)substr($row[1], 0, 4));
|
||||
define('MYSQL_MINOR_VERSION', (double)substr($row[1], 5));
|
||||
} else {
|
||||
define('MYSQL_MAJOR_VERSION', 3.21);
|
||||
define('MYSQL_MINOR_VERSION', 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------- */
|
||||
|
||||
?>
|
||||
|
@@ -1,9 +1,18 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
// In this file you may add PHP or HTML statements that will be used to define
|
||||
// the footer for phpMyAdmin pages.
|
||||
?>
|
||||
|
||||
</html>
|
||||
<?php
|
||||
if (isset($cfgOBGzip) && isset($ob_mode))
|
||||
|
||||
/**
|
||||
* Sends bufferized data
|
||||
*/
|
||||
if (isset($cfgOBGzip) && isset($ob_mode)) {
|
||||
out_buffer_post($ob_mode);
|
||||
}
|
||||
?>
|
||||
|
13
functions.js
13
functions.js
@@ -1,9 +1,6 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
var isFormElementInRange;
|
||||
|
||||
|
||||
/**
|
||||
* Ensures a value submitted in a form is numeric and is in a range
|
||||
*
|
||||
@@ -16,23 +13,21 @@ var isFormElementInRange;
|
||||
*/
|
||||
function checkFormElementInRange(theForm, theFieldName, min, max)
|
||||
{
|
||||
isFormElementInRange = true;
|
||||
var theField = theForm.elements[theFieldName];
|
||||
var val = parseInt(theField.value);
|
||||
var isRange = (typeof(min) != 'undefined' && typeof(max) != 'undefined');
|
||||
|
||||
// It's not a number
|
||||
if (isNaN(val)) {
|
||||
alert(errorMsg1);
|
||||
isFormElementInRange = false;
|
||||
theField.select();
|
||||
alert(errorMsg1);
|
||||
theField.focus();
|
||||
return false;
|
||||
}
|
||||
// It's a number but it is not between min and max
|
||||
else if (val < min || val > max) {
|
||||
alert(val + errorMsg2);
|
||||
isFormElementInRange = false;
|
||||
else if (isRange && (val < min || val > max)) {
|
||||
theField.select();
|
||||
alert(val + errorMsg2);
|
||||
theField.focus();
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,26 +1,32 @@
|
||||
<?php
|
||||
/* $Id$ */;
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* This library grabs the names and values of the variables sent or posted to a
|
||||
* script in the '$HTTP_*_VARS' arrays and sets simple globals variables from
|
||||
* them
|
||||
*/
|
||||
if (!defined('__LIB_GRAB_GLOBALS__')) {
|
||||
define('__LIB_GRAB_GLOBALS__', 1);
|
||||
|
||||
if (!empty($HTTP_GET_VARS)) {
|
||||
while(list($name, $value) = each($HTTP_GET_VARS)) {
|
||||
$$name = $value;
|
||||
}
|
||||
}
|
||||
} // end if
|
||||
|
||||
if (!empty($HTTP_POST_VARS)) {
|
||||
while(list($name, $value) = each($HTTP_POST_VARS)) {
|
||||
$$name = $value;
|
||||
}
|
||||
}
|
||||
} // end if
|
||||
|
||||
if (!empty($HTTP_POST_FILES)) {
|
||||
while(list($name, $value) = each($HTTP_POST_FILES)) {
|
||||
$$name = $value['tmp_name'];
|
||||
}
|
||||
}
|
||||
} // end if
|
||||
|
||||
} // end __LIB_GRAB_GLOBALS__
|
||||
?>
|
@@ -1,18 +1,23 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets a core script and starts output buffering work
|
||||
*/
|
||||
require('./lib.inc.php3');
|
||||
require('./ob_lib.inc.php3');
|
||||
|
||||
if ($cfgOBGzip)
|
||||
{
|
||||
$ob_mode = out_buffer_mode_get();
|
||||
if ($ob_mode)
|
||||
if ($ob_mode) {
|
||||
out_buffer_pre($ob_mode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send http headers
|
||||
* Sends http headers
|
||||
*/
|
||||
// Don't use cache (required for Opera)
|
||||
$now = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||
@@ -24,8 +29,14 @@ header('Pragma: no-cache'); // HTTP/1.0
|
||||
// Define the charset to be used
|
||||
header('Content-Type: text/html; charset=' . $charset);
|
||||
|
||||
|
||||
/**
|
||||
* Sends the beginning of the html page then returns to the calling script
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>phpMyAdmin</title>
|
||||
<style type="text/css">
|
||||
@@ -49,10 +60,11 @@ A:hover.nav {font-family: <?php echo $right_font_family; ?>; color: #FF0000}
|
||||
<body bgcolor="#F5F5F5" text="#000000" background="images/bkg.gif">
|
||||
<?php
|
||||
if (isset($db)) {
|
||||
echo "<h1> $strDatabase $db";
|
||||
echo '<h1> ' . $strDatabase . ' ' . htmlspecialchars($db);
|
||||
if (isset($table) && !isset($btnDrop)) {
|
||||
echo " - $strTable $table";
|
||||
echo ' - ' . $strTable . ' ' . htmlspecialchars($table);
|
||||
}
|
||||
echo '</h1>' . "\n";
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
|
22
index.php3
22
index.php3
@@ -1,5 +1,11 @@
|
||||
<?php
|
||||
// Process config file to determine default server (if any)
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets core libraries and processes config file to determine default server
|
||||
* (if any)
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
@@ -12,16 +18,24 @@ if (empty($HTTP_HOST)) {
|
||||
$HTTP_HOST = getenv('HTTP_HOST');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
/**
|
||||
* Defines the frameset
|
||||
*/
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. (empty($db) ? '' : '&db=' . urlencode($db));
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>phpMyAdmin <?php echo PHPMYADMIN_VERSION; ?> - <?php echo $HTTP_HOST; ?></title>
|
||||
</head>
|
||||
|
||||
<frameset cols="<?php echo $cfgLeftWidth;?>,*" rows="*" border="0" frameborder="0">
|
||||
<frame src="left.php3?server=<?php echo $server;?>&lang=<?php echo $lang; echo (empty($db)) ? '' : '&db=' . urlencode($db); ?>" name="nav">
|
||||
<frame src="<?php echo (empty($db)) ? 'main.php3' : 'db_details.php3'; ?>?server=<?php echo $server;?>&lang=<?php echo $lang; echo (empty($db)) ? '' : '&db=' . urlencode($db); ?>" name="phpmain">
|
||||
<frame src="left.php3?<?php echo $url_query; ?>" name="nav">
|
||||
<frame src="<?php echo (empty($db)) ? 'main.php3' : 'db_details.php3'; ?>?<?php echo $url_query; ?>" name="phpmain">
|
||||
</frameset>
|
||||
<noframes>
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
128
ldi_check.php3
128
ldi_check.php3
@@ -2,72 +2,102 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/* This file checks and builds the sql-string for
|
||||
LOAD DATA INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE table_name
|
||||
[FIELDS
|
||||
[TERMINATED BY '\t']
|
||||
[OPTIONALLY] ENCLOSED BY "]
|
||||
[ESCAPED BY '\\' ]]
|
||||
[LINES TERMINATED BY '\n']
|
||||
[(column_name,...)]
|
||||
/**
|
||||
* This file checks and builds the sql-string for
|
||||
* LOAD DATA INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE table_name
|
||||
* [FIELDS
|
||||
* [TERMINATED BY '\t']
|
||||
* [OPTIONALLY] ENCLOSED BY "]
|
||||
* [ESCAPED BY '\\' ]]
|
||||
* [LINES TERMINATED BY '\n']
|
||||
* [(column_name,...)]
|
||||
*/
|
||||
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core scripts
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
|
||||
if (isset($btnLDI) && ($textfile != "none"))
|
||||
{
|
||||
if(!isset($replace))
|
||||
$replace = "";
|
||||
|
||||
$textfile=addslashes($textfile);
|
||||
|
||||
/**
|
||||
* The form used to define the query has been submitted -> do the work
|
||||
*/
|
||||
if (isset($btnLDI) && ($textfile != 'none')) {
|
||||
if (!isset($replace)) {
|
||||
$replace = '';
|
||||
}
|
||||
|
||||
// Formats the data posted to this script
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$stripped_field_terminater = stripslashes($field_terminater);
|
||||
$stripped_escaped = stripslashes($escaped);
|
||||
$stripped_line_terminator = stripslashes($line_terminator);
|
||||
$textfile = sql_addslashes(stripslashes($textfile));
|
||||
$field_terminater = sql_addslashes(stripslashes($field_terminater));
|
||||
$enclosed = sql_addslashes(stripslashes(str_replace('"', '"', $enclosed)));
|
||||
$escaped = sql_addslashes(stripslashes($escaped));
|
||||
$line_terminator = sql_addslashes(stripslashes($line_terminator));
|
||||
$column_name = sql_addslashes(stripslashes($column_name));
|
||||
} else {
|
||||
$stripped_field_terminater = $field_terminater;
|
||||
$stripped_escaped = $escaped;
|
||||
$stripped_line_terminator = $line_terminator;
|
||||
}
|
||||
$query = "LOAD DATA LOCAL INFILE '$textfile' $replace INTO TABLE $into_table ";
|
||||
if (isset($field_terminater))
|
||||
{ $query = $query . "FIELDS TERMINATED BY '".$stripped_field_terminater."' ";
|
||||
$textfile = sql_addslashes($textfile);
|
||||
$field_terminater = sql_addslashes($field_terminater);
|
||||
$enclosed = sql_addslashes(str_replace('"', '"', $enclosed));
|
||||
$escaped = sql_addslashes($escaped);
|
||||
$line_terminator = sql_addslashes($line_terminator);
|
||||
$column_name = sql_addslashes($column_name);
|
||||
}
|
||||
|
||||
if (isset($enclose_option) && strlen($enclose_option)>0)
|
||||
{ $query = $query . "OPTIONALLY ";
|
||||
}
|
||||
|
||||
if (strlen($enclosed)>0)
|
||||
{ $query = $query . "ENCLOSED BY '$enclosed' ";
|
||||
}
|
||||
|
||||
if (strlen($escaped)>0)
|
||||
{ $query = $query . "ESCAPED BY '".$stripped_escaped."' ";
|
||||
}
|
||||
|
||||
if (strlen($line_terminator)>0)
|
||||
{ $query = $query . "LINES TERMINATED BY '".$stripped_line_terminator."' ";
|
||||
}
|
||||
|
||||
if (strlen($column_name)>0)
|
||||
{ $query = $query . "($column_name)";
|
||||
// Builds the query
|
||||
$query = 'LOAD DATA LOCAL INFILE \'' . $textfile . '\'';
|
||||
if (!empty($replace)) {
|
||||
$query .= ' ' . $replace;
|
||||
}
|
||||
$query .= ' INTO TABLE ' . backquote($into_table);
|
||||
if (isset($field_terminater)) {
|
||||
$query .= ' FIELDS TERMINATED BY \'' . $field_terminater . '\'';
|
||||
}
|
||||
if (isset($enclose_option) && strlen($enclose_option) > 0) {
|
||||
$query .= ' OPTIONALLY';
|
||||
}
|
||||
if (strlen($enclosed) > 0) {
|
||||
$query .= ' ENCLOSED BY \'' . $enclosed . '\'';
|
||||
}
|
||||
if (strlen($escaped) > 0) {
|
||||
$query .= ' ESCAPED BY \'' . $escaped . '\'';
|
||||
}
|
||||
if (strlen($line_terminator) > 0){
|
||||
$query .= ' LINES TERMINATED BY \'' . $line_terminator . '\'';
|
||||
}
|
||||
if (strlen($column_name) > 0) {
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) {
|
||||
$query .= ' (';
|
||||
$tmp = split(',( ?)', $column_name);
|
||||
for ($i = 0; $i < count($tmp); $i++) {
|
||||
if ($i > 0) {
|
||||
$query .= ', ';
|
||||
}
|
||||
$query .= backquote(trim($tmp[$i]));
|
||||
} // end for
|
||||
$query .= ')';
|
||||
} else {
|
||||
$query .= ' (' . $column_name . ')';
|
||||
}
|
||||
}
|
||||
|
||||
// Executes the query
|
||||
// sql.php3 will stripslash the query if 'magic_quotes_gpc' is set to on
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$sql_query = addslashes($query);
|
||||
} else {
|
||||
$sql_query = $query;
|
||||
}
|
||||
include("./sql.php3");
|
||||
include('./sql.php3');
|
||||
}
|
||||
else
|
||||
{
|
||||
include("./ldi_table.php3");
|
||||
|
||||
|
||||
/**
|
||||
* The form used to define the query hasn't been yet submitted -> loads it
|
||||
*/
|
||||
else {
|
||||
include('./ldi_table.php3');
|
||||
}
|
||||
?>
|
||||
|
@@ -2,75 +2,91 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
// This file inserts a textfile into a table
|
||||
/**
|
||||
* This file defines the forms used to insert a textfile into a table
|
||||
*/
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
require("./header.inc.php3");
|
||||
|
||||
/**
|
||||
* Gets the list of available tables
|
||||
*/
|
||||
$tables = mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
?>
|
||||
|
||||
|
||||
/**
|
||||
* Displays the form
|
||||
*/
|
||||
?>
|
||||
<form action="ldi_check.php3" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="goto" value="tbl_properties.php3">
|
||||
<table border="1">
|
||||
<table cellpadding="5" border="2">
|
||||
<tr>
|
||||
<td><?php echo $strLocationTextfile; ?></td>
|
||||
<td colspan=2><input type="file" name="textfile"></td>
|
||||
<td colspan="2"><input type="file" name="textfile" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $strReplaceTable; ?></td>
|
||||
<td><input type="checkbox" name="replace" value="REPLACE"><?php echo $strReplace; ?></td>
|
||||
<td><input type="checkbox" name="replace" value="REPLACE" /><?php echo $strReplace; ?></td>
|
||||
<td><?php echo $strTheContents; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $strFields; ?><br><?php echo $strTerminatedBy; ?></td>
|
||||
<td><input type="text" name="field_terminater" size="2" maxlength="2" value=";"></td>
|
||||
<td><?php echo $strFields; ?><br /><?php echo $strTerminatedBy; ?></td>
|
||||
<td><input type="text" name="field_terminater" size="2" maxlength="2" value=";" /></td>
|
||||
<td><?php echo $strTheTerminator; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $strFields; ?><br><?php echo $strEnclosedBy; ?></td>
|
||||
<td><input type="text" name="enclosed" size="1" maxlength="1" value=""">
|
||||
<input type="Checkbox" name="enclose_option" value="OPTIONALLY"><?php echo $strOptionally; ?>
|
||||
<td><?php echo $strFields; ?><br /><?php echo $strEnclosedBy; ?></td>
|
||||
<td>
|
||||
<input type="text" name="enclosed" size="1" maxlength="1" value=""" />
|
||||
<input type="checkbox" name="enclose_option" value="OPTIONALLY" /><?php echo $strOptionally . "\n"; ?>
|
||||
</td>
|
||||
<td><?php echo $strOftenQuotation; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $strFields; ?><br><?php echo $strEscapedBy; ?></td>
|
||||
<td><input type="text" name="escaped" size="2" maxlength="2" value="\\"></td>
|
||||
<td><?php echo $strFields; ?><br /><?php echo $strEscapedBy; ?></td>
|
||||
<td><input type="text" name="escaped" size="2" maxlength="2" value="\" /></td>
|
||||
<td><?php echo $strOptionalControls; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $strLines; ?><br><?php echo $strTerminatedBy; ?></td>
|
||||
<td><input type="text" name="line_terminator" size="8" maxlength="8" value="\n"></td>
|
||||
<td><?php echo $strCarriage; ?><br><?php echo $strLineFeed; ?></td>
|
||||
<td><?php echo $strLines; ?><br /><?php echo $strTerminatedBy; ?></td>
|
||||
<td><input type="text" name="line_terminator" size="8" maxlength="8" value="<?php echo ((which_crlf() == "\n") ? '\n' : '\r\n'); ?>" /></td>
|
||||
<td><?php echo $strCarriage; ?><br /><?php echo $strLineFeed; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $strColumnNames; ?></td>
|
||||
<td><input type="text" name="column_name"></td>
|
||||
<td><input type="text" name="column_name" /></td>
|
||||
<td><?php echo $strIfYouWish; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center"><?php print show_docu("manual_Reference.html#LOAD_DATA");?></td>
|
||||
<td colspan="3" align="center"><?php print show_docu('manual_Reference.html#LOAD_DATA'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<input type="Hidden" name="server" value="<?php echo $server ?>">
|
||||
<input type="Hidden" name="db" value="<?php echo $db; ?>">
|
||||
<input type="Hidden" name="table" value="<?php echo $table; ?>">
|
||||
<input type="Hidden" name="zero_rows" value="<?php echo $strTheContent; ?>">
|
||||
<input type="Hidden" name="into_table" value="<?php echo $table; ?>">
|
||||
<input type="Submit" name="btnLDI" value=" <?php echo $strSubmit; ?> ">
|
||||
<input type="Reset" value=" <?php echo $strReset; ?> ">
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||
<input type="hidden" name="zero_rows" value="<?php echo $strTheContent; ?>" />
|
||||
<input type="hidden" name="goto" value="tbl_properties.php3" />
|
||||
<input type="hidden" name="into_table" value="<?php echo $table; ?>" />
|
||||
<input type="submit" name="btnLDI" value="<?php echo $strSubmit; ?>" />
|
||||
<input type="reset" value="<?php echo $strReset; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require("./footer.inc.php3");
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
1
left.js
1
left.js
@@ -1,5 +1,6 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
// These scripts were originally found on cooltype.com.
|
||||
// Modified 01/01/1999 by Tobias Ratschiller for linuxapps.com
|
||||
|
||||
|
14
left.php3
14
left.php3
@@ -138,7 +138,7 @@ echo "\n";
|
||||
<body bgcolor="#D0DCE0">
|
||||
<!-- Link to the welcome page -->
|
||||
<div id="el1Parent" class="parent" style="margin-bottom: 5px">
|
||||
<a class="item" href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>">
|
||||
<a class="item" href="main.php3?lang=<?php echo $lang; ?>&server=<?php echo $server; ?>">
|
||||
<font color="black" class="heada"><b><?php echo $strHome; ?></b></font></a>
|
||||
</div>
|
||||
|
||||
@@ -169,7 +169,9 @@ if ($num_dbs > 1) {
|
||||
}
|
||||
$tables = @mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
$common_url_query = "server=$server&lang=$lang&db=$db";
|
||||
$common_url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db);
|
||||
|
||||
// Displays the database name
|
||||
echo "\n";
|
||||
@@ -202,7 +204,7 @@ if ($num_dbs > 1) {
|
||||
echo "\n";
|
||||
?>
|
||||
<nobr><img src="images/spacer.gif" border="0" width="9" height="9" alt="" />
|
||||
<a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>&sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0&goto=tbl_properties.php3">
|
||||
<a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0&goto=tbl_properties.php3">
|
||||
<img src="images/browse.gif" border="0" alt="<?php echo "$strBrowse: $table"; ?>" /></a>
|
||||
<a class="tblItem" target="phpmain" href="tbl_properties.php3?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>">
|
||||
<?php echo $table; ?></a></nobr><br />
|
||||
@@ -242,7 +244,9 @@ else if ($num_dbs == 1) {
|
||||
}
|
||||
$tables = @mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
$common_url_query = "server=$server&lang=$lang&db=$db";
|
||||
$common_url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db);
|
||||
|
||||
// Displays the database name
|
||||
echo "\n";
|
||||
@@ -258,7 +262,7 @@ else if ($num_dbs == 1) {
|
||||
$table = mysql_tablename($tables, $j);
|
||||
echo "\n";
|
||||
?>
|
||||
<nobr><a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>&sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0&goto=tbl_properties.php3">
|
||||
<nobr><a target="phpmain" href="sql.php3?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0&goto=tbl_properties.php3">
|
||||
<img src="images/browse.gif" border="0" alt="<?php echo "$strBrowse: $table"; ?>" /></a>
|
||||
<a class="tblItem" target="phpmain" href="tbl_properties.php3?<?php echo $common_url_query; ?>&table=<?php echo urlencode($table); ?>">
|
||||
<?php echo $table; ?></a></nobr><br />
|
||||
|
1828
lib.inc.php3
1828
lib.inc.php3
File diff suppressed because it is too large
Load Diff
55
main.php3
55
main.php3
@@ -2,15 +2,12 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets some core libraries and displays a top message if required
|
||||
* TODO: The included script aren't yet xhtml1.0 compliant
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
if (isset($message)) {
|
||||
include('./lib.inc.php3');
|
||||
show_message($message);
|
||||
}
|
||||
|
||||
@@ -25,7 +22,7 @@ if (empty($cfgLang)) {
|
||||
$lang_name = ucfirst(substr(strstr($tmplang[0], '|'), 1));
|
||||
echo "\n";
|
||||
?>
|
||||
[ <a href="index.php3?server=<?php echo $server;?>&lang=<?php echo $id;?>" target="_top" title="<?php echo $lang_name;?>"><?php echo $id;?></a> ]
|
||||
[ <a href="index.php3?lang=<?php echo $id; ?>&server=<?php echo urlencode($server); ?>" target="_top" title="<?php echo $lang_name; ?>"><?php echo $id; ?></a> ]
|
||||
<?php
|
||||
}
|
||||
echo "\n<p><br />\n";
|
||||
@@ -35,11 +32,10 @@ if (empty($cfgLang)) {
|
||||
/**
|
||||
* Displays the welcome message and the server informations
|
||||
*/
|
||||
?>
|
||||
<h1><?php echo $strWelcome . ' phpMyAdmin ' . PHPMYADMIN_VERSION; ?></h1>
|
||||
|
||||
echo "<h1>$strWelcome phpMyAdmin ";
|
||||
echo PHPMYADMIN_VERSION;
|
||||
echo "</h1>\n";
|
||||
|
||||
<?php
|
||||
// Don't display server info if $server == 0 (no server selected)
|
||||
if ($server > 0) {
|
||||
$res_version = mysql_query('SELECT Version() as version') or mysql_die();
|
||||
@@ -116,6 +112,8 @@ if ($server == 0 || count($cfgServers) > 1) {
|
||||
if ($server > 0
|
||||
&& empty($cfgServer['only_db']))
|
||||
{
|
||||
$common_url_query = 'lang=' . $lang . '&server=' . urlencode($server);
|
||||
|
||||
// 2.1. With authentication
|
||||
if ($cfgServer['adv_auth'])
|
||||
{
|
||||
@@ -126,36 +124,35 @@ if ($server > 0
|
||||
$stdlink = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
}
|
||||
// Does user have global Create priv?
|
||||
$rs_usr = mysql_query('select * from mysql.user where User="' . $cfgServer['user'] . '"', $stdlink);
|
||||
$rs_usr = mysql_query('SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'', $stdlink);
|
||||
$result_usr = mysql_fetch_array($rs_usr);
|
||||
$create = ($result_usr['Create_priv'] == 'Y');
|
||||
$db_to_create = "";
|
||||
$db_to_create = '';
|
||||
|
||||
// Does user have Create priv on a inexistant db?
|
||||
// if yes, show him in the dialog the first inexistant db name
|
||||
// that we find, in most cases it's probably the one he just dropped :)
|
||||
// if yes, show him in the dialog the first inexistant db name that we
|
||||
// find, in most cases it's probably the one he just dropped :)
|
||||
// (Note: we only get here after a browser reload, I don't know why)
|
||||
|
||||
if (!$create) {
|
||||
|
||||
if (empty($cfgServer['port'])) {
|
||||
$userlink = mysql_connect($cfgServer['host'], $cfgServer['user'], $cfgServer['password']) or mysql_die();
|
||||
$userlink = mysql_connect($cfgServer['host'], $cfgServer['user'],
|
||||
$cfgServer['password']) or mysql_die();
|
||||
} else {
|
||||
$userlink = mysql_connect($cfgServer['host'].":".
|
||||
$cfgServer['port'], $cfgServer['user'],
|
||||
$cfgServer['password']) or mysql_die();
|
||||
}
|
||||
$rs_usr = mysql_query('select Db from mysql.db where User="'
|
||||
. $cfgServer['user'] . '"', $stdlink);
|
||||
$rs_usr = mysql_query('SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'', $stdlink);
|
||||
while ($row = mysql_fetch_array($rs_usr)) {
|
||||
if (!mysql_select_db($row['Db'],$userlink)) {
|
||||
$db_to_create = $row['Db'];
|
||||
$create=true;
|
||||
$create = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The user is allowed the create a db
|
||||
// The user is allowed to create a db
|
||||
if ($create) {
|
||||
echo "\n";
|
||||
?>
|
||||
@@ -179,11 +176,11 @@ if ($server > 0
|
||||
?>
|
||||
<!-- server-related links -->
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>&display=simple">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>&display=simple">
|
||||
<?php echo $strMySQLShowStatus; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>&display=simple">
|
||||
<a href="sql.php3?<?php $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>&display=simple">
|
||||
<?php echo $strMySQLShowVars;?></a> <?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
@@ -193,7 +190,7 @@ if ($server > 0
|
||||
if ($result_usr['Process_priv'] == 'Y') {
|
||||
?>
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>&display=simple">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>&display=simple">
|
||||
<?php echo $strMySQLShowProcess; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
@@ -203,7 +200,7 @@ if ($server > 0
|
||||
if ($result_usr['Reload_priv'] == 'Y') {
|
||||
?>
|
||||
<li>
|
||||
<a href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&mode=reload">
|
||||
<a href="main.php3?<?php echo $common_url_query; ?>&mode=reload">
|
||||
<?php echo $strReloadMySQL; ?></a> <?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
@@ -215,7 +212,7 @@ if ($server > 0
|
||||
if (!empty($rows)) {
|
||||
?>
|
||||
<li>
|
||||
<a href="user_details.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&table=user">
|
||||
<a href="user_details.php3?<?php echo $common_url_query; ?>&db=mysql&table=user">
|
||||
<?php echo $strUsers; ?></a> <?php echo show_docu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
@@ -223,7 +220,7 @@ if ($server > 0
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<a href="index.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&old_usr=<?php echo $PHP_AUTH_USER; ?>" target="_top">
|
||||
<a href="index.php3?<?php echo$common_url_query; ?>&old_usr=<?php echo urlencode($PHP_AUTH_USER); ?>" target="_top">
|
||||
<b><?php echo $strLogout; ?></b></a>
|
||||
</li>
|
||||
<br /><br />
|
||||
@@ -249,22 +246,22 @@ if ($server > 0
|
||||
|
||||
<!-- server-related links -->
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>">
|
||||
<?php echo $strMySQLShowStatus; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>">
|
||||
<?php echo $strMySQLShowVars; ?></a> <?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>">
|
||||
<?php echo $strMySQLShowProcess; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&mode=reload">
|
||||
<a href="main.php3?<?php echo $common_url_query; ?>&mode=reload">
|
||||
<?php echo $strReloadMySQL; ?></a> <?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
|
||||
</li>
|
||||
<br /><br />
|
||||
@@ -290,7 +287,7 @@ if ($server > 0
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
* TODO: The included script aren't yet xhtml1.0 compliant
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
if(!defined("__OB_LIB_INC__"))
|
||||
define("__OB_LIB_INC__", 1);
|
||||
if(!defined('__OB_LIB_INC__')) {
|
||||
define('__OB_LIB_INC__', 1);
|
||||
|
||||
|
||||
# Output buffer functions for phpMyAdmin
|
||||
|
||||
@@ -79,4 +80,6 @@
|
||||
return $retval;
|
||||
}
|
||||
|
||||
} // INC
|
||||
|
||||
?>
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* phpMyAdmin Language Loading File - lolo@phpheaven.net 01 may 2001
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define the path to the translations directory and get some variables
|
||||
* from system arrays if 'register_globals' is set to 'off'
|
||||
@@ -15,7 +15,7 @@ $lang_path = 'lang/';
|
||||
|
||||
|
||||
/**
|
||||
* All the suported languages have to be listed in the array below.
|
||||
* All the supported languages have to be listed in the array below.
|
||||
* 1. The key key must be the "official" ISO language code and, if required,
|
||||
* the dialect code. It can also contains some informations about the
|
||||
* charset (see the Russian case).
|
||||
@@ -64,7 +64,6 @@ $available_languages = array(
|
||||
'zh' => array('zh|chinese simplified', 'chinese_gb')
|
||||
);
|
||||
|
||||
|
||||
if (!defined('__PMA_LANG_DETECT__')) {
|
||||
define('__PMA_LANG_DETECT__', 1);
|
||||
|
||||
@@ -150,7 +149,6 @@ if (empty($lang) && !empty($HTTP_USER_AGENT)) {
|
||||
if (empty($lang)) {
|
||||
$lang = $cfgDefaultLang;
|
||||
}
|
||||
|
||||
// Define the associated filename and load the translation
|
||||
$lang_file = $lang_path . $available_languages[$lang][1] . '.inc.php3';
|
||||
require('./' . $lang_file);
|
||||
|
288
sql.php3
288
sql.php3
@@ -1,95 +1,128 @@
|
||||
<?php
|
||||
/* $Id$ */;
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
require("./lib.inc.php3");
|
||||
|
||||
if(isset($goto) && $goto == "sql.php3")
|
||||
{
|
||||
/**
|
||||
* Gets the true sql query
|
||||
*/
|
||||
// $sql_query has been urlencoded in the confirmation form for drop/delete
|
||||
// queries or in the navigation bar for browsing among records
|
||||
if (isset($btnDrop) || isset($navig)) {
|
||||
$sql_query = urldecode($sql_query);
|
||||
if (isset($sql_order)) {
|
||||
$sql_order = urldecode($sql_order);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Go back to further page if table should not be dropped
|
||||
*/
|
||||
if (isset($goto) && $goto == 'sql.php3') {
|
||||
$goto = "sql.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&sql_query=" . urlencode($sql_query);
|
||||
}
|
||||
|
||||
// Go back to further page if table should not be dropped
|
||||
|
||||
|
||||
if (isset($btnDrop) && $btnDrop == $strNo) {
|
||||
if(file_exists("./$goto")) {
|
||||
if (file_exists('./' . $goto)) {
|
||||
include('./' . preg_replace('/\.\.*/', '.', $goto));
|
||||
} else {
|
||||
Header("Location: $goto");
|
||||
}
|
||||
exit;
|
||||
header('Location: ' . $goto);
|
||||
}
|
||||
exit();
|
||||
} // end if
|
||||
|
||||
// Check if table should be dropped or if a record should be deleted
|
||||
$is_drop_sql_query = eregi("DROP +(TABLE|DATABASE)|ALTER TABLE +[[:alnum:]_]* +DROP|DELETE FROM", $sql_query);
|
||||
|
||||
if(!$cfgConfirm)
|
||||
$btnDrop = $strYes;
|
||||
/**
|
||||
* Defines some "properties" of the sql query to submit
|
||||
*/
|
||||
$do_confirm = ($cfgConfirm
|
||||
&& !isset($btnDrop)
|
||||
&& eregi('DROP +(TABLE|DATABASE)|ALTER TABLE +[[:alnum:]_]* +DROP|DELETE FROM', $sql_query));
|
||||
$is_select = eregi('^SELECT ', $sql_query);
|
||||
$is_delupd = eregi('^(DELETE|UPDATE) ', $sql_query);
|
||||
|
||||
if($is_drop_sql_query && !isset($btnDrop)) {
|
||||
|
||||
/**
|
||||
* Displays the confirm page if required
|
||||
*/
|
||||
if ($do_confirm) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$stripped_sql_query = stripslashes($sql_query);
|
||||
} else {
|
||||
$stripped_sql_query = $sql_query;
|
||||
}
|
||||
// loic1: fix bugs when the query contains js instructions and html tags or
|
||||
// entities
|
||||
$stripped_sql_query = str_replace('&', '&', $stripped_sql_query);
|
||||
$stripped_sql_query = ereg_replace('(\\")|(")', '"', $stripped_sql_query);
|
||||
$stripped_sql_query = str_replace('<', '<', $stripped_sql_query);
|
||||
$stripped_sql_query = str_replace('>', '>', $stripped_sql_query);
|
||||
|
||||
include("./header.inc.php3");
|
||||
echo $strDoYouReally.$stripped_sql_query."?<br>";
|
||||
include('./header.inc.php3');
|
||||
echo $strDoYouReally . htmlspecialchars($sql_query) . ' ?<br/>';
|
||||
?>
|
||||
<form action="sql.php3" method="post" enctype="application/x-www-form-urlencoded">
|
||||
<input type="hidden" name="sql_query" value="<?php echo $stripped_sql_query; ?>">
|
||||
<input type="hidden" name="server" value="<?php echo $server ?>">
|
||||
<input type="hidden" name="lang" value="<?php echo $lang;?>">
|
||||
<input type="hidden" name="db" value="<?php echo $db ?>">
|
||||
<input type="hidden" name="zero_rows" value="<?php echo isset($zero_rows) ? $zero_rows : "";?>">
|
||||
<input type="hidden" name="table" value="<?php echo isset($table) ? $table : "";?>">
|
||||
<input type="hidden" name="goto" value="<?php echo isset($goto) ? $goto : "";?>">
|
||||
<input type="hidden" name="reload" value="<?php echo isset($reload) ? $reload : "";?>">
|
||||
<input type="hidden" name="show_query" value="<?php echo isset($show_query) ? $show_query : "";?>">
|
||||
<input type="Submit" name="btnDrop" value="<?php echo $strYes; ?>">
|
||||
<input type="Submit" name="btnDrop" value="<?php echo $strNo; ?>">
|
||||
<input type="hidden" name="sql_query" value="<?php echo urlencode($sql_query); ?>" />
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="zero_rows" value="<?php echo isset($zero_rows) ? $zero_rows : ''; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo isset($table) ? $table : ''; ?>" />
|
||||
<input type="hidden" name="goto" value="<?php echo isset($goto) ? $goto : ''; ?>" />
|
||||
<input type="hidden" name="reload" value="<?php echo isset($reload) ? $reload : ''; ?>" />
|
||||
<input type="hidden" name="show_query" value="<?php echo isset($show_query) ? $show_query : ''; ?>" />
|
||||
<input type="submit" name="btnDrop" value="<?php echo $strYes; ?>" />
|
||||
<input type="submit" name="btnDrop" value="<?php echo $strNo; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
// if table should be dropped or other queries should be perfomed
|
||||
//elseif (!$is_drop_sql_query || $btnDrop == $strYes)
|
||||
echo "\n";
|
||||
} // end if
|
||||
|
||||
|
||||
/**
|
||||
* Executes the query and displays results
|
||||
*/
|
||||
else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$sql_query = isset($sql_query) ? stripslashes($sql_query) : '';
|
||||
$sql_order = isset($sql_order) ? stripslashes($sql_order) : '';
|
||||
} else {
|
||||
if (!isset($sql_query)) {
|
||||
$sql_query = '';
|
||||
}
|
||||
else {
|
||||
if (!isset($sql_query)) $sql_query = '';
|
||||
if (!isset($sql_order)) $sql_order = '';
|
||||
if (!isset($sql_order)) {
|
||||
$sql_order = '';
|
||||
}
|
||||
}
|
||||
|
||||
//defines some variables
|
||||
// loic1: A table have to be created -> left frame should be reloaded
|
||||
if (!empty($reload) && eregi("^CREATE TABLE (.*)", $sql_query))
|
||||
if (!empty($reload) && eregi('^CREATE TABLE (.*)', $sql_query)) {
|
||||
$reload = 'true';
|
||||
if(isset($sessionMaxRows))
|
||||
$cfgMaxRows = $sessionMaxRows;
|
||||
$sql_limit = (isset($pos) && eregi("^SELECT", $sql_query) && !eregi("LIMIT[ 0-9,]+$", $sql_query)) ? " LIMIT $pos, $cfgMaxRows" : '';
|
||||
mysql_select_db($db);
|
||||
|
||||
$result = @mysql_query($sql_query.$sql_order.$sql_limit);
|
||||
|
||||
// Count the total number of rows for the same 'SELECT' query without the
|
||||
// 'LIMIT' clause that may have been programatically added
|
||||
if (empty($sql_limit)) {
|
||||
$SelectNumRows = @mysql_num_rows($result);
|
||||
}
|
||||
else if (eregi("^SELECT", $sql_query)) {
|
||||
$array = split(' from | FROM ',$sql_query,2); //read only the from-part of the query
|
||||
if (isset($sessionMaxRows)) {
|
||||
$cfgMaxRows = $sessionMaxRows;
|
||||
}
|
||||
$sql_limit_to_append = (isset($pos) && $is_select && !eregi(' LIMIT[ 0-9,]+$', $sql_query))
|
||||
? " LIMIT $pos, $cfgMaxRows"
|
||||
: '';
|
||||
$full_sql_query = $sql_query . $sql_order . $sql_limit_to_append;
|
||||
|
||||
// Executes the query and gets the number of rows returned
|
||||
mysql_select_db($db);
|
||||
$result = @mysql_query($full_sql_query);
|
||||
$num_rows = @mysql_num_rows($result);
|
||||
|
||||
// Counts the total number of rows for the same 'SELECT' query without the
|
||||
// 'LIMIT' clause that may have been programatically added
|
||||
if (empty($sql_limit_to_append)) {
|
||||
$SelectNumRows = $num_rows;
|
||||
}
|
||||
else if ($is_select) {
|
||||
// reads only the from-part of the query...
|
||||
$array = split(' from | FROM ', $sql_query, 2);
|
||||
if (!empty($array[1])) {
|
||||
$count_query = "select count(*) as count from $array[1]"; //and make a count(*) to count the entries
|
||||
// ... and makes a count(*) to count the entries
|
||||
$count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1];
|
||||
$OPresult = mysql_query($count_query);
|
||||
if ($OPresult) {
|
||||
$SelectNumRows = mysql_result($OPresult, 0, 'count');
|
||||
@@ -99,45 +132,44 @@ else {
|
||||
}
|
||||
} // end rows total count
|
||||
|
||||
if(!$result)
|
||||
{
|
||||
// Displays an error message if required
|
||||
if (!$result) {
|
||||
$error = mysql_error();
|
||||
include("./header.inc.php3");
|
||||
include('./header.inc.php3');
|
||||
mysql_die($error);
|
||||
}
|
||||
} // end if
|
||||
|
||||
$num_rows = @mysql_num_rows($result);
|
||||
|
||||
if($num_rows < 1)
|
||||
{
|
||||
if(file_exists("./$goto"))
|
||||
{
|
||||
if(isset($zero_rows) && !empty($zero_rows))
|
||||
// No rows returned -> move back to the calling page
|
||||
if ($num_rows < 1) {
|
||||
if (file_exists('./' . $goto)) {
|
||||
if ($is_delupd) {
|
||||
$message = $strAffectedRows . ' ' . mysql_affected_rows();
|
||||
} else if (!empty($zero_rows)) {
|
||||
$message = $zero_rows;
|
||||
else
|
||||
} else {
|
||||
$message = $strEmptyResultSet;
|
||||
}
|
||||
$goto = preg_replace('/\.\.*/', '.', $goto);
|
||||
if ($goto != "main.php3")
|
||||
{
|
||||
include("./header.inc.php3");
|
||||
if ($goto != 'main.php3') {
|
||||
include('./header.inc.php3');
|
||||
}
|
||||
include('./' . $goto);
|
||||
}
|
||||
else
|
||||
{
|
||||
} // end if file_exist
|
||||
else {
|
||||
$message = $zero_rows;
|
||||
Header("Location: $goto");
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Location: ' . $goto);
|
||||
} // end else
|
||||
exit();
|
||||
} // end no rows returned
|
||||
|
||||
// At least one row is returned -> displays a table with results
|
||||
else {
|
||||
// Displays the headers
|
||||
if (isset($show_query)) {
|
||||
unset($show_query);
|
||||
}
|
||||
include("./header.inc.php3");
|
||||
// Define the display mode if it wasn't passed by url
|
||||
include('./header.inc.php3');
|
||||
// Defines the display mode if it wasn't passed by url
|
||||
if (!isset($display)) {
|
||||
$display = eregi('^((SHOW (VARIABLES|PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS))|((CHECK|ANALYZE|REPAIR|OPTIMIZE) TABLE ))', $sql_query, $which);
|
||||
if (!empty($which[2]) && !empty($which[3])) {
|
||||
@@ -147,44 +179,68 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
// Displays the results in a table
|
||||
display_table($result, ($display == 'simple' || $display == 'bkmOnly'));
|
||||
if ($display != 'simple')
|
||||
{
|
||||
|
||||
if ($display != 'simple') {
|
||||
// Insert a new row
|
||||
if ($display != 'bkmOnly') {
|
||||
echo "<p><a href=\"tbl_change.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&goto=$goto&sql_query=".urlencode($sql_query)."\"> $strInsertNewRow</a></p>";
|
||||
}
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&pos=' . $pos
|
||||
. '&sql_query=' . urlencode($full_sql_query)
|
||||
. '&goto=' . urlencode($goto);
|
||||
echo "\n\n";
|
||||
echo '<!-- Insert a new row -->' . "\n";
|
||||
echo '<p>' . "\n";
|
||||
echo ' <a href="tbl_change.php3?' . $url_query . '">' . $strInsertNewRow . '</a>' . "\n";
|
||||
echo '</p>' . "\n";
|
||||
} // end insert row
|
||||
|
||||
// Bookmark Support
|
||||
|
||||
// if($cfgBookmark['db'] && $cfgBookmark['table'] && $db!=$cfgBookmark['db'] && empty($id_bookmark))
|
||||
if($cfgBookmark['db'] && $cfgBookmark['table'] && empty($id_bookmark))
|
||||
{
|
||||
echo "<form method=\"post\" action=\"tbl_replace.php3\">\n";
|
||||
if ($cfgBookmark['db'] && $cfgBookmark['table'] && empty($id_bookmark)) {
|
||||
echo "\n";
|
||||
echo '<!-- Bookmark the query -->' . "\n";
|
||||
echo '<form method="post" action="tbl_replace.php3">' . "\n";
|
||||
if ($display != 'bkmOnly') {
|
||||
echo "<i>$strOr</i>";
|
||||
echo ' <i>' . $strOr . '</i>' . "\n";
|
||||
}
|
||||
echo "<br><br>\n";
|
||||
echo $strBookmarkLabel.":\n";
|
||||
$goto="sql.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&id_bookmark=1&sql_query=".urlencode($sql_query);
|
||||
echo ' <br /><br />' . "\n";
|
||||
echo ' ' . $strBookmarkLabel . ' :' . "\n";
|
||||
$goto = 'sql.php3'
|
||||
. '?lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&pos=' . $pos
|
||||
. '&sql_query=' . urlencode($full_sql_query)
|
||||
. '&id_bookmark=1';
|
||||
?>
|
||||
<input type="hidden" name="server" value="<?php echo $server;?>">
|
||||
<input type="hidden" name="lang" value="<?php echo $lang;?>">
|
||||
<input type="hidden" name="db" value="<?php echo $cfgBookmark['db'];?>">
|
||||
<input type="hidden" name="table" value="<?php echo $cfgBookmark['table'] ;?>">
|
||||
<input type="hidden" name="goto" value="<?php echo $goto;?>">
|
||||
<input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0;?>">
|
||||
<input type="hidden" name="funcs[id]" value="NULL"?>
|
||||
<input type="hidden" name="fields[dbase]" value="<?php echo $db;?>">
|
||||
<input type="hidden" name="fields[query]" value="<?php echo isset($sql_query) ? $sql_query : "";?>">
|
||||
<input type="text" name="fields[label]" value="">
|
||||
<input type="hidden" name="sql_query" value="">
|
||||
<input type="submit" value="<?php echo $strBookmarkThis; ?>">
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $cfgBookmark['db']; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $cfgBookmark['table']; ?>" />
|
||||
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
||||
<input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
|
||||
<input type="hidden" name="funcs[id]" value="NULL" />
|
||||
<input type="hidden" name="fields[dbase]" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="fields[query]" value="<?php echo isset($sql_query) ? urlencode($full_sql_query) : ''; ?>" />
|
||||
<input type="text" name="fields[label]" value="" />
|
||||
<input type="hidden" name="sql_query" value="" />
|
||||
<input type="submit" name="store_bkm" value="<?php echo $strBookmarkThis; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
echo "</p>";
|
||||
}
|
||||
}
|
||||
} //ne drop query
|
||||
require("./footer.inc.php3");
|
||||
} // end bookmark support
|
||||
} // end display != simple
|
||||
} // end rows returned
|
||||
} // end executes the query
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
@@ -2,144 +2,135 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Get some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
require("./header.inc.php3");
|
||||
|
||||
if(isset($submit))
|
||||
{
|
||||
$query = "";
|
||||
for($i=0; $i<count($field_name); ++$i)
|
||||
{
|
||||
$query .= "$field_name[$i] $field_type[$i] ";
|
||||
if($field_length[$i] != "") {
|
||||
/**
|
||||
* The form used to define the field to add has been submitted
|
||||
*/
|
||||
if (isset($submit)) {
|
||||
$query = '';
|
||||
|
||||
// Builds the field creation statement and alters the table
|
||||
for ($i = 0; $i < count($field_name); ++$i) {
|
||||
$query .= backquote($field_name[$i]) . ' ' . $field_type[$i];
|
||||
if ($field_length[$i] != '') {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query .= "(".stripslashes($field_length[$i]).") ";
|
||||
$query .= '(' . stripslashes($field_length[$i]) . ')';
|
||||
} else {
|
||||
$query .= "(".($field_length[$i]).") ";
|
||||
$query .= '(' . $field_length[$i] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
if($field_attribute[$i] != "")
|
||||
$query .= "$field_attribute[$i] " ;
|
||||
if($field_default[$i] != "") {
|
||||
if ($field_attribute[$i] != '') {
|
||||
$query .= ' ' . $field_attribute[$i];
|
||||
}
|
||||
if ($field_default[$i] != '') {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query .= "DEFAULT '".stripslashes($field_default[$i])."' ";
|
||||
$query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\'';
|
||||
} else {
|
||||
$query .= "DEFAULT '".($field_default[$i])."' ";
|
||||
$query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\'';
|
||||
}
|
||||
}
|
||||
if ($field_null[$i] != '') {
|
||||
$query .= ' ' . $field_null[$i];
|
||||
}
|
||||
if ($field_extra[$i] != '') {
|
||||
$query .= ' ' . $field_extra[$i];
|
||||
}
|
||||
|
||||
$query .= "$field_null[$i] $field_extra[$i]";
|
||||
|
||||
if($after_field != "--end--") {
|
||||
// only the first field can be added somewhere else than at the end
|
||||
if ($after_field != '--end--') {
|
||||
// Only the first field can be added somewhere else than at the end
|
||||
if ($i == 0) {
|
||||
if ($after_field == "--first--") {
|
||||
$query .= " FIRST ";
|
||||
if ($after_field == '--first--') {
|
||||
$query .= ' FIRST';
|
||||
} else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query .= " AFTER ".stripslashes($after_field)." ";
|
||||
$query .= ' AFTER ' . backquote(stripslashes(urldecode($after_field)));
|
||||
} else {
|
||||
$query .= " AFTER ".$after_field." ";
|
||||
$query .= ' AFTER ' . backquote(urldecode($after_field));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query .= " AFTER ".stripslashes($field_name[$i-1])." ";
|
||||
$query .= ' AFTER ' . backquote(stripslashes($field_name[$i-1]));
|
||||
} else {
|
||||
$query .= " AFTER ".($field_name[$i-1])." ";
|
||||
$query .= ' AFTER ' . backquote($field_name[$i-1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$query .= ", ADD ";
|
||||
|
||||
}
|
||||
|
||||
$query .= ', ADD ';
|
||||
} // end for
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query = stripslashes(ereg_replace(", ADD $", "", $query));
|
||||
$query = stripslashes(ereg_replace(', ADD $', '', $query));
|
||||
} else {
|
||||
$query = ereg_replace(", ADD $", "", $query);
|
||||
$query = ereg_replace(', ADD $', '', $query);
|
||||
}
|
||||
|
||||
$sql_query = "ALTER TABLE $table ADD $query";
|
||||
$result = mysql_query("ALTER TABLE ".db_name($db).".". tbl_name($table) . " ADD $query") or mysql_die();
|
||||
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD ' . $query;
|
||||
$result = mysql_query($sql_query) or mysql_die();
|
||||
|
||||
// Builds the primary keys statements and updates the table
|
||||
$primary = '';
|
||||
|
||||
if (isset($field_primary))
|
||||
{
|
||||
|
||||
for($i=0;$i<count($field_primary);$i++)
|
||||
{
|
||||
if (isset($field_primary)) {
|
||||
for ($i = 0; $i < count($field_primary); $i++) {
|
||||
$j = $field_primary[$i];
|
||||
$primary .= "$field_name[$j], ";
|
||||
}
|
||||
$primary = ereg_replace(", $", "", $primary);
|
||||
if(count($field_primary) > 0)
|
||||
{
|
||||
$primary = "ADD PRIMARY KEY ($primary)";
|
||||
$sql_query .= "\nALTER TABLE $table $primary";
|
||||
$result = mysql_query("ALTER TABLE ".db_name($db).".$table $primary") or mysql_die();
|
||||
$primary .= backquote($field_name[$j]) . ', ';
|
||||
} // end for
|
||||
$primary = ereg_replace(', $', '', $primary);
|
||||
if (!empty($primary)) {
|
||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')') or mysql_die();
|
||||
}
|
||||
} // end if
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Builds the indexes statements and updates the table
|
||||
$index = '';
|
||||
|
||||
if (isset($field_index))
|
||||
{
|
||||
|
||||
for($i=0;$i<count($field_index);$i++)
|
||||
{
|
||||
if (isset($field_index)) {
|
||||
for ($i = 0; $i < count($field_index); $i++) {
|
||||
$j = $field_index[$i];
|
||||
$index .= "$field_name[$j], ";
|
||||
}
|
||||
$index = ereg_replace(", $", "", $index);
|
||||
if(count($field_index) > 0)
|
||||
{
|
||||
$index = "ADD INDEX ($index)";
|
||||
$sql_query .= "\nALTER TABLE $table $index";
|
||||
$result = mysql_query("ALTER TABLE ".db_name($db).".$table $index") or mysql_die();
|
||||
$index .= backquote($field_name[$j]) . ', ';
|
||||
} // end for
|
||||
$index = ereg_replace(', $', '', $index);
|
||||
if (!empty($index)) {
|
||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')';
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')') or mysql_die();
|
||||
}
|
||||
} // end if
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Builds the uniques statements and updates the table
|
||||
$unique = '';
|
||||
|
||||
if (isset($field_unique))
|
||||
{
|
||||
|
||||
for($i=0;$i<count($field_unique);$i++)
|
||||
{
|
||||
if (isset($field_unique)) {
|
||||
for ($i = 0; $i < count($field_unique); $i++) {
|
||||
$j = $field_unique[$i];
|
||||
$unique .= "$field_name[$j], ";
|
||||
$unique .= backquote($field_name[$j]) . ', ';
|
||||
} // end for
|
||||
$unique = ereg_replace(', $', '', $unique);
|
||||
if (!empty($unique)) {
|
||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')';
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')') or mysql_die();
|
||||
}
|
||||
$unique = ereg_replace(", $", "", $unique);
|
||||
if(count($field_unique) > 0)
|
||||
{
|
||||
$unique = "ADD UNIQUE ($unique)";
|
||||
$sql_query .= "\nALTER TABLE $table $unique";
|
||||
$result = mysql_query("ALTER TABLE ".db_name($db).".$table $unique") or mysql_die();
|
||||
} // end if
|
||||
|
||||
// Go back to table properties
|
||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
||||
include('./tbl_properties.php3');
|
||||
exit();
|
||||
} // end do alter table
|
||||
|
||||
/**
|
||||
* Displays the form used to define the new field
|
||||
*/
|
||||
else{
|
||||
$action = 'tbl_addfield.php3';
|
||||
include('./tbl_properties.inc.php3');
|
||||
|
||||
// Diplays the footer
|
||||
echo "\n";
|
||||
include('./footer.inc.php3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$query_keys = $primary.$index.$unique;
|
||||
$query_keys = ereg_replace(", $", "", $query_keys);
|
||||
|
||||
$message = "$strTable $table $strHasBeenAltered";
|
||||
include("./tbl_properties.php3");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = "tbl_addfield.php3";
|
||||
include("./tbl_properties.inc.php3");
|
||||
}
|
||||
|
||||
require("./footer.inc.php3");
|
||||
?>
|
||||
|
@@ -2,41 +2,73 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
require("./header.inc.php3");
|
||||
|
||||
if(isset($submit))
|
||||
{
|
||||
if(!isset($query))
|
||||
$query = "";
|
||||
$query .= " $field_orig[0] $field_name[0] $field_type[0] ";
|
||||
if($field_length[0] != "")
|
||||
$query .= "($field_length[0]) ";
|
||||
if($field_attribute[0] != "")
|
||||
$query .= "$field_attribute[0] ";
|
||||
if($field_default[0] != "")
|
||||
$query .= "DEFAULT '$field_default[0]' ";
|
||||
/**
|
||||
* Modifications have been submitted -> updates the table
|
||||
*/
|
||||
if (isset($submit)) {
|
||||
// Some fields have been urlencoded or double quotes have been translated
|
||||
// to """ in tbl_properties.php3
|
||||
$field_orig[0] = urldecode($field_orig[0]);
|
||||
if (str_replace('"', '"', $field_orig[0]) == $field_name[0]) {
|
||||
$field_name[0] = $field_orig[0];
|
||||
}
|
||||
$field_default_orig[0] = urldecode($field_default_orig[0]);
|
||||
if (str_replace('"', '"', $field_default_orig[0]) == $field_default[0]) {
|
||||
$field_default[0] = $field_default_orig[0];
|
||||
}
|
||||
|
||||
$query .= "$field_null[0] $field_extra[0]";
|
||||
if (!isset($query)) {
|
||||
$query = '';
|
||||
}
|
||||
$query .= ' ' . backquote($field_orig[0]) . ' ' . backquote($field_name[0]) . ' ' . $field_type[0] . ' ';
|
||||
if ($field_length[0] != '') {
|
||||
$query .= '(' . $field_length[0] . ') ';
|
||||
}
|
||||
if ($field_attribute[0] != '') {
|
||||
$query .= $field_attribute[0] . ' ';
|
||||
}
|
||||
if ($field_default[0] != '') {
|
||||
$query .= 'DEFAULT \'' . sql_addslashes($field_default[0]) . '\' ';
|
||||
}
|
||||
$query .= $field_null[0] . ' ' . $field_extra[0];
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query = stripslashes($query);
|
||||
}
|
||||
//optimization fix - 2 May 2001 - Robbat2
|
||||
$sql_query = "ALTER TABLE ".db_name($db).".".tbl_name($table)." CHANGE $query";
|
||||
|
||||
// Optimization fix - 2 May 2001 - Robbat2
|
||||
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' CHANGE ' . $query;
|
||||
$result = mysql_query($sql_query) or mysql_die();
|
||||
$message = "$strTable $table $strHasBeenAltered";
|
||||
include("./tbl_properties.php3");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = mysql_query("SHOW FIELDS FROM ".db_name($db).".".
|
||||
tbl_name($table) . " LIKE '$field'") or mysql_die();
|
||||
$num_fields = mysql_num_rows($result);
|
||||
$action = "tbl_alter.php3";
|
||||
include("./tbl_properties.inc.php3");
|
||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
||||
include('./tbl_properties.php3');
|
||||
exit();
|
||||
}
|
||||
|
||||
require("./footer.inc.php3");
|
||||
|
||||
/**
|
||||
* No modifications yet required -> displays the table fields
|
||||
*/
|
||||
else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$field = sql_addslashes(stripslashes($field), TRUE);
|
||||
} else {
|
||||
$field = sql_addslashes($field, TRUE);
|
||||
}
|
||||
$result = mysql_query('SHOW FIELDS FROM ' . backquote($db) . '.' . backquote($table) . " LIKE '$field'") or mysql_die();
|
||||
$num_fields = mysql_num_rows($result);
|
||||
$action = 'tbl_alter.php3';
|
||||
include('./tbl_properties.inc.php3');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
377
tbl_change.php3
377
tbl_change.php3
@@ -2,39 +2,55 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Get the variables sent or posted to this script and displays the header
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
require("./header.inc.php3");
|
||||
|
||||
/**
|
||||
* Get the list of the fields of the current table
|
||||
*/
|
||||
mysql_select_db($db);
|
||||
$table_def = mysql_query("SHOW FIELDS FROM $table");
|
||||
$table_def = mysql_query('SHOW FIELDS FROM ' . backquote($table));
|
||||
|
||||
if (isset($primary_key)) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$primary_key = stripslashes($primary_key);
|
||||
}
|
||||
$result = mysql_query("SELECT * FROM $table WHERE $primary_key");
|
||||
$result = mysql_query('SELECT * FROM ' . backquote($table) . ' WHERE ' . $primary_key);
|
||||
$row = mysql_fetch_array($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = mysql_query("SELECT * FROM $table LIMIT 1");
|
||||
$result = mysql_query('SELECT * FROM ' . backquote($table) . ' LIMIT 1');
|
||||
}
|
||||
|
||||
?>
|
||||
<form method="post" action="tbl_replace.php3">
|
||||
<input type="hidden" name="server" value="<?php echo $server;?>">
|
||||
<input type="hidden" name="lang" value="<?php echo $lang;?>">
|
||||
<input type="hidden" name="db" value="<?php echo $db;?>">
|
||||
<input type="hidden" name="table" value="<?php echo $table;?>">
|
||||
<input type="hidden" name="goto" value="<?php echo $goto;?>">
|
||||
<input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode(stripslashes($sql_query)) : "";?>">
|
||||
<input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0;?>">
|
||||
<?php
|
||||
|
||||
if(isset($primary_key))
|
||||
echo '<input type="hidden" name="primary_key" value="' . htmlspecialchars($primary_key) . '">' . "\n";
|
||||
/**
|
||||
* Displays the form
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- Change table properties form -->
|
||||
<form method="post" action="tbl_replace.php3">
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
|
||||
<input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
|
||||
<input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
|
||||
<?php
|
||||
if (isset($primary_key)) {
|
||||
?>
|
||||
<input type="hidden" name="primary_key" value="<?php echo urlencode($primary_key); ?>" />
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
|
||||
<table border="<?php echo $cfgBorder; ?>">
|
||||
<tr>
|
||||
<th><?php echo $strField; ?></th>
|
||||
@@ -42,33 +58,38 @@ if(isset($primary_key))
|
||||
<th><?php echo $strFunction; ?></th>
|
||||
<th><?php echo $strValue; ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
// Set if we passed the first timestamp field
|
||||
$timestamp_seen = 0;
|
||||
|
||||
|
||||
$timestamp_seen = 0; // set if we passed the first timestamp field.
|
||||
|
||||
for($i=0;$i<mysql_num_rows($table_def);$i++)
|
||||
{
|
||||
for ($i = 0; $i < mysql_num_rows($table_def); $i++) {
|
||||
$row_table_def = mysql_fetch_array($table_def);
|
||||
$field = $row_table_def["Field"];
|
||||
if($row_table_def['Type'] == "datetime" && empty($row[$field]))
|
||||
$row[$field] = date("Y-m-d H:i:s", time());
|
||||
$field = $row_table_def['Field'];
|
||||
if ($row_table_def['Type'] == 'datetime' && empty($row[$field])) {
|
||||
$row[$field] = date('Y-m-d H:i:s', time());
|
||||
}
|
||||
$len = @mysql_field_len($result, $i);
|
||||
|
||||
$first_timestamp = 0;
|
||||
$bgcolor = $cfgBgcolorOne;
|
||||
$i % 2 ? 0: $bgcolor = $cfgBgcolorTwo;
|
||||
echo "<tr bgcolor=".$bgcolor.">\n";
|
||||
echo "<td>$field</td>\n";
|
||||
switch (ereg_replace("\\(.*", "", $row_table_def['Type']))
|
||||
{
|
||||
case "set":
|
||||
$type = "set";
|
||||
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
?>
|
||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||
<td align="center"><?php echo htmlspecialchars($field); ?></td>
|
||||
<?php
|
||||
echo "\n";
|
||||
|
||||
// The type column
|
||||
switch (ereg_replace('\\(.*', '', $row_table_def['Type'])) {
|
||||
case 'set':
|
||||
$type = 'set';
|
||||
$type_nowrap = '';
|
||||
break;
|
||||
case "enum":
|
||||
$type = "enum";
|
||||
case 'enum':
|
||||
$type = 'enum';
|
||||
$type_nowrap = '';
|
||||
break;
|
||||
case "timestamp":
|
||||
case 'timestamp':
|
||||
if (!$timestamp_seen) { // can only occur once per table
|
||||
$timestamp_seen = 1;
|
||||
$first_timestamp = 1;
|
||||
@@ -77,163 +98,211 @@ for($i=0;$i<mysql_num_rows($table_def);$i++)
|
||||
break;
|
||||
default:
|
||||
$type = $row_table_def['Type'];
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
break;
|
||||
}
|
||||
echo "<td>$type</td>\n";
|
||||
?>
|
||||
<td align="center"<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
|
||||
<?php
|
||||
echo "\n";
|
||||
|
||||
if(isset($row) && isset($row[$field]))
|
||||
{
|
||||
// The function column
|
||||
if (isset($row) && isset($row[$field])) {
|
||||
$special_chars = htmlspecialchars($row[$field]);
|
||||
$data = $row[$field];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $special_chars = "";
|
||||
} else {
|
||||
$data = $special_chars = '';
|
||||
}
|
||||
|
||||
// THE FUNCTION COLUMN
|
||||
// Change by Bernard M. Piller <bernard@bmpsystems.com>
|
||||
// We don't want binary data to be destroyed
|
||||
if((strstr($row_table_def["Type"], "blob") || strstr($row_table_def["Type"], "binary")) && !empty($data))
|
||||
{
|
||||
echo "<td>$strBinary</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<td><select name=\"funcs[$field]\"><option>\n";
|
||||
|
||||
if ((strstr($row_table_def['Type'], 'blob') || strstr($row_table_def['Type'], 'binary'))
|
||||
&& !empty($data)) {
|
||||
echo ' <td>' . $strBinary . '</td>' . "\n";
|
||||
} else {
|
||||
?>
|
||||
<td>
|
||||
<select name="funcs[<?php echo $field; ?>]"> <option>
|
||||
<?php
|
||||
echo "\n";
|
||||
if (!$first_timestamp) {
|
||||
for($j=0; $j<count($cfgFunctions); $j++)
|
||||
echo "<option>$cfgFunctions[$j]\n";
|
||||
} else {
|
||||
// for default function = NOW() on first timestamp field --swix/18jul01
|
||||
for ($j = 0; $j < count($cfgFunctions); $j++) {
|
||||
if ($cfgFunctions[$j] == "NOW") {
|
||||
echo "<option selected>$cfgFunctions[$j]\n";
|
||||
echo ' ';
|
||||
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "<option>$cfgFunctions[$j]\n";
|
||||
// for default function = NOW() on first timestamp field
|
||||
// -- swix/18jul01
|
||||
for ($j = 0; $j < count($cfgFunctions); $j++) {
|
||||
echo ' ';
|
||||
if ($cfgFunctions[$j] == 'NOW') {
|
||||
echo '<option selected="selected">' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
} else {
|
||||
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
echo "</select></td>\n";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
// THE VALUE COLUMN
|
||||
|
||||
if(strstr($row_table_def["Type"], "text"))
|
||||
{
|
||||
echo "<td><textarea name=fields[$field] rows=\"$cfgTextareaRows\"
|
||||
cols=\"$cfgTextareaCols\" >$special_chars</textarea></td>\n";
|
||||
if (strlen($special_chars) > 32000)
|
||||
echo "<td>$strTextAreaLength</td>";
|
||||
// The value column (depends on type)
|
||||
if (strstr($row_table_def['Type'], 'text')) {
|
||||
?>
|
||||
<td>
|
||||
<textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfgTextareaRows; ?>" cols="<?php echo $cfgTextareaCols; ?>">
|
||||
<?php if (!empty($special_chars)) echo $special_chars . "\n"; ?>
|
||||
</textarea>
|
||||
</td>
|
||||
<?php
|
||||
echo "\n";
|
||||
if (strlen($special_chars) > 32000) {
|
||||
echo ' <td>' . $strTextAreaLength . '</td>' . "\n";
|
||||
}
|
||||
elseif(strstr($row_table_def["Type"], "enum"))
|
||||
{
|
||||
$set = str_replace("enum(", "", $row_table_def["Type"]);
|
||||
$set = ereg_replace("\\)$", "", $set);
|
||||
$set = explode(",", $set);
|
||||
}
|
||||
else if (strstr($row_table_def['Type'], 'enum')) {
|
||||
$set = str_replace('enum(', '', $row_table_def['Type']);
|
||||
$set = ereg_replace('\\)$', '', $set);
|
||||
$set = explode(',', $set);
|
||||
|
||||
// show dropdown or radio depend on length
|
||||
if (strlen($row_table_def["Type"]) > 20) {
|
||||
echo "<td><select name=fields[$field]>\n";
|
||||
echo "<option value=\"\">\n";
|
||||
for($j=0; $j<count($set);$j++)
|
||||
{
|
||||
if (strlen($row_table_def['Type']) > 20) {
|
||||
?>
|
||||
<td>
|
||||
<select name="fields[<?php echo urlencode($field); ?>]">
|
||||
<option value=""></option>
|
||||
<?php
|
||||
echo "\n";
|
||||
|
||||
for ($j = 0; $j < count($set);$j++) {
|
||||
echo ' ';
|
||||
echo '<option value="' . substr($set[$j], 1, -1) . '"';
|
||||
if ($data == substr($set[$j], 1, -1)
|
||||
|| ( $data == ""
|
||||
&& substr($set[$j], 1, -1) == $row_table_def["Default"]))
|
||||
echo " selected";
|
||||
|
||||
echo ">".htmlspecialchars(substr($set[$j], 1, -1))."\n";
|
||||
}
|
||||
echo "</select></td>";
|
||||
|| ($data == '' && substr($set[$j], 1, -1) == $row_table_def['Default'])) {
|
||||
echo ' slected="selected"';
|
||||
}
|
||||
echo '>' . htmlspecialchars(substr($set[$j], 1, -1)) . '</option>' . "\n";
|
||||
} // end for
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
} // end if
|
||||
else {
|
||||
echo "<td>\n";
|
||||
echo ' <td>' . "\n";
|
||||
|
||||
$seenchecked = 0;
|
||||
for($j=0; $j<count($set);$j++)
|
||||
{
|
||||
echo "<input type=radio name=fields[$field] ";
|
||||
for ($j = 0; $j < count($set); $j++) {
|
||||
echo ' ';
|
||||
echo '<input type="radio" name="fields[' . urlencode($field) . ']" ';
|
||||
echo 'value="' . substr($set[$j], 1, -1) . '"';
|
||||
if ($data == substr($set[$j], 1, -1)
|
||||
|| ( $data == ""
|
||||
&& substr($set[$j], 1, -1) == $row_table_def["Default"]
|
||||
&& $row_table_def["Null"] != "YES"))
|
||||
|
||||
// To be able to display a checkmark in the [Null] box when the field
|
||||
// is null, we lose the ability to display a checkmark besides the default value
|
||||
{
|
||||
echo " checked";
|
||||
|| ($data == ''
|
||||
&& substr($set[$j], 1, -1) == $row_table_def['Default']
|
||||
&& $row_table_def['Null'] != 'YES')) {
|
||||
// To be able to display a checkmark in the [Null] box when
|
||||
// the field is null, we lose the ability to display a
|
||||
// checkmark besides the default value
|
||||
echo ' checked="checked"';
|
||||
$seenchecked =1;
|
||||
}
|
||||
echo ">".htmlspecialchars(substr($set[$j], 1, -1))."\n";
|
||||
echo ' />' . "\n";
|
||||
echo ' ' . htmlspecialchars(substr($set[$j], 1, -1)) . "\n";
|
||||
} // end for
|
||||
|
||||
if ($row_table_def['Null'] == 'YES') {
|
||||
echo ' ';
|
||||
echo '<input type="radio" name="fields[' . urlencode($field) . ']" value="null"';
|
||||
if ($seenchecked == 0) {
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
echo ' />' . "\n";
|
||||
echo ' [' . $strNull . ']' . "\n";
|
||||
} // end if
|
||||
|
||||
if ($row_table_def["Null"] == "YES") {
|
||||
echo "<input type=\"radio\"
|
||||
name=fields[$field]
|
||||
value=\"null\"";
|
||||
|
||||
if ($seenchecked==0)
|
||||
echo " checked";
|
||||
|
||||
echo ">[$strNull]";
|
||||
}
|
||||
echo "</td>";
|
||||
echo ' </td>' . "\n";
|
||||
} // end else
|
||||
}
|
||||
else if (strstr($row_table_def['Type'], 'set')) {
|
||||
$set = str_replace('set(', '', $row_table_def['Type']);
|
||||
$set = ereg_replace('\)$', '', $set);
|
||||
$set = explode(',', $set);
|
||||
|
||||
}
|
||||
elseif(strstr($row_table_def["Type"], "set"))
|
||||
{
|
||||
$set = str_replace("set(", "", $row_table_def["Type"]);
|
||||
$set = ereg_replace("\)$", "", $set);
|
||||
|
||||
$set = explode(",",$set);
|
||||
for($vals = explode(",", $data); list($t, $k) = each($vals);)
|
||||
for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
|
||||
$vset[$k] = 1;
|
||||
$size = min(4, count($set));
|
||||
echo "<td><input type=\"hidden\" name=\"fields[$field]\" value=\"\$set\$\">";
|
||||
echo "<select name=field_${field}[] size=$size multiple>\n";
|
||||
$countset=count($set);
|
||||
for($j=0; $j<$countset;$j++)
|
||||
{
|
||||
$subset=substr($set[$j], 1, -1);
|
||||
echo '<option value="'.htmlspecialchars($subset).'"';
|
||||
if(isset($vset[$subset]) && $vset[$subset])
|
||||
echo " selected";
|
||||
echo ">".htmlspecialchars($subset)."\n";
|
||||
}
|
||||
echo "</select></td>";
|
||||
$size = min(4, count($set));
|
||||
?>
|
||||
<td>
|
||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $set; ?>$" />
|
||||
<select name="field_<?php echo md5($field); ?>[]" size="<?php echo $size; ?>" multiple="multiple">
|
||||
<?php
|
||||
echo "\n";
|
||||
$countset = count($set);
|
||||
for ($j = 0; $j < $countset;$j++) {
|
||||
$subset = substr($set[$j], 1, -1);
|
||||
echo ' ';
|
||||
echo '<option value="'. urlencode($subset) . '"';
|
||||
if (isset($vset[$subset]) && $vset[$subset]) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . htmlspecialchars($subset) . '</option>' . "\n";
|
||||
} // end for
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
// Change by Bernard M. Piller <bernard@bmpsystems.com>
|
||||
// We don't want binary data destroyed
|
||||
elseif((strstr($row_table_def["Type"], "blob") || strstr($row_table_def["Type"], "binary")) && !empty($data))
|
||||
{
|
||||
echo "<td>" . $strBinaryDoNotEdit;
|
||||
echo "<input type=\"hidden\" name=fields[$field] value=\"".$special_chars."\"></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldsize=($len>40? 40: $len);
|
||||
|
||||
echo "<td><input type=text name=fields[$field]
|
||||
value=\"".$special_chars."\" maxlength=\"$len\" size=\"$fieldsize\"></td>";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
else if ((strstr($row_table_def['Type'], 'blob') || strstr($row_table_def['Type'], 'binary'))
|
||||
&& !empty($data)) {
|
||||
echo "\n";
|
||||
?>
|
||||
<td>
|
||||
<?php echo $strBinaryDoNotEdit . "\n"; ?>
|
||||
<input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" />
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$fieldsize = (($len > 40) ? 40 : $len);
|
||||
echo "\n";
|
||||
?>
|
||||
<td>
|
||||
<input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $len; ?>" />
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
echo "\n";
|
||||
} // end for
|
||||
?>
|
||||
</table>
|
||||
<br /><br />
|
||||
|
||||
<input type="submit" name="submit_type" value="<?php echo $strSave; ?>" />
|
||||
<?php
|
||||
if (isset($primary_key)) {
|
||||
?>
|
||||
<input type="submit" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" />
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<p>
|
||||
<input type="submit" name="submit_type" value="<?php echo $strSave; ?>">
|
||||
<?php if (isset($primary_key)) { ?>
|
||||
<input type="submit" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>">
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
|
||||
<?php
|
||||
require("./footer.inc.php3");
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
112
tbl_copy.php3
112
tbl_copy.php3
@@ -1,53 +1,87 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Insert datas from one table to another one
|
||||
*
|
||||
* @param string the original insert statement
|
||||
*
|
||||
* @global string the database name
|
||||
* @global string the original table name
|
||||
* @global string the target table name
|
||||
* @global string the sql query used to copy the data
|
||||
*/
|
||||
function my_handler($sql_insert = '')
|
||||
{
|
||||
global $db, $table, $new_name;
|
||||
global $sql_insert_data;
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
$sql_insert = ereg_replace('INSERT INTO (`?)' . $table . '(`?)', 'INSERT INTO ' . backquote($new_name), $sql_insert);
|
||||
$result = mysql_query($sql_insert) or mysql_die();
|
||||
|
||||
require("./header.inc.php3");
|
||||
$sql_insert_data .= $sql_insert . ';' . "\n";
|
||||
} // end of the 'my_handler' function
|
||||
|
||||
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
|
||||
/**
|
||||
* Selects the database to work with
|
||||
*/
|
||||
mysql_select_db($db);
|
||||
|
||||
function my_handler($sql_insert)
|
||||
{
|
||||
global $table, $db, $new_name;
|
||||
/**
|
||||
* A target table name has been sent to this script -> do the work
|
||||
*/
|
||||
if (isset($new_name) && trim($new_name) != '') {
|
||||
$use_backquotes = 1;
|
||||
$asfile = 1;
|
||||
|
||||
$sql_insert = ereg_replace("INSERT INTO $table", "INSERT INTO $new_name", $sql_insert);
|
||||
$result = mysql_query($sql_insert) or mysql_die();
|
||||
$sql_query = $sql_insert;
|
||||
}
|
||||
|
||||
if (isset($new_name)) $new_name=trim($new_name); // Cleanup to suppress '' tables
|
||||
if (isset($new_name) && $new_name!="")
|
||||
{
|
||||
$sql_structure = get_table_def($db, $table, "\n");
|
||||
$sql_structure = ereg_replace('^CREATE TABLE (`?)' . $table . '(`?)', 'CREATE TABLE ' . backquote($new_name), $sql_structure);
|
||||
$result = mysql_query($sql_structure) or mysql_die();
|
||||
|
||||
if (isset($sql_query)) {
|
||||
$sql_query .= "\n" . $sql_structure . ';';
|
||||
} else {
|
||||
$sql_query = $sql_structure . ';';
|
||||
}
|
||||
|
||||
// Copy the data
|
||||
if ($what == 'data') {
|
||||
// speedup copy table - staybyte - 22. Juni 2001
|
||||
if(MYSQL_MAJOR_VERSION >= 3.23)
|
||||
{
|
||||
$sql_structure = ereg_replace("CREATE TABLE `$table`", "CREATE TABLE `$new_name`", $sql_structure);
|
||||
$result = mysql_query($sql_structure) or mysql_die();
|
||||
if($result!=false && $what == "data")
|
||||
{
|
||||
$query="INSERT INTO `$new_name` SELECT * FROM `$table`";
|
||||
$result = mysql_query($query) or mysql_die();
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23) {
|
||||
$sql_insert_data = 'INSERT INTO ' . backquote($new_name) . ' SELECT * FROM ' . backquote($table);
|
||||
$result = mysql_query($sql_insert_data) or mysql_die();
|
||||
} // end MySQL >= 3.23
|
||||
else {
|
||||
$sql_insert_data = '';
|
||||
get_table_content($db, $table, 0, 0, 'my_handler');
|
||||
} // end MySQL < 3.23
|
||||
$sql_query .= "\n\n" . $sql_insert_data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_structure = ereg_replace("CREATE TABLE `$table`", "CREATE TABLE $new_name", $sql_structure);
|
||||
$result = mysql_query($sql_structure) or mysql_die();
|
||||
if ($result!=false && $what == "data")
|
||||
{
|
||||
get_table_content($db, $table, 0, 0, "my_handler");
|
||||
}
|
||||
}
|
||||
}
|
||||
else mysql_die($strTableEmpty);
|
||||
|
||||
if (isset($sql_query))
|
||||
$sql_query .= "\n$sql_structure";
|
||||
else
|
||||
$sql_query = "$sql_structure";
|
||||
$message = sprintf($strCopyTableOK, $table, $new_name);
|
||||
$reload = 'true';
|
||||
} // end is target table name
|
||||
|
||||
eval("\$message = \"$strCopyTableOK\";");
|
||||
require("./db_details.php3");
|
||||
|
||||
/**
|
||||
* No new name for the table!
|
||||
*/
|
||||
else {
|
||||
// include('./header.inc.php3');
|
||||
mysql_die($strTableEmpty);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Back to the calling script
|
||||
*/
|
||||
require('./db_details.php3');
|
||||
?>
|
||||
|
186
tbl_create.php3
186
tbl_create.php3
@@ -2,108 +2,146 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Get some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
|
||||
require("./header.inc.php3");
|
||||
|
||||
/**
|
||||
* Selects the database to work with
|
||||
*/
|
||||
mysql_select_db($db);
|
||||
|
||||
if(isset($submit))
|
||||
{
|
||||
if(!isset($query))
|
||||
$query = "";
|
||||
for($i=0; $i<count($field_name); $i++)
|
||||
{
|
||||
|
||||
/**
|
||||
* The form used to define the structure of the table has been submitted
|
||||
*/
|
||||
if (isset($submit)) {
|
||||
if (!isset($query)) {
|
||||
$query = '';
|
||||
}
|
||||
|
||||
// Builds the fields creation statements
|
||||
for ($i = 0; $i < count($field_name); $i++) {
|
||||
if (empty($field_name[$i])) {
|
||||
continue;
|
||||
}
|
||||
$query .= "$field_name[$i] $field_type[$i] ";
|
||||
if($field_length[$i] != "")
|
||||
$query .= backquote($field_name[$i]) . ' ' . $field_type[$i];
|
||||
if ($field_length[$i] != '') {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query .= "(".stripslashes($field_length[$i]).") ";
|
||||
$query .= '(' . stripslashes($field_length[$i]) . ')';
|
||||
} else {
|
||||
$query .= "(".($field_length[$i]).") ";
|
||||
$query .= '(' . $field_length[$i] . ')';
|
||||
}
|
||||
if($field_attribute[$i] != "")
|
||||
$query .= "$field_attribute[$i] ";
|
||||
if($field_default[$i] != "")
|
||||
}
|
||||
if ($field_attribute[$i] != '') {
|
||||
$query .= ' ' . $field_attribute[$i];
|
||||
}
|
||||
if ($field_default[$i] != '') {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$query .= "DEFAULT '".stripslashes($field_default[$i])."' ";
|
||||
$query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\'';
|
||||
} else {
|
||||
$query .= "DEFAULT '".($field_default[$i])."' ";
|
||||
$query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\'';
|
||||
}
|
||||
$query .= "$field_null[$i] $field_extra[$i], ";
|
||||
}
|
||||
$query = ereg_replace(", $", "", $query);
|
||||
if ($field_null[$i] != '') {
|
||||
$query .= ' ' . $field_null[$i];
|
||||
}
|
||||
if ($field_extra[$i] != '') {
|
||||
$query .= ' ' . $field_extra[$i] . ', ';
|
||||
} else {
|
||||
$query .= ', ';
|
||||
}
|
||||
} // end for
|
||||
$query = ereg_replace(', $', '', $query);
|
||||
|
||||
if(!isset($primary))
|
||||
$primary = "";
|
||||
|
||||
if(!isset($field_primary))
|
||||
// Builds the primary keys statements
|
||||
if (!isset($primary)) {
|
||||
$primary = '';
|
||||
}
|
||||
if (!isset($field_primary)) {
|
||||
$field_primary = array();
|
||||
|
||||
for($i=0;$i<count($field_primary);$i++)
|
||||
{
|
||||
}
|
||||
for ($i = 0; $i < count($field_primary); $i++) {
|
||||
$j = $field_primary[$i];
|
||||
if (!empty($field_name[$j]))
|
||||
$primary .= "$field_name[$j], ";
|
||||
if (!empty($field_name[$j])) {
|
||||
$primary .= backquote($field_name[$j]) . ', ';
|
||||
}
|
||||
} // end for
|
||||
$primary = ereg_replace(', $', '', $primary);
|
||||
if (!empty($primary)) {
|
||||
$primary = ', PRIMARY KEY (' . $primary . ')';
|
||||
}
|
||||
$primary = ereg_replace(", $", "", $primary);
|
||||
if(count($field_primary) > 0)
|
||||
$primary = ", PRIMARY KEY ($primary)";
|
||||
|
||||
if(!isset($index))
|
||||
$index = "";
|
||||
|
||||
if(!isset($field_index))
|
||||
// Builds the indexes statements
|
||||
if (!isset($index)) {
|
||||
$index = '';
|
||||
}
|
||||
if (!isset($field_index)) {
|
||||
$field_index = array();
|
||||
|
||||
for($i=0;$i<count($field_index);$i++)
|
||||
{
|
||||
}
|
||||
for ($i = 0;$i < count($field_index); $i++) {
|
||||
$j = $field_index[$i];
|
||||
if (!empty($field_name[$j]))
|
||||
$index .= "$field_name[$j], ";
|
||||
if (!empty($field_name[$j])) {
|
||||
$index .= backquote($field_name[$j]) . ', ';
|
||||
}
|
||||
} // end for
|
||||
$index = ereg_replace(', $', '', $index);
|
||||
if (!empty($index)) {
|
||||
$index = ', INDEX (' . $index . ')';
|
||||
}
|
||||
$index = ereg_replace(", $", "", $index);
|
||||
// if(count($field_index) > 0)
|
||||
if(!empty($index))
|
||||
$index = ", INDEX ($index)";
|
||||
if(!isset($unique))
|
||||
$unique = "";
|
||||
|
||||
if(!isset($field_unique))
|
||||
// Builds the uniques statements
|
||||
if (!isset($unique)) {
|
||||
$unique = '';
|
||||
}
|
||||
if (!isset($field_unique)) {
|
||||
$field_unique = array();
|
||||
|
||||
for($i=0;$i<count($field_unique);$i++)
|
||||
{
|
||||
}
|
||||
for ($i = 0; $i < count($field_unique); $i++) {
|
||||
$j = $field_unique[$i];
|
||||
if (!empty($field_name[$j]))
|
||||
$unique .= "$field_name[$j], ";
|
||||
if (!empty($field_name[$j])) {
|
||||
$unique .= backquote($field_name[$j]) . ', ';
|
||||
}
|
||||
} // end for
|
||||
$unique = ereg_replace(', $', '', $unique);
|
||||
if (!empty($unique)) {
|
||||
$unique = ', UNIQUE (' . $unique . ')';
|
||||
}
|
||||
$unique = ereg_replace(", $", "", $unique);
|
||||
// if(count($field_unique) > 0)
|
||||
if(!empty($unique))
|
||||
$unique = ", UNIQUE ($unique)";
|
||||
$query_keys = $primary . $index . $unique;
|
||||
$query_keys = ereg_replace(", $", "", $query_keys);
|
||||
$query_keys = ereg_replace(', $', '', $query_keys);
|
||||
|
||||
// echo "$query $query_keys";
|
||||
$sql_query = "CREATE TABLE ".$table." (".$query." ".$query_keys.")";
|
||||
//BEGIN - Table Type - 2 May 2001 - Robbat2
|
||||
if(!empty($tbl_type) && ($tbl_type != "Default"))
|
||||
$sql_query .= " TYPE = $tbl_type";
|
||||
//END - Table Type - 2 May 2001 - Robbat2
|
||||
if(MYSQL_MAJOR_VERSION == "3.23" && !empty($comment))
|
||||
$sql_query .= " comment = '$comment'";
|
||||
// Builds the 'create table' statement
|
||||
$sql_query = 'CREATE TABLE ' . backquote($table) . ' ('
|
||||
. $query . ' '
|
||||
. $query_keys . ')';
|
||||
// Adds table type (2 May 2001 - Robbat2)
|
||||
if (!empty($tbl_type) && ($tbl_type != 'Default')) {
|
||||
$sql_query .= ' TYPE = ' . $tbl_type;
|
||||
}
|
||||
if (MYSQL_MAJOR_VERSION == 3.23 && !empty($comment)) {
|
||||
$sql_query .= ' comment = \'' . sql_addslashes($comment) . '\'';
|
||||
}
|
||||
|
||||
// Executes the query
|
||||
$result = mysql_query($sql_query) or mysql_die();
|
||||
$message = "$strTable $table $strHasBeenCreated";
|
||||
include("./tbl_properties.php3");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = "tbl_create.php3";
|
||||
include("./tbl_properties.inc.php3");
|
||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
|
||||
include('./tbl_properties.php3');
|
||||
exit();
|
||||
} // end do create table
|
||||
|
||||
/**
|
||||
* Displays the form used to define the structure of the table
|
||||
*/
|
||||
else {
|
||||
$action = 'tbl_create.php3';
|
||||
include('./tbl_properties.inc.php3');
|
||||
|
||||
// Diplays the footer
|
||||
echo "\n";
|
||||
include('./footer.inc.php3');
|
||||
}
|
||||
|
||||
require("./footer.inc.php3");
|
||||
?>
|
||||
|
333
tbl_dump.php3
333
tbl_dump.php3
@@ -1,26 +1,119 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
|
||||
/**
|
||||
* Formats the INSERT statements depending on the target (screen/file) of the
|
||||
* sql dump
|
||||
*
|
||||
* @param string the insert statement
|
||||
*
|
||||
* @global string the buffer containing formatted strings
|
||||
*/
|
||||
function my_handler($sql_insert)
|
||||
{
|
||||
global $tmp_buffer;
|
||||
|
||||
// Result will be displays on screen
|
||||
if (empty($GLOBALS['asfile'])) {
|
||||
$tmp_buffer .= htmlspecialchars($sql_insert . ';' . $GLOBALS['crlf']);
|
||||
}
|
||||
// Result will be save in a file
|
||||
else {
|
||||
$tmp_buffer .= $sql_insert . ';' . $GLOBALS['crlf'];
|
||||
}
|
||||
} // end of the 'my_handler()' function
|
||||
|
||||
|
||||
/**
|
||||
* Formats the INSERT statements depending on the target (screen/file) of the
|
||||
* cvs export
|
||||
*
|
||||
* Revisions: 2001-05-07, Lem9: added $add_character
|
||||
* 2001-07-12, loic1: $crlf should be used only if there is no EOL
|
||||
* character defined by the user
|
||||
*
|
||||
* @param string the insert statement
|
||||
*
|
||||
* @global string the character to add at the end of lines
|
||||
* @global string the buffer containing formatted strings
|
||||
*/
|
||||
function my_csvhandler($sql_insert)
|
||||
{
|
||||
global $add_character;
|
||||
global $tmp_buffer;
|
||||
|
||||
// Handles the EOL character
|
||||
if (empty($add_character)) {
|
||||
$add_character = $GLOBALS['crlf'];
|
||||
} else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$add_character = stripslashes($add_character);
|
||||
}
|
||||
$add_character = str_replace('\\r', "\015", $add_character);
|
||||
$add_character = str_replace('\\n', "\012", $add_character);
|
||||
$add_character = str_replace('\\t', "\011", $add_character);
|
||||
} // end if
|
||||
|
||||
// Result will be displays on screen
|
||||
if (empty($GLOBALS['asfile'])) {
|
||||
$tmp_buffer .= htmlspecialchars($sql_insert) . $add_character;
|
||||
}
|
||||
// Result will be save in a file
|
||||
else {
|
||||
$tmp_buffer .= $sql_insert . $add_character;
|
||||
}
|
||||
} // end of the 'my_csvhandler()' function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the variables sent or posted to this script and a core script
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
|
||||
/**
|
||||
* Increase time limit for script execution and initializes some variables
|
||||
*/
|
||||
@set_time_limit(600);
|
||||
$crlf="\n";
|
||||
$dump_buffer = '';
|
||||
// Defines the default <CR><LF> format
|
||||
$crlf = which_crlf();
|
||||
|
||||
|
||||
/**
|
||||
* Ensure zipped formats are associated with the download feature
|
||||
*/
|
||||
if (empty($asfile)
|
||||
&& (!empty($gzip) || !empty($bzip))) {
|
||||
$asfile = 1;
|
||||
}
|
||||
|
||||
if(empty($asfile))
|
||||
{
|
||||
include("./header.inc.php3");
|
||||
print "<div align=left><pre>\n";
|
||||
|
||||
/**
|
||||
* Send headers depending on whether the user choosen to download a dump file
|
||||
* or not
|
||||
*/
|
||||
// No download
|
||||
if (empty($asfile)) {
|
||||
$cfgServer_backup = $cfgServer;
|
||||
include('./header.inc.php3');
|
||||
$cfgServer = $cfgServer_backup;
|
||||
unset($cfgServer_backup);
|
||||
echo '<div align="left">' . "\n";
|
||||
echo ' <pre>' . "\n";
|
||||
} // end if
|
||||
|
||||
// Download
|
||||
else {
|
||||
// Defines filename and extension
|
||||
if (!isset($table)) {
|
||||
$filename = $db;
|
||||
} else {
|
||||
$filename = $table;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isset($table)) $filename=$db;
|
||||
else $filename=$table;
|
||||
include("./lib.inc.php3");
|
||||
if (isset($bzip) && $bzip == 'bzip') {
|
||||
$ext = 'bz2';
|
||||
} else if (isset($gzip) && $gzip == 'gzip') {
|
||||
@@ -31,171 +124,133 @@ else
|
||||
$ext = 'sql';
|
||||
}
|
||||
|
||||
// Send headers
|
||||
header('Content-Type: application/octetstream');
|
||||
header('Content-Disposition: filename="' . $filename . '.' . $ext . '"');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
} // end download
|
||||
|
||||
// doing some DOS-CRLF magic...
|
||||
|
||||
if (!isset($HTTP_USER_AGENT))
|
||||
{
|
||||
if (!empty($HTTP_SERVER_VARS) && isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']))
|
||||
$HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
|
||||
else
|
||||
$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
|
||||
}
|
||||
$client = $HTTP_USER_AGENT;
|
||||
|
||||
if(ereg('[^(]*\((.*)\)[^)]*',$client,$regs))
|
||||
{
|
||||
$os = $regs[1];
|
||||
// this looks better under WinX
|
||||
if (eregi("Win",$os))
|
||||
$crlf="\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
function my_handler($sql_insert)
|
||||
{
|
||||
global $crlf, $asfile;
|
||||
global $tmp_buffer;
|
||||
|
||||
if(empty($asfile))
|
||||
$tmp_buffer.= htmlspecialchars("$sql_insert;$crlf");
|
||||
else
|
||||
$tmp_buffer.= "$sql_insert;$crlf";
|
||||
}
|
||||
|
||||
function my_csvhandler($sql_insert)
|
||||
{
|
||||
// 2001-05-07, Lem9: added $add_character
|
||||
// 2001-07-12, loic1: $crlf should be used only if there is no EOL
|
||||
// character defined by the user
|
||||
global $crlf, $add_character, $asfile;
|
||||
global $tmp_buffer;
|
||||
|
||||
// Handles the EOL character
|
||||
if (empty($add_character)) {
|
||||
$add_character = $crlf;
|
||||
}
|
||||
else {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$add_character = stripslashes($add_character);
|
||||
}
|
||||
$add_character = str_replace('\\r', "\015", $add_character);
|
||||
$add_character = str_replace('\\n', "\012", $add_character);
|
||||
$add_character = str_replace('\\t', "\011", $add_character);
|
||||
}
|
||||
|
||||
// Result will be displays on screen
|
||||
if (empty($asfile)) {
|
||||
$tmp_buffer .= htmlspecialchars($sql_insert) . $add_character;
|
||||
}
|
||||
// Result will be save in a file
|
||||
else {
|
||||
$tmp_buffer .= $sql_insert . $add_character;
|
||||
}
|
||||
}
|
||||
|
||||
$dump_buffer="";
|
||||
|
||||
/**
|
||||
* Builds the dump
|
||||
*/
|
||||
// Gets the number of tables if a dump of a database has been required
|
||||
if (!isset($table)) {
|
||||
$tables = mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$num_tables = 1;
|
||||
$single=true;
|
||||
$single = TRUE;
|
||||
}
|
||||
if($num_tables == 0)
|
||||
{
|
||||
echo "# $strNoTablesFound";
|
||||
|
||||
// No table -> error message
|
||||
if ($num_tables == 0) {
|
||||
echo '# ' . $strNoTablesFound;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($what != "csv")
|
||||
{
|
||||
$dump_buffer.= "# phpMyAdmin MySQL-Dump$crlf";
|
||||
$dump_buffer.= "# version ".PHPMYADMIN_VERSION."$crlf";
|
||||
$dump_buffer.= "# http://phpwizard.net/phpMyAdmin/$crlf";
|
||||
$dump_buffer.= "# http://phpmyadmin.sourceforge.net/ (download page)$crlf";
|
||||
$dump_buffer.= "#$crlf";
|
||||
$dump_buffer.= "# $strHost: ".$cfgServer['host'];
|
||||
if(!empty($cfgServer['port'])) $dump_buffer.= ":" . $cfgServer['port'];
|
||||
$dump_buffer.= $crlf;
|
||||
$dump_buffer.= "# $strGenTime: ".date("F j, Y, g:i a")."$crlf";
|
||||
$dump_buffer.= "# $strServerVersion: ".MYSQL_MAJOR_VERSION.".".MYSQL_MINOR_VERSION."$crlf";
|
||||
$dump_buffer.= "# $strPHPVersion: ".phpversion()."$crlf";
|
||||
$dump_buffer.= "# $strDatabase: $db$crlf";
|
||||
// At least on table -> do the work
|
||||
else {
|
||||
// No csv format -> add some comments at the top
|
||||
if ($what != 'csv') {
|
||||
$dump_buffer .= '# phpMyAdmin MySQL-Dump' . $crlf
|
||||
. '# version ' . PHPMYADMIN_VERSION . $crlf
|
||||
. '# http://phpwizard.net/phpMyAdmin/' . $crlf
|
||||
. '# http://phpmyadmin.sourceforge.net/ (download page)' . $crlf
|
||||
. '#' . $crlf
|
||||
. '# ' . $strHost . ': ' . $cfgServer['host'];
|
||||
if (!empty($cfgServer['port'])) {
|
||||
$dump_buffer .= ':' . $cfgServer['port'];
|
||||
}
|
||||
$formatted_db_name = (isset($use_backquotes))
|
||||
? backquote($db)
|
||||
: '\'' . $db . '\'';
|
||||
$dump_buffer .= $crlf
|
||||
. '# ' . $strGenTime . ': ' . date('F j, Y, g:i a') . $crlf
|
||||
. '# ' . $strServerVersion . ': ' . MYSQL_MAJOR_VERSION . '.' . MYSQL_MINOR_VERSION . $crlf
|
||||
. '# ' . $strPHPVersion . ': ' . phpversion() . $crlf
|
||||
. '# ' . $strDatabase . ': ' . $formatted_db_name . $crlf;
|
||||
|
||||
$i = 0;
|
||||
if (isset($table_select)) {
|
||||
$tmp_select=implode($table_select,"|");
|
||||
$tmp_select="|".$tmp_select."|";
|
||||
$tmp_select = implode($table_select, '|');
|
||||
$tmp_select = '|' . $tmp_select . '|';
|
||||
}
|
||||
while($i < $num_tables)
|
||||
{
|
||||
|
||||
if (!isset($single)) $table = mysql_tablename($tables, $i);
|
||||
if(isset($tmp_select) && is_int(strpos($tmp_select,"|".$table."|"))==false) $i++;
|
||||
else
|
||||
{
|
||||
|
||||
if($what != "dataonly")
|
||||
{
|
||||
$dump_buffer.= "# --------------------------------------------------------$crlf";
|
||||
$dump_buffer.= "$crlf#$crlf";
|
||||
$dump_buffer.= "# $strTableStructure '$table'$crlf";
|
||||
$dump_buffer.= "#$crlf$crlf";
|
||||
$dump_buffer.= get_table_def($db,$table, $crlf).";$crlf";
|
||||
while ($i < $num_tables) {
|
||||
if (!isset($single)) {
|
||||
$table = mysql_tablename($tables, $i);
|
||||
}
|
||||
|
||||
if(($what == "data") || ($what == "dataonly"))
|
||||
{
|
||||
$dump_buffer.= "$crlf#$crlf";
|
||||
$dump_buffer.= "# $strDumpingData '$table'$crlf";
|
||||
$dump_buffer.= "#$crlf$crlf";
|
||||
|
||||
$tmp_buffer="";
|
||||
if (isset($tmp_select) && is_int(strpos($tmp_select, '|' . $table . '|')) == FALSE) {
|
||||
$i++;
|
||||
} else {
|
||||
$formatted_table_name = (isset($use_backquotes))
|
||||
? backquote($table)
|
||||
: '\'' . $table . '\'';
|
||||
// If only datas, no need to displays table name
|
||||
if ($what != 'dataonly') {
|
||||
$dump_buffer.= '# --------------------------------------------------------' . $crlf
|
||||
. $crlf . '#' . $crlf
|
||||
. '# ' . $strTableStructure . ' ' . $formatted_table_name . $crlf
|
||||
. '#' . $crlf . $crlf
|
||||
. get_table_def($db, $table, $crlf) . ';' . $crlf;
|
||||
}
|
||||
// At least data
|
||||
if (($what == 'data') || ($what == 'dataonly')) {
|
||||
$dump_buffer .= $crlf . '#' . $crlf
|
||||
. '# ' . $strDumpingData . ' ' . $formatted_table_name . $crlf
|
||||
. '#' . $crlf .$crlf;
|
||||
$tmp_buffer = '';
|
||||
if (!isset($limit_from) || !isset($limit_to)) {
|
||||
$limit_from = $limit_to = 0;
|
||||
}
|
||||
get_table_content($db, $table, $limit_from, $limit_to, 'my_handler');
|
||||
$dump_buffer .= $tmp_buffer;
|
||||
}
|
||||
} // end if
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Don't remove, it makes easier to select & copy frombrowser - staybyte
|
||||
$dump_buffer.= "$crlf";
|
||||
}
|
||||
else
|
||||
{ // $what != "csv"
|
||||
$tmp_buffer="";
|
||||
get_table_csv($db, $table, $limit_from, $limit_to, $separator, "my_csvhandler");
|
||||
$dump_buffer.=$tmp_buffer;
|
||||
}
|
||||
}
|
||||
} // end if-else
|
||||
} // end while
|
||||
|
||||
// Don't remove, it makes easier to select & copy frombrowser - staybyte
|
||||
$dump_buffer .= $crlf;
|
||||
} // end 'no csv' case
|
||||
|
||||
// 'csv' case
|
||||
else {
|
||||
$tmp_buffer = '';
|
||||
get_table_csv($db, $table, $limit_from, $limit_to, $separator, 'my_csvhandler');
|
||||
$dump_buffer .= $tmp_buffer;
|
||||
} // end 'csv case
|
||||
} // end building the dump
|
||||
|
||||
|
||||
/**
|
||||
* "Displays" the dump...
|
||||
*/
|
||||
// 1. as a bzipped file
|
||||
if (isset($bzip) && $bzip == 'bzip') {
|
||||
if (@function_exists('bzcompress')) {
|
||||
echo bzcompress($dump_buffer);
|
||||
}
|
||||
}
|
||||
// 2. as a gzipped file
|
||||
else if (isset($gzip) && $gzip == 'gzip') {
|
||||
if ($gzip == 'gzip' && @function_exists('gzencode')) {
|
||||
// without the optional parameter level because it bug
|
||||
echo gzencode($dump_buffer);
|
||||
}
|
||||
}
|
||||
// 3. on screen
|
||||
else {
|
||||
echo $dump_buffer;
|
||||
}
|
||||
|
||||
if(empty($asfile))
|
||||
{
|
||||
echo "</pre></div>\n";
|
||||
include("./footer.inc.php3");
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the html tags and add the footers in dump is displayed on screen
|
||||
*/
|
||||
if (empty($asfile)) {
|
||||
echo ' </pre>' . "\n";
|
||||
echo '</div>' . "\n";
|
||||
echo "\n";
|
||||
include('./footer.inc.php3');
|
||||
} // end if
|
||||
?>
|
||||
|
@@ -2,147 +2,145 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
|
||||
|
||||
if(!isset($message))
|
||||
{
|
||||
include("./header.inc.php3");
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Gets the variables sent or posted to this script, then displays headers
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
if (!isset($message)) {
|
||||
include('./header.inc.php3');
|
||||
} else {
|
||||
show_message($message);
|
||||
}
|
||||
|
||||
unset($sql_query);
|
||||
|
||||
|
||||
/**
|
||||
* Selects the database
|
||||
*/
|
||||
mysql_select_db($db);
|
||||
if(MYSQL_MAJOR_VERSION == "3.23")
|
||||
{
|
||||
$result = mysql_query("SHOW TABLE STATUS LIKE '$table'") or mysql_die();
|
||||
|
||||
|
||||
/**
|
||||
* Displays the comments of the table is MySQL >= 3.23
|
||||
*/
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23) {
|
||||
$result = mysql_query('SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'') or mysql_die();
|
||||
$row = mysql_fetch_array($result);
|
||||
if(!empty($row["Comment"]))
|
||||
{
|
||||
echo "$strTableComments: " . $row['Comment'];
|
||||
}
|
||||
if (!empty($row['Comment'])) {
|
||||
echo $strTableComments . ' : ' . $row['Comment'];
|
||||
}
|
||||
} // end display comments
|
||||
|
||||
$result = mysql_query("SHOW KEYS FROM $table") or mysql_die();
|
||||
$primary = "";
|
||||
|
||||
while($row = mysql_fetch_array($result))
|
||||
if ($row["Key_name"] == "PRIMARY")
|
||||
$primary .= "$row[Column_name], ";
|
||||
|
||||
$result = mysql_query("SHOW FIELDS FROM $table") or mysql_die();
|
||||
|
||||
/**
|
||||
* Displays the table structure
|
||||
*/
|
||||
// Gets fields properties
|
||||
$result = mysql_query('SHOW FIELDS FROM ' . backquote($table)) or mysql_die();
|
||||
?>
|
||||
<table border=<?php echo $cfgBorder;?>>
|
||||
<TR>
|
||||
<TH><?php echo $strField; ?></TH>
|
||||
<TH><?php echo $strType; ?></TH>
|
||||
<TH><?php echo $strAttr; ?></TH>
|
||||
<TH><?php echo $strNull; ?></TH>
|
||||
<TH><?php echo $strDefault; ?></TH>
|
||||
<TH><?php echo $strExtra; ?></TH>
|
||||
</TR>
|
||||
|
||||
<!-- TABLE INFORMATIONS -->
|
||||
<table border="<?php echo $cfgBorder; ?>">
|
||||
<tr>
|
||||
<th><?php echo ucfirst($strField); ?></th>
|
||||
<th><?php echo ucfirst($strType); ?></th>
|
||||
<th><?php echo ucfirst($strAttr); ?></th>
|
||||
<th><?php echo ucfirst($strNull); ?></th>
|
||||
<th><?php echo ucfirst($strDefault); ?></th>
|
||||
<th><?php echo ucfirst($strExtra); ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$i = 0;
|
||||
|
||||
while($row= mysql_fetch_array($result))
|
||||
{
|
||||
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
|
||||
$bgcolor = $cfgBgcolorOne;
|
||||
$i % 2 ? 0: $bgcolor = $cfgBgcolorTwo;
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$bgcolor = ($i % 2) ?$cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
$i++;
|
||||
|
||||
$type = $row['Type'];
|
||||
// reformat mysql query output - staybyte - 9. June 2001
|
||||
$shorttype = substr($type, 0, 3);
|
||||
if ($shorttype == 'set' || $shorttype == 'enu') {
|
||||
$type = eregi_replace(',', ', ', $type);
|
||||
$type_nowrap = '';
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
}
|
||||
$type = eregi_replace('BINARY', '', $type);
|
||||
$type = eregi_replace('ZEROFILL', '', $type);
|
||||
$type = eregi_replace('UNSIGNED', '', $type);
|
||||
if (empty($type)) {
|
||||
$type = ' ';
|
||||
}
|
||||
|
||||
$binary = eregi('BINARY', $row['Type'], $test);
|
||||
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
|
||||
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
|
||||
$strAttribute = ' ';
|
||||
if ($binary) {
|
||||
$strAttribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$strAttribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$strAttribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||
<td><?php echo $row["Field"];?> </td>
|
||||
<td>
|
||||
<?php
|
||||
if(get_magic_quotes_gpc()) {
|
||||
$Type = stripslashes($row["Type"]);
|
||||
} else {
|
||||
$Type = $row["Type"];
|
||||
}
|
||||
// reformat mysql query output - staybyte - 9. June 2001
|
||||
$shorttype=substr($Type,0,3);
|
||||
if ($shorttype=="set" || $shorttype=="enu"){
|
||||
$Type=eregi_replace (",",", ",$Type);
|
||||
}
|
||||
$Type = eregi_replace("BINARY", "", $Type);
|
||||
$Type = eregi_replace("ZEROFILL", "", $Type);
|
||||
$Type = eregi_replace("UNSIGNED", "", $Type);
|
||||
if (!empty($Type)) echo $Type;
|
||||
else echo " ";
|
||||
?></td><td>
|
||||
<?php
|
||||
$binary = eregi("BINARY", $row["Type"], $test);
|
||||
$unsigned = eregi("UNSIGNED", $row["Type"], $test);
|
||||
$zerofill = eregi("ZEROFILL", $row["Type"], $test);
|
||||
$strAttribute="";
|
||||
if ($binary)
|
||||
$strAttribute="BINARY";
|
||||
if ($unsigned)
|
||||
$strAttribute="UNSIGNED";
|
||||
if ($zerofill)
|
||||
$strAttribute="UNSIGNED ZEROFILL";
|
||||
if (!empty($strAttribute)) echo $strAttribute;
|
||||
else echo " ";
|
||||
$strAttribute="";
|
||||
?></td>
|
||||
<td><?php if ($row["Null"] == "") { echo $strNo;} else {echo $strYes;}?> </td>
|
||||
<td><?php if(isset($row["Default"])) echo $row["Default"];?> </td>
|
||||
<td><?php echo $row["Extra"];?> </td>
|
||||
<td nowrap="nowrap"><?php echo htmlspecialchars($row['Field']); ?> </td>
|
||||
<td<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
|
||||
<td nowrap="nowrap"><?php echo $strAttribute; ?></td>
|
||||
<td><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?> </td>
|
||||
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo htmlspecialchars($row['Default']); ?> </td>
|
||||
<td nowrap="nowrap"><?php echo $row['Extra']; ?> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} // end while
|
||||
echo "\n";
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
$result = mysql_query("SHOW KEYS FROM ".$table) or mysql_die();
|
||||
if(mysql_num_rows($result)>0)
|
||||
{
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Displays indexes
|
||||
*/
|
||||
$result = mysql_query('SHOW KEYS FROM ' . backquote($table)) or mysql_die();
|
||||
if (mysql_num_rows($result) > 0) {
|
||||
?>
|
||||
<br>
|
||||
<table border=<?php echo $cfgBorder;?>>
|
||||
|
||||
<!-- Indexes -->
|
||||
<br />
|
||||
<?php echo $strIndexes . ' :' . "\n"; ?>
|
||||
<table border="<?php echo $cfgBorder; ?>">
|
||||
<tr>
|
||||
<th><?php echo $strKeyname; ?></th>
|
||||
<th><?php echo $strUnique; ?></th>
|
||||
<th><?php echo $strField; ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
for($i=0 ; $i<mysql_num_rows($result); $i++)
|
||||
{
|
||||
for ($i = 0 ; $i < mysql_num_rows($result); $i++) {
|
||||
$row = mysql_fetch_array($result);
|
||||
echo "<tr>";
|
||||
if($row["Key_name"] == "PRIMARY")
|
||||
{
|
||||
$sql_query = urlencode("ALTER TABLE ".$table." DROP PRIMARY KEY");
|
||||
$zero_rows = urlencode($strPrimaryKey." ".$strHasBeenDropped);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_query = urlencode("ALTER TABLE ".$table." DROP INDEX ".$row["Key_name"]);
|
||||
$zero_rows = urlencode($strIndex." ".$row["Key_name"]." ".$strHasBeenDropped);
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
?>
|
||||
<td><?php echo $row["Key_name"];?></td>
|
||||
<td><?php
|
||||
if($row["Non_unique"]=="0")
|
||||
echo $strYes;
|
||||
else
|
||||
echo $strNo;
|
||||
?></td>
|
||||
<td><?php echo $row["Column_name"];?></td>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($row['Key_name']) . "\n"; ?></td>
|
||||
<td><?php echo (($row['Non_unique'] == '0') ? $strYes : $strNo) . "\n"; ?></td>
|
||||
<td><?php echo htmlspecialchars($row['Column_name']) . "\n"; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
echo "</tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
require("./footer.inc.php3");
|
||||
} // end for
|
||||
echo "\n";
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} // end if
|
||||
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
@@ -1,24 +1,29 @@
|
||||
<!-- $Id$ */ -->
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
?>
|
||||
<form method="post" action="<?php echo $action; ?>">
|
||||
<input type="hidden" name="server" value="<?php echo $server;?>">
|
||||
<input type="hidden" name="lang" value="<?php echo $lang;?>">
|
||||
<input type="hidden" name="db" value="<?php echo $db;?>">
|
||||
<input type="hidden" name="table" value="<?php echo $table;?>">
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||
<?php
|
||||
if($action == "tbl_create.php3")
|
||||
{
|
||||
if ($action == 'tbl_create.php3') {
|
||||
?>
|
||||
<input type="hidden" name="reload" value="true">
|
||||
<input type="hidden" name="reload" value="true" />
|
||||
<?php
|
||||
}
|
||||
elseif($action == "tbl_addfield.php3")
|
||||
{
|
||||
echo '<input type="hidden" name="after_field" value="'.$after_field."\">\n";
|
||||
else if ($action == 'tbl_addfield.php3') {
|
||||
echo "\n";
|
||||
?>
|
||||
<input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
|
||||
?>
|
||||
<table border=<?php echo $cfgBorder;?>>
|
||||
<table border="<?php echo $cfgBorder; ?>">
|
||||
<tr>
|
||||
<th><?php echo $strField; ?></th>
|
||||
<th><?php echo $strType; ?></th>
|
||||
@@ -27,204 +32,251 @@ elseif($action == "tbl_addfield.php3")
|
||||
<th><?php echo $strNull; ?></th>
|
||||
<th><?php echo $strDefault; ?></th>
|
||||
<th><?php echo $strExtra; ?></th>
|
||||
|
||||
<?php
|
||||
if($action == "tbl_create.php3" || $action == "tbl_addfield.php3")
|
||||
{ if (empty($num_indexes))
|
||||
{
|
||||
echo "<th>$strPrimary</th>";
|
||||
echo "<th>$strIndex</th>";
|
||||
if ($action == 'tbl_create.php3' || $action == 'tbl_addfield.php3') {
|
||||
if (empty($num_indexes)) {
|
||||
echo " <th>$strPrimary</th>\n";
|
||||
echo " <th>$strIndex</th>\n";
|
||||
echo " <th>$strUnique</th>\n";
|
||||
}
|
||||
else { for ($i=0; $i<$num_indexes; $i++) {
|
||||
echo "<th>$strSequence</th>";
|
||||
} else {
|
||||
for ($i = 0; $i < $num_indexes; $i++) {
|
||||
echo " <th>$strSequence</th>\n";
|
||||
echo " <th>$strLength</th>\n";
|
||||
}
|
||||
}
|
||||
} // end for
|
||||
} // end if
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
for($i=0 ; $i<$num_fields; $i++)
|
||||
{
|
||||
if(isset($result))
|
||||
for ($i = 0 ; $i < $num_fields; $i++) {
|
||||
if (isset($result)) {
|
||||
$row = mysql_fetch_array($result);
|
||||
$bgcolor = $cfgBgcolorOne;
|
||||
$i % 2 ? 0: $bgcolor = $cfgBgcolorTwo;
|
||||
}
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
?>
|
||||
<tr bgcolor="<?php echo $bgcolor;?>">
|
||||
<td>
|
||||
<input type="text" name="field_name[]" size="10" value="<?php if(isset($row) && isset($row["Field"])) echo $row["Field"];?>">
|
||||
<input type="hidden" name="field_orig[]" value="<?php if(isset($row) && isset($row["Field"])) echo $row["Field"];?>"></td>
|
||||
<td><select name="field_type[]">
|
||||
<input type="text" name="field_name[]" size="10" value="<?php if (isset($row) && isset($row['Field'])) echo str_replace('"', '"', $row['Field']); ?>" />
|
||||
<input type="hidden" name="field_orig[]" value="<?php if (isset($row) && isset($row['Field'])) echo urlencode($row['Field']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<select name="field_type[]">
|
||||
<?php
|
||||
$row["Type"] = empty($row["Type"]) ? '' : $row["Type"];
|
||||
if(get_magic_quotes_gpc()) {
|
||||
$Type = stripslashes($row["Type"]);
|
||||
} else {
|
||||
$Type = $row["Type"];
|
||||
echo "\n";
|
||||
if (empty($row['Type'])) {
|
||||
$row['Type'] = '';
|
||||
$type = '';
|
||||
}
|
||||
$Type = eregi_replace("BINARY", "", $Type);
|
||||
$Type = eregi_replace("ZEROFILL", "", $Type);
|
||||
$Type = eregi_replace("UNSIGNED", "", $Type);
|
||||
// $Length = eregi_replace("$Type|\\(|\\)", "", $Type);
|
||||
// Strange: $Type would always match $Type, so replaced with version below:
|
||||
// I Huneke (Logica) 29 September 1999
|
||||
#$Length = eregi_replace("\\(|\\)", "", $Type);
|
||||
$Length = $Type;
|
||||
$Type = eregi_replace("\\(.*\\)", "", $Type);
|
||||
$Type = chop($Type);
|
||||
// Add test to ensure we're not trying to replace blank with blank
|
||||
// I Huneke (Logica) 29 September 1999
|
||||
if(!empty($Type))
|
||||
{
|
||||
$Length = eregi_replace("^$Type\(", "", $Length);
|
||||
$Length = eregi_replace("\)$", "", trim($Length));
|
||||
else if (get_magic_quotes_gpc()) {
|
||||
$type = stripslashes($row['Type']);
|
||||
}
|
||||
else {
|
||||
$type = $row['Type'];
|
||||
}
|
||||
$type = eregi_replace('BINARY', '', $type);
|
||||
$type = eregi_replace('ZEROFILL', '', $type);
|
||||
$type = eregi_replace('UNSIGNED', '', $type);
|
||||
$length = $type;
|
||||
$type = eregi_replace('\\(.*\\)', '', $type);
|
||||
$type = chop($type);
|
||||
if (!empty($type)) {
|
||||
$length = eregi_replace("^$type\(", '', $length);
|
||||
$length = eregi_replace('\)$', '', trim($length));
|
||||
}
|
||||
$length = htmlspecialchars(chop($length));
|
||||
if($length == $type) {
|
||||
$length = '';
|
||||
}
|
||||
for ($j = 0; $j < count($cfgColumnTypes); $j++) {
|
||||
echo ' <option value="'. $cfgColumnTypes[$j] . '"';
|
||||
if (strtoupper($type) == strtoupper($cfgColumnTypes[$j])) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
$Length = htmlspecialchars(chop($Length));
|
||||
if($Length == $Type)
|
||||
$Length = "";
|
||||
for($j=0;$j<count($cfgColumnTypes);$j++)
|
||||
{
|
||||
echo "<option value=$cfgColumnTypes[$j]";
|
||||
if(strtoupper($Type) == strtoupper($cfgColumnTypes[$j]))
|
||||
echo " selected";
|
||||
echo ">$cfgColumnTypes[$j]</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="field_length[]" size="8" value="<?php echo $Length;?>"></td>
|
||||
<td><select name="field_attribute[]">
|
||||
<td>
|
||||
<input type="text" name="field_length[]" size="8" value="<?php echo $length; ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<select name="field_attribute[]">
|
||||
<?php
|
||||
$binary = eregi("BINARY", $row["Type"], $test_attribute1);
|
||||
$unsigned = eregi("UNSIGNED", $row["Type"], $test_attribute2);
|
||||
$zerofill = eregi("ZEROFILL", $row["Type"], $test_attribute3);
|
||||
$strAttribute = "";
|
||||
if($binary)
|
||||
$strAttribute="BINARY";
|
||||
if($unsigned)
|
||||
$strAttribute="UNSIGNED";
|
||||
if($zerofill)
|
||||
$strAttribute="UNSIGNED ZEROFILL";
|
||||
for($j=0;$j<count($cfgAttributeTypes);$j++)
|
||||
{
|
||||
echo "<option value=\"$cfgAttributeTypes[$j]\"";
|
||||
if(strtoupper($strAttribute) == strtoupper($cfgAttributeTypes[$j]))
|
||||
echo " selected";
|
||||
echo "\n";
|
||||
$binary = eregi('BINARY', $row['Type'], $test_attribute1);
|
||||
$unsigned = eregi('UNSIGNED', $row['Type'], $test_attribute2);
|
||||
$zerofill = eregi('ZEROFILL', $row['Type'], $test_attribute3);
|
||||
$strAttribute = '';
|
||||
if ($binary) {
|
||||
$strAttribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$strAttribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$strAttribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
for ($j = 0;$j < count($cfgAttributeTypes); $j++) {
|
||||
echo ' <option value="'. $cfgAttributeTypes[$j] . '"';
|
||||
if (strtoupper($strAttribute) == strtoupper($cfgAttributeTypes[$j])) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo ">$cfgAttributeTypes[$j]</option>\n";
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
<td><select name="field_null[]">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select name="field_null[]">
|
||||
<?php
|
||||
if(!isset($row) || !isset($row["Null"]) || $row["Null"] == "")
|
||||
{
|
||||
if (!isset($row) || empty($row['Null'])) {
|
||||
echo "\n";
|
||||
?>
|
||||
<option value="not null">not null</option>
|
||||
<option value="">null</option>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "\n";
|
||||
?>
|
||||
<option value="">null</option>
|
||||
<option value="not null">not null</option>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
</select></td>
|
||||
<td><input type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row["Default"])) echo $row["Default"];?>"></td>
|
||||
<td><select name="field_extra[]">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" name="field_default_orig[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo urlencode($row['Default']); ?>" />
|
||||
<input type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '"', $row['Default']); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<select name="field_extra[]">
|
||||
<?php
|
||||
if(!isset($row) || !isset($row["Extra"]) || $row["Extra"] == "")
|
||||
{
|
||||
if(!isset($row) || empty($row['Extra'])) {
|
||||
echo "\n";
|
||||
?>
|
||||
<option value=""></option>
|
||||
<option value="AUTO_INCREMENT">auto_increment</option>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "\n";
|
||||
?>
|
||||
<option value="AUTO_INCREMENT">auto_increment</option>
|
||||
<option value=""></option>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
</select></td>
|
||||
|
||||
<?php
|
||||
if($action == "tbl_create.php3" || $action == "tbl_addfield.php3")
|
||||
{
|
||||
if (empty($num_indexes))
|
||||
{
|
||||
?>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="field_primary[]" value="<?php echo $i;?>"
|
||||
<?php
|
||||
if(isset($row) && isset($row["Key"]) && $row["Key"] == "PRI")
|
||||
echo "checked";
|
||||
?>
|
||||
>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="field_index[]" value="<?php echo $i;?>"
|
||||
<?php
|
||||
if(isset($row) && isset($row["Key"]) && $row["Key"] == "MUL")
|
||||
echo "checked";
|
||||
?>
|
||||
>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="field_unique[]" value="<?php echo $i;?>"
|
||||
<?php
|
||||
if(isset($row) && isset($row["Key"]) && $row["Key"] == "UNI")
|
||||
echo "checked";
|
||||
?>
|
||||
>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
if ($action == 'tbl_create.php3' || $action == 'tbl_addfield.php3') {
|
||||
if (empty($num_indexes)) {
|
||||
if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
|
||||
$checked_primary = ' checked="checked"';
|
||||
} else {
|
||||
$checked_primary = '';
|
||||
}
|
||||
else {
|
||||
if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
|
||||
$checked_index = ' checked="checked"';
|
||||
} else {
|
||||
$checked_index = '';
|
||||
}
|
||||
if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
|
||||
$checked_unique = ' checked="checked"';
|
||||
} else {
|
||||
$checked_unique = '';
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="field_primary[]" value="<?php echo $i; ?>"<?php echo $checked_primary; ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="field_index[]" value="<?php echo $i; ?>"<?php echo $checked_index; ?> />
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" name="field_unique[]" value="<?php echo $i; ?>"<?php echo $checked_unique; ?> />
|
||||
</td>
|
||||
<?php
|
||||
} // end if (empty($num_indexes))
|
||||
} // end if ($action ==...)
|
||||
echo "\n";
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
} // end for
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
if($action == "tbl_create.php3" && MYSQL_MAJOR_VERSION >= "3.23")
|
||||
{
|
||||
echo "$strTableComments:<br>";
|
||||
?>
|
||||
<input type="text" name="comment" size="40" maxlength="80">
|
||||
<?php
|
||||
//BEGIN - Table Type - 2 May 2001 - Robbat2 - change by staybyte - 11 June 2001
|
||||
if($action == "tbl_create.php3")
|
||||
{
|
||||
// find mysql capability - staybyte - 11. June 2001
|
||||
$query="SHOW VARIABLES like 'have_%'";
|
||||
$result=mysql_query($query);
|
||||
if ($result!=false && mysql_num_rows($result)>0){
|
||||
while($tmp=mysql_fetch_array($result)){
|
||||
if (isset($tmp["Variable_name"])) switch ($tmp["Variable_name"]){
|
||||
case 'have_bdb': if (isset($tmp["Variable_name"]) && $tmp["Value"]=='YES') $tbl_bdb=true; break;
|
||||
case 'have_gemini': if (isset($tmp["Variable_name"]) && $tmp["Value"]=='YES') $tbl_gemini=true; break;
|
||||
case 'have_innodb': if (isset($tmp["Variable_name"]) && $tmp["Value"]=='YES') $tbl_innodb=true; break;
|
||||
case 'have_isam': if (isset($tmp["Variable_name"]) && $tmp["Value"]=='YES') $tbl_isam=true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
<br />
|
||||
|
||||
echo $strTableType.":"; ?>
|
||||
<select name="tbl_type">
|
||||
<option value="Default"><?php if (isset($strDefault)) echo $strDefault;?></option>
|
||||
<?php
|
||||
if ($action == 'tbl_create.php3' && MYSQL_MAJOR_VERSION >= 3.23) {
|
||||
echo "\n";
|
||||
?>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td><?php echo $strTableComments; ?> :</td>
|
||||
<?php
|
||||
if ($action == 'tbl_create.php3') {
|
||||
echo "\n";
|
||||
?>
|
||||
<td width="25"> </td>
|
||||
<td><?php echo $strTableType; ?> :</td>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="text" name="comment" size="40" maxlength="80" />
|
||||
</td>
|
||||
<?php
|
||||
// BEGIN - Table Type - 2 May 2001 - Robbat2
|
||||
// change by staybyte - 11 June 2001
|
||||
if ($action == 'tbl_create.php3') {
|
||||
// find mysql capability - staybyte - 11. June 2001
|
||||
$query = 'SHOW VARIABLES LIKE \'have_%\'';
|
||||
$result = mysql_query($query);
|
||||
if ($result != FALSE && mysql_num_rows($result) > 0) {
|
||||
while ($tmp = mysql_fetch_array($result)) {
|
||||
if (isset($tmp['Variable_name'])) {
|
||||
switch ($tmp['Variable_name']) {
|
||||
case 'have_bdb':
|
||||
if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
|
||||
$tbl_bdb = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'have_gemini':
|
||||
if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
|
||||
$tbl_gemini = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'have_innodb':
|
||||
if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
|
||||
$tbl_innodb = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'have_isam':
|
||||
if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
|
||||
$tbl_isam = TRUE;
|
||||
}
|
||||
break;
|
||||
} // end switch
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<td width="25"> </td>
|
||||
<td>
|
||||
<select name="tbl_type">
|
||||
<option value="Default"><?php echo $strDefault; ?></option>
|
||||
<option value="MYISAM">MyISAM</option>
|
||||
<option value="HEAP">Heap</option>
|
||||
<option value="MERGE">Merge</option>
|
||||
@@ -233,13 +285,22 @@ echo $strTableType.":"; ?>
|
||||
<?php if (isset($tbl_innodb)) { ?><option value="InnoDB">INNO DB</option><?php }?>
|
||||
<?php if (isset($tbl_isam)) { ?><option value="ISAM">ISAM</option><?php }?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<?php
|
||||
}
|
||||
echo "\n";
|
||||
// END - Table Type - 2 May 2001 - Robbat2
|
||||
?>
|
||||
<p>
|
||||
<input type="submit" name="submit" value="<?php echo $strSave;?>">
|
||||
</p>
|
||||
|
||||
<input type="submit" name="submit" value="<?php echo $strSave; ?>" />
|
||||
|
||||
</form>
|
||||
<center><?php print show_docu("manual_Reference.html#CREATE_TABLE");?></center>
|
||||
|
||||
<center><?php echo show_docu('manual_Reference.html#CREATE_TABLE'); ?></center>
|
||||
|
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets the variables sent to this script and diplays headers
|
||||
* Gets some core libraries and diplays headers
|
||||
*/
|
||||
require('./lib.inc.php3');
|
||||
require('./grab_globals.inc.php3');
|
||||
if (!isset($message)) {
|
||||
include('./header.inc.php3');
|
||||
@@ -22,18 +24,16 @@ mysql_select_db($db);
|
||||
/**
|
||||
* Set parameters for links
|
||||
*/
|
||||
|
||||
// it would be better to rename this variable "link_parameters" because
|
||||
// "query" is often used by developers for a quick query
|
||||
// and the real $query has to be reinitialized
|
||||
// (I had to rename $query to $query_tmp somewhere in this script)
|
||||
|
||||
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&goto=tbl_properties.php3';
|
||||
?>
|
||||
|
||||
<!-- first browse link -->
|
||||
<p>
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0">
|
||||
<b><?php echo $strBrowse; ?></b></a>
|
||||
</p>
|
||||
<?php
|
||||
@@ -43,20 +43,26 @@ $query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3
|
||||
* Gets table informations
|
||||
*/
|
||||
// 1. Get table type and comments ('show table' works correct since 3.23.03)
|
||||
if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) >= 3) {
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) {
|
||||
// Update table type, comment and order if required by the user
|
||||
if (isset($submitcomment)) {
|
||||
$result = mysql_query("ALTER TABLE $table COMMENT='$comment'") or mysql_die();
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$comment = stripslashes($comment);
|
||||
}
|
||||
if (empty($prev_comment) || urldecode($prev_comment) != str_replace('"', '"', $comment)) {
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($table) . ' COMMENT = \'' . sql_addslashes($comment) . '\'') or mysql_die();
|
||||
}
|
||||
}
|
||||
if (isset($submittype)) {
|
||||
$result = mysql_query("ALTER TABLE $table TYPE=$tbl_type") or mysql_die();
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($table) . " TYPE=$tbl_type") or mysql_die();
|
||||
}
|
||||
if (isset($submitorderby) && !empty($order_field)) {
|
||||
$result = mysql_query("ALTER TABLE $table ORDER BY $order_field") or mysql_die();
|
||||
$order_field = backquote(urldecode($order_field));
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($table) . 'ORDER BY ' . $order_field) or mysql_die();
|
||||
}
|
||||
|
||||
// Get table type and comments
|
||||
$result = mysql_query("SHOW TABLE STATUS LIKE '$table'") or mysql_die();
|
||||
$result = mysql_query('SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'') or mysql_die();
|
||||
$showtable = mysql_fetch_array($result);
|
||||
$tbl_type = strtoupper($showtable['Type']);
|
||||
|
||||
@@ -75,7 +81,7 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) >= 3) {
|
||||
}
|
||||
|
||||
// 2. Get table keys and retains them
|
||||
$result = mysql_query("SHOW KEYS FROM $table") or mysql_die();
|
||||
$result = mysql_query('SHOW KEYS FROM ' . backquote($table)) or mysql_die();
|
||||
$primary = '';
|
||||
while($row = mysql_fetch_array($result)) {
|
||||
$ret_keys[] = $row;
|
||||
@@ -85,7 +91,7 @@ while($row = mysql_fetch_array($result)) {
|
||||
}
|
||||
|
||||
// 3. Get fields
|
||||
$result = mysql_query("SHOW FIELDS FROM $table") or mysql_die();
|
||||
$result = mysql_query('SHOW FIELDS FROM ' . backquote($table)) or mysql_die();
|
||||
|
||||
|
||||
/**
|
||||
@@ -117,25 +123,21 @@ echo "\n";
|
||||
<?php
|
||||
$i = 0;
|
||||
$aryFields = array();
|
||||
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
|
||||
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$i++;
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
$aryFields[] = $row['Field'];
|
||||
|
||||
if (get_magic_quotes_runtime()) {
|
||||
$type = stripslashes($row['Type']);
|
||||
} else {
|
||||
$type = $row['Type'];
|
||||
}
|
||||
// reformat mysql query output - staybyte - 9. June 2001
|
||||
$shorttype = substr($type, 0, 3);
|
||||
if ($shorttype == 'set' || $shorttype == 'enu') {
|
||||
$type = eregi_replace(',', ', ', $type);
|
||||
$nowrap=false;
|
||||
$type_nowrap = '';
|
||||
} else {
|
||||
$type_nowrap = ' nowrap="nowrap"';
|
||||
}
|
||||
else $nowrap=true;
|
||||
$type = eregi_replace('BINARY', '', $type);
|
||||
$type = eregi_replace('ZEROFILL', '', $type);
|
||||
$type = eregi_replace('UNSIGNED', '', $type);
|
||||
@@ -147,43 +149,47 @@ while ($row = mysql_fetch_array($result)) {
|
||||
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
|
||||
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
|
||||
$strAttribute = ' ';
|
||||
if ($binary)
|
||||
if ($binary) {
|
||||
$strAttribute = 'BINARY';
|
||||
if ($unsigned)
|
||||
}
|
||||
if ($unsigned) {
|
||||
$strAttribute = 'UNSIGNED';
|
||||
if ($zerofill)
|
||||
}
|
||||
if ($zerofill) {
|
||||
$strAttribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||
<td nowrap="nowrap"><?php echo $row['Field']; ?> </td>
|
||||
<?php
|
||||
if ($nowrap) echo "<td nowrap=\"nowrap\">";
|
||||
else echo "<td>";
|
||||
echo $type;
|
||||
?></td>
|
||||
<td nowrap="nowrap"><?php echo htmlspecialchars($row['Field']); ?> </td>
|
||||
<td<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
|
||||
<td nowrap="nowrap"><?php echo $strAttribute; ?></td>
|
||||
<td><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?> </td>
|
||||
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?> </td>
|
||||
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo htmlspecialchars($row['Default']); ?> </td>
|
||||
<td nowrap="nowrap"><?php echo $row['Extra']; ?> </td>
|
||||
<?php
|
||||
if (empty($printer_friendly)) {
|
||||
echo "\n";
|
||||
?>
|
||||
<td>
|
||||
<a href="tbl_alter.php3?<?php echo $query; ?>&field=<?php echo $row['Field']; ?>"><?php echo $strChange; ?></a>
|
||||
<a href="tbl_alter.php3?<?php echo $url_query; ?>&field=<?php echo urlencode($row['Field']); ?>">
|
||||
<?php echo $strChange; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3?<?php echo $query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . $table . ' DROP ' . $row['Field']); ?>&zero_rows=<?php echo urlencode($row['Field'] . ' ' . $strHasBeenDropped); ?>"><?php echo $strDrop; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' DROP ' . backquote($row['Field'])); ?>&zero_rows=<?php echo urlencode(htmlspecialchars($row['Field']) . ' ' . $strHasBeenDropped); ?>">
|
||||
<?php echo $strDrop; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3?<?php echo $query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . $table . ' DROP PRIMARY KEY, ADD PRIMARY KEY(' . $primary . $row['Field'] . ')'); ?>&zero_rows=<?php echo urlencode($strAPrimaryKey . $row['Field']); ?>"><?php echo $strPrimary; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' DROP PRIMARY KEY, ADD PRIMARY KEY(' . $primary . backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode($strAPrimaryKey . ' ' . htmlspecialchars($row['Field'])); ?>">
|
||||
<?php echo $strPrimary; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3?<?php echo $query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . $table . ' ADD INDEX(' . $row['Field'] . ')'); ?>&zero_rows=<?php echo urlencode($strAnIndex . $row['Field']); ?>"><?php echo $strIndex; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' ADD INDEX(' . backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode($strAnIndex . ' ' . htmlspecialchars($row['Field'])); ?>">
|
||||
<?php echo $strIndex; ?></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="sql.php3?<?php echo $query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . $table . ' ADD UNIQUE(' . $row['Field'] . ')'); ?>&zero_rows=<?php echo urlencode($strAnIndex . $row['Field']); ?>"><?php echo $strUnique; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' ADD UNIQUE(' . backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode($strAnIndex . ' ' . htmlspecialchars($row['Field'])); ?>">
|
||||
<?php echo $strUnique; ?></a>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
@@ -227,20 +233,20 @@ if ($index_count > 0) {
|
||||
for ($i = 0; $i < $index_count; $i++) {
|
||||
$row = $ret_keys[$i];
|
||||
if ($row['Key_name'] == 'PRIMARY') {
|
||||
$sql_query = urlencode('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
|
||||
$sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP PRIMARY KEY');
|
||||
$zero_rows = urlencode($strPrimaryKey . ' ' . $strHasBeenDropped);
|
||||
} else {
|
||||
$sql_query = urlencode('ALTER TABLE ' . $table . ' DROP INDEX ' . $row['Key_name']);
|
||||
$zero_rows = urlencode($strIndex . ' ' . $row['Key_name'] . ' ' . $strHasBeenDropped);
|
||||
$sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP INDEX ' . backquote($row['Key_name']));
|
||||
$zero_rows = urlencode($strIndex . ' ' . htmlspecialchars($row['Key_name']) . ' ' . $strHasBeenDropped);
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $row['Key_name'] . "\n"; ?></td>
|
||||
<td><?php echo htmlspecialchars($row['Key_name']) . "\n"; ?></td>
|
||||
<td><?php echo (($row['Non_unique'] == '0') ? $strYes : $strNo) . "\n"; ?></td>
|
||||
<td><?php echo $row['Column_name'] . "\n"; ?></td>
|
||||
<td><?php echo htmlspecialchars($row['Column_name']) . "\n"; ?></td>
|
||||
<td>
|
||||
<?php echo "<a href=\"sql.php3?$query&sql_query=$sql_query&zero_rows=$zero_rows\">$strDrop</a>\n"; ?>
|
||||
<?php echo "<a href=\"sql.php3?$url_query&sql_query=$sql_query&zero_rows=$zero_rows\">$strDrop</a>\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
@@ -260,11 +266,13 @@ if ($index_count > 0) {
|
||||
?>
|
||||
<?php
|
||||
// BEGIN - Calc Table Space - staybyte - 9 June 2001
|
||||
if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_type != "INNODB" && isset($showtable)) {
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_type != "INNODB" && isset($showtable)) {
|
||||
// Gets some sizes
|
||||
if (isset($showtable['Type']) && $showtable['Type']=="MRG_MyISAM") $mergetable=true;
|
||||
if (isset($showtable['Type']) && $showtable['Type']=="MRG_MyISAM")
|
||||
$mergetable=true;
|
||||
list($data_size, $data_unit) = format_byte_down($showtable['Data_length']);
|
||||
if (!isset($mergetable)) list($index_size, $index_unit) = format_byte_down($showtable['Index_length']);
|
||||
if (!isset($mergetable))
|
||||
list($index_size, $index_unit) = format_byte_down($showtable['Index_length']);
|
||||
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
|
||||
list($free_size, $free_unit) = format_byte_down($showtable['Data_free']);
|
||||
}
|
||||
@@ -330,11 +338,10 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
|
||||
// Optimize link if overhead
|
||||
if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) {
|
||||
echo "\n";
|
||||
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
[<a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table"); ?>&pos=0&<?php echo $query; ?>"><?php echo $strOptimizeTable; ?></a>]
|
||||
[<a href="sql.php3?<?php echo $url_query; ?>&pos=0&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>&display=simple">[<?php echo $strOptimizeTable; ?>]</a>]
|
||||
</td>
|
||||
<tr>
|
||||
<?php
|
||||
@@ -405,7 +412,8 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (isset($showtable['Data_length']) && $showtable['Rows'] > 0 && !isset($mergetable)) {
|
||||
if (isset($showtable['Data_length']) && $showtable['Rows'] > 0
|
||||
&& !isset($mergetable)) {
|
||||
echo (++$i%2)
|
||||
? ' <tr bgcolor="' . $cfgBgcolorTwo . '">'
|
||||
: ' <tr bgcolor="' . $cfgBgcolorOne . '">';
|
||||
@@ -458,7 +466,7 @@ echo "\n";
|
||||
|
||||
<!-- Printable view of the table -->
|
||||
<li>
|
||||
<div style="margin-bottom: 10px"><a href="tbl_printview.php3?<?php echo $query; ?>"><?php echo $strPrintView; ?></a></div>
|
||||
<div style="margin-bottom: 10px"><a href="tbl_printview.php3?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
|
||||
</li>
|
||||
|
||||
<!-- Query box and bookmark support -->
|
||||
@@ -470,13 +478,10 @@ echo "\n";
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="goto" value="db_details.php3" />
|
||||
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
|
||||
<?php echo $strRunSQLQuery . $db . ' ' . show_docu('manual_Reference.html#SELECT'); ?> :<br />
|
||||
<?php echo $strRunSQLQuery . htmlspecialchars($db) . ' ' . show_docu('manual_Reference.html#SELECT'); ?> :<br />
|
||||
<div style="margin-bottom: 5px">
|
||||
<textarea name="sql_query" wrap="virtual"
|
||||
rows="<?php echo $cfgTextareaRows; ?>"
|
||||
cols="<?php echo $cfgTextareaCols; ?>"
|
||||
>
|
||||
SELECT * FROM <?php echo $table; ?> WHERE 1
|
||||
<textarea name="sql_query" rows="<?php echo $cfgTextareaRows; ?>" cols="<?php echo $cfgTextareaCols; ?>" wrap="virtual">
|
||||
SELECT * FROM <?php echo backquote($table); ?> WHERE 1
|
||||
</textarea><br />
|
||||
</div>
|
||||
<?php
|
||||
@@ -488,7 +493,7 @@ if ($cfgBookmark['db'] && $cfgBookmark['table']) {
|
||||
echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
|
||||
echo ' <option value=""></option>' . "\n";
|
||||
while (list($key, $value) = each($bookmark_list)) {
|
||||
echo ' <option value="' . htmlentities($value) . '">' . htmlentities($key) . '</option>' . "\n";
|
||||
echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
|
||||
}
|
||||
echo ' </select>' . "\n";
|
||||
echo ' <input type="radio" name="action_bookmark" value="0" checked="checked" style="vertical-align: middle" />' . $strSubmit . "\n";
|
||||
@@ -506,11 +511,11 @@ if ($cfgBookmark['db'] && $cfgBookmark['table']) {
|
||||
<!-- Display, select and insert -->
|
||||
<li>
|
||||
<div style="margin-bottom: 10px">
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0">
|
||||
<b><?php echo $strBrowse; ?></b></a> -
|
||||
<a href="tbl_select.php3?<?php echo $query; ?>">
|
||||
<a href="tbl_select.php3?<?php echo $url_query; ?>">
|
||||
<b><?php echo $strSelect; ?></b></a> -
|
||||
<a href="tbl_change.php3?<?php echo $query; ?>">
|
||||
<a href="tbl_change.php3?<?php echo $url_query; ?>">
|
||||
<b><?php echo $strInsert; ?></b></a>
|
||||
<br />
|
||||
</div>
|
||||
@@ -531,7 +536,7 @@ if ($cfgBookmark['db'] && $cfgBookmark['table']) {
|
||||
<?php
|
||||
reset($aryFields);
|
||||
while(list($junk, $fieldname) = each($aryFields)) {
|
||||
echo ' <option value="' . $fieldname . '">' . $strAfter . ' ' . $fieldname . '</option>' . "\n";
|
||||
echo ' <option value="' . urlencode($fieldname) . '">' . $strAfter . ' ' . htmlspecialchars($fieldname) . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -555,7 +560,7 @@ if (MYSQL_MAJOR_VERSION >= 3.23 && MYSQL_MINOR_VERSION >= 34) {
|
||||
echo "\n";
|
||||
reset($aryFields);
|
||||
while(list($junk, $fieldname) = each($aryFields)) {
|
||||
echo ' <option value="' . $fieldname . '">' . $fieldname . '</option>' . "\n";
|
||||
echo ' <option value="' . urlencode($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -570,7 +575,7 @@ echo "\n";
|
||||
|
||||
<!-- Insert a text file -->
|
||||
<li>
|
||||
<div style="margin-bottom: 10px"><a href="ldi_table.php3?<?php echo $query; ?>"><?php echo $strInsertTextfiles; ?></a></div>
|
||||
<div style="margin-bottom: 10px"><a href="ldi_table.php3?<?php echo $url_query; ?>"><?php echo $strInsertTextfiles; ?></a></div>
|
||||
</li>
|
||||
|
||||
<!-- Dump of a database -->
|
||||
@@ -581,41 +586,38 @@ echo "\n";
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||
<?php echo $strViewDumpDB; ?><br />
|
||||
<table>
|
||||
<table cellpadding="5" border="2">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<?php echo $strOffSet; ?>
|
||||
<input type="text" name="limit_from" value="0" size="5" style="vertical-align: middle" />
|
||||
<?php echo $strNbRecords; ?>
|
||||
<input type="text" name="limit_to" size="5" value="<?php echo count_records($db, $table, true); ?>" style="vertical-align: middle" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<td nowrap="nowrap">
|
||||
<input type="radio" name="what" value="structure" checked="checked" />
|
||||
<?php echo $strStrucOnly; ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="drop" value="1" />
|
||||
<?php echo $strStrucDrop . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $strStrucOnly; ?> <br />
|
||||
<input type="radio" name="what" value="data" />
|
||||
<?php echo $strStrucData; ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="showcolumns" value="yes" />
|
||||
<?php echo $strCompleteInserts . "\n"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $strStrucData; ?> <br />
|
||||
<input type="radio" name="what" value="dataonly" />
|
||||
<?php echo $strDataOnly; ?>
|
||||
<?php echo $strDataOnly; ?> <br />
|
||||
<input type="radio" name="what" value="csv" />
|
||||
<?php echo $strStrucCSV;?> :<br />
|
||||
<?php echo $strFields . ' '. $strTerminatedBy; ?>
|
||||
<input type="text" name="separator" size="1" value=";" /> <br />
|
||||
<?php echo $strLines . ' '. $strTerminatedBy; ?>
|
||||
<input type="text" name="add_character" size="2" value="<?php echo ((which_crlf() == "\n") ? '\n' : '\r\n'); ?>" />
|
||||
</td>
|
||||
<td>
|
||||
<td valign="middle">
|
||||
<input type="checkbox" name="drop" value="1" />
|
||||
<?php echo $strStrucDrop; ?><br />
|
||||
<input type="checkbox" name="showcolumns" value="yes" />
|
||||
<?php echo $strCompleteInserts; ?><br />
|
||||
<?php
|
||||
// Add backquotes checkbox
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) {
|
||||
?>
|
||||
<input type="checkbox" name="use_backquotes" value="1" />
|
||||
<?php echo $strUseBackquotes; ?><br />
|
||||
<?php
|
||||
} // end backquotes feature
|
||||
echo "\n";
|
||||
?>
|
||||
<br />
|
||||
<input type="checkbox" name="asfile" value="sendit" onclick="return checkTransmitDump(this.form, 'transmit')" />
|
||||
<?php echo $strSend . "\n"; ?>
|
||||
<?php
|
||||
@@ -624,7 +626,7 @@ if (PMA_INT_VERSION >= 40004) {
|
||||
$is_gzip = @function_exists('gzencode');
|
||||
$is_bzip = @function_exists('bzcompress');
|
||||
if ($is_gzip || $is_bzip) {
|
||||
echo "\n" . ' (';
|
||||
echo "\n" . ' (' . "\n";
|
||||
if ($is_gzip) {
|
||||
?>
|
||||
<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip . (($is_bzip) ? ' ' : '') . "\n"; ?>
|
||||
@@ -645,16 +647,14 @@ echo "\n";
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="radio" name="what" value="csv" />
|
||||
<?php echo $strStrucCSV;?> ->
|
||||
<?php echo $strFields . ' '. $strTerminatedBy; ?>
|
||||
<input type="text" name="separator" size="1" value=";" />
|
||||
<?php echo $strLines . ' '. $strTerminatedBy; ?>
|
||||
<input type="text" name="add_character" size="2" value="\n" />
|
||||
<?php echo $strData . ' : ' . $strOffSet; ?>
|
||||
<input type="text" name="limit_from" value="0" size="5" style="vertical-align: middle" />
|
||||
-- <?php echo $strNbRecords; ?>
|
||||
<input type="text" name="limit_to" size="5" value="<?php echo count_records($db, $table, TRUE); ?>" style="vertical-align: middle" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<td colspan="2" align="center">
|
||||
<input type="submit" value="<?php echo $strGo; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -732,7 +732,7 @@ echo "\n";
|
||||
</li>
|
||||
|
||||
<?php
|
||||
if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
if ($tbl_type == 'MYISAM' or $tbl_type == 'BDB') {
|
||||
?>
|
||||
<!-- Table maintenance -->
|
||||
@@ -746,7 +746,7 @@ if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
if ($tbl_type == 'MYISAM') {
|
||||
?>
|
||||
<td>
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("CHECK TABLE $table"); ?>&display=simple&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('CHECK TABLE ' . backquote($table)); ?>&display=simple">
|
||||
<?php echo $strCheckTable; ?></a>
|
||||
<?php echo show_docu('manual_Reference.html#CHECK_TABLE') . "\n"; ?>
|
||||
</td>
|
||||
@@ -757,7 +757,7 @@ if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
|
||||
?>
|
||||
<td>
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("ANALYZE TABLE $table"); ?>&display=simple&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ANALYZE TABLE ' . backquote($table)); ?>&display=simple">
|
||||
<?php echo $strAnalyzeTable; ?></a>
|
||||
<?php echo show_docu('manual_Reference.html#ANALYZE_TABLE') . "\n";?>
|
||||
</td>
|
||||
@@ -773,7 +773,7 @@ if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
if ($tbl_type == 'MYISAM') {
|
||||
?>
|
||||
<td>
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("REPAIR TABLE $table"); ?>&display=simple&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('REPAIR TABLE ' . backquote($table)); ?>&display=simple">
|
||||
<?php echo $strRepairTable; ?></a>
|
||||
<?php echo show_docu('manual_Reference.html#REPAIR_TABLE') . "\n"; ?>
|
||||
</td>
|
||||
@@ -784,7 +784,7 @@ if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
|
||||
?>
|
||||
<td>
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table"); ?>&display=simple&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>&display=simple">
|
||||
<?php echo $strOptimizeTable; ?></a>
|
||||
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
|
||||
</td>
|
||||
@@ -809,7 +809,8 @@ if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||
<?php echo $strTableComments; ?> :
|
||||
<input type="text" name="comment" maxlength="60" size="30" value="<?php echo $show_comment; ?>" style="vertical-align: middle" />
|
||||
<input type="hidden" name="prev_comment" value="<?php echo urlencode($show_comment); ?>" />
|
||||
<input type="text" name="comment" maxlength="60" size="30" value="<?php echo str_replace('"', '"', $show_comment); ?>" style="vertical-align: middle" />
|
||||
<input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
|
||||
</form>
|
||||
</li>
|
||||
@@ -817,30 +818,30 @@ if (MYSQL_MAJOR_VERSION == '3.23' && intval(MYSQL_MINOR_VERSION) >= 22) {
|
||||
<!-- Table type -->
|
||||
<?php
|
||||
// modify robbat2 code - staybyte - 11. June 2001
|
||||
$query_tmp = "SHOW VARIABLES LIKE 'have_%'";
|
||||
$result = mysql_query($query_tmp);
|
||||
if ($result != false && mysql_num_rows($result) > 0) {
|
||||
$query = "SHOW VARIABLES LIKE 'have_%'";
|
||||
$result = mysql_query($query);
|
||||
if ($result != FALSE && mysql_num_rows($result) > 0) {
|
||||
while ($tmp = mysql_fetch_array($result)) {
|
||||
if (isset($tmp['Variable_name'])) {
|
||||
switch ($tmp['Variable_name']) {
|
||||
case 'have_bdb':
|
||||
if ($tmp['Value'] == 'YES') {
|
||||
$tbl_bdb = true;
|
||||
$tbl_bdb = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'have_gemini':
|
||||
if ($tmp['Value'] == 'YES') {
|
||||
$tbl_gemini = true;
|
||||
$tbl_gemini = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'have_innodb':
|
||||
if ($tmp['Value'] == 'YES') {
|
||||
$tbl_innodb = true;
|
||||
$tbl_innodb = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'have_isam':
|
||||
if ($tmp['Value'] == 'YES') {
|
||||
$tbl_isam = true;
|
||||
$tbl_isam = TRUE;
|
||||
}
|
||||
break;
|
||||
} // end switch
|
||||
@@ -879,7 +880,7 @@ else { // MySQL < 3.23
|
||||
<!-- Table maintenance -->
|
||||
<li>
|
||||
<?php echo $strTableMaintenance; ?> :
|
||||
<a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table"); ?>&display=simple&<?php echo $query; ?>">
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>&display=simple">
|
||||
<?php echo $strOptimizeTable; ?></a>
|
||||
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
|
||||
</li>
|
||||
@@ -889,14 +890,16 @@ else { // MySQL < 3.23
|
||||
?>
|
||||
|
||||
<li>
|
||||
<a href="sql.php3?<?php echo $query; ?>&goto=db_details.php3&reload=true&sql_query=<?php echo urlencode("DROP TABLE $table"); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . $table . ' ' . $strHasBeenDropped); ?>"><?php echo $strDrop . ' ' . $table; ?></a>
|
||||
<a href="sql.php3?<?php echo $url_query; ?>&goto=db_details.php3&reload=true&sql_query=<?php echo urlencode('DROP TABLE ' . backquote($table)); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenDropped); ?>">
|
||||
<?php echo $strDrop . ' ' . htmlspecialchars($table); ?></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
require('./footer.inc.php3');
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
1074
tbl_qbe.php3
1074
tbl_qbe.php3
File diff suppressed because it is too large
Load Diff
@@ -2,26 +2,38 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
if (isset($new_name)) $new_name=trim($new_name); // Cleanup to suppress '' tables
|
||||
if (isset($new_name) && $new_name!=""){
|
||||
|
||||
/**
|
||||
* A new name has been submitted -> do the work
|
||||
*/
|
||||
if (isset($new_name) && trim($new_name) != '') {
|
||||
$old_name = $table;
|
||||
$table = $new_name;
|
||||
|
||||
include("./header.inc.php3");
|
||||
|
||||
include('./header.inc.php3');
|
||||
mysql_select_db($db);
|
||||
$result = mysql_query("ALTER TABLE $old_name RENAME $new_name") or mysql_die();
|
||||
$table = $old_name;
|
||||
eval("\$message = \"$strRenameTableOK\";");
|
||||
$table = $new_name;
|
||||
$result = mysql_query('ALTER TABLE ' . backquote($old_name) . ' RENAME ' . backquote($new_name)) or mysql_die();
|
||||
$message = sprintf($strRenameTableOK, $old_name, $table);
|
||||
$reload = 'true';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* No new name for the table!
|
||||
*/
|
||||
else {
|
||||
include("./header.inc.php3");
|
||||
include('./header.inc.php3');
|
||||
mysql_die($strTableEmpty);
|
||||
}
|
||||
|
||||
require("./tbl_properties.php3");
|
||||
|
||||
/**
|
||||
* Back to the calling script
|
||||
*/
|
||||
require('./tbl_properties.php3');
|
||||
?>
|
||||
|
147
tbl_replace.php3
147
tbl_replace.php3
@@ -2,39 +2,82 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
|
||||
require("./lib.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
/**
|
||||
* Initializes some variables
|
||||
*/
|
||||
// Defines the url to return in casse of success of the query
|
||||
if (isset($sql_query)) {
|
||||
$sql_query = urldecode($sql_query);
|
||||
if($goto == "sql.php3")
|
||||
{
|
||||
$goto = "sql.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&sql_query=".urlencode($sql_query);
|
||||
}
|
||||
|
||||
if ($goto == 'sql.php3') {
|
||||
$goto = 'sql.php3?'
|
||||
. 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&pos=' . $pos
|
||||
. '&sql_query=' . urlencode($sql_query);
|
||||
}
|
||||
// Resets tables defined in the configuration file
|
||||
reset($fields);
|
||||
reset($funcs);
|
||||
// Misc
|
||||
$is_encoded = FALSE;
|
||||
if (isset($submit_type)) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$submit_type = stripslashes($submit_type);
|
||||
}
|
||||
// values have been urlencoded in tbl_change.php3
|
||||
if ($submit_type == $strSave || $submit_type == $strInsertAsNewRow) {
|
||||
$is_encoded = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the update of a row
|
||||
*/
|
||||
if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
||||
// Restore the "primary key" to a convenient format
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$primary_key = stripslashes($primary_key);
|
||||
} else {
|
||||
$primary_key = $primary_key;
|
||||
}
|
||||
if ($is_encoded) {
|
||||
$primary_key = urldecode($primary_key);
|
||||
}
|
||||
|
||||
// Defines the SET part of the sql query
|
||||
$valuelist = '';
|
||||
while (list($key, $val) = each($fields)) {
|
||||
if ($is_encoded) {
|
||||
$key = urldecode($key);
|
||||
$val = urldecode($val);
|
||||
}
|
||||
|
||||
switch (strtolower($val)) {
|
||||
case 'null':
|
||||
break;
|
||||
case '$set$':
|
||||
// if we have a set, then construct the value
|
||||
$f = "field_$key";
|
||||
if(get_magic_quotes_gpc()) {
|
||||
if (isset($$f)) $val = "'".($$f?implode(',',$$f):'')."'";
|
||||
else $val = "''";
|
||||
if ($is_encoded) {
|
||||
$f = 'field_' . md5($key);
|
||||
} else {
|
||||
if (isset($$f)) $val = "'".addslashes($$f?implode(',',$$f):'')."'";
|
||||
else $val = "''";
|
||||
$f = "field_$key";
|
||||
}
|
||||
if (isset($$f)) {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$val = "'" . (($$f) ? implode(',', $$f) : '') . "'";
|
||||
} else {
|
||||
$val = "'" . addslashes(($$f) ? implode(',', $$f) : '') . "'";
|
||||
}
|
||||
} else {
|
||||
$val = '';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -44,30 +87,52 @@ if(isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
||||
$val = "'" . addslashes($val) . "'";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // end switch
|
||||
|
||||
if (empty($funcs[$key])) {
|
||||
$valuelist .= "$key = $val, ";
|
||||
$valuelist .= backquote($key) . ' = ' . $val . ', ';
|
||||
} else {
|
||||
$valuelist .= "$key = $funcs[$key]($val), ";
|
||||
}
|
||||
$valuelist .= backquote($key) . " = $funcs[$key]($val), ";
|
||||
}
|
||||
} // end while
|
||||
|
||||
// Builds the sql upate query
|
||||
$valuelist = ereg_replace(', $', '', $valuelist);
|
||||
$query = "UPDATE $table SET $valuelist WHERE $primary_key";
|
||||
} else {
|
||||
$query = 'UPDATE ' . backquote($table) . " SET $valuelist WHERE $primary_key";
|
||||
} // end row update
|
||||
|
||||
|
||||
/**
|
||||
* Prepare the insert of a row
|
||||
*/
|
||||
else {
|
||||
$fieldlist = '';
|
||||
$valuelist = '';
|
||||
while (list($key, $val) = each($fields)) {
|
||||
$fieldlist .= "$key, ";
|
||||
if ($is_encoded) {
|
||||
$key = urldecode($key);
|
||||
$val = urldecode($val);
|
||||
}
|
||||
// the 'query' row is urlencoded in sql.php3
|
||||
else if ($key == 'query') {
|
||||
$val = urldecode($val);
|
||||
}
|
||||
$fieldlist .= backquote($key) . ', ';
|
||||
|
||||
switch (strtolower($val)) {
|
||||
case 'null':
|
||||
break;
|
||||
case '$set$':
|
||||
$f = "field_$key";
|
||||
if(get_magic_quotes_gpc()) {
|
||||
$val = "'".($$f?implode(',',$$f):'')."'";
|
||||
// if we have a set, then construct the value
|
||||
if ($is_encoded) {
|
||||
$f = 'field_' . md5($key);
|
||||
} else {
|
||||
$val = "'".addslashes($$f?implode(',',$$f):'')."'";
|
||||
$f = "field_$key";
|
||||
}
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$val = "'" . (($$f) ? implode(',', $$f) : '') . "'";
|
||||
} else {
|
||||
$val = "'" . addslashes(($$f) ? implode(',', $$f) : '') . "'";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -77,34 +142,42 @@ if(isset($primary_key) && ($submit_type != $strInsertAsNewRow)) {
|
||||
$val = "'" . addslashes($val) . "'";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // end switch
|
||||
|
||||
if (empty($funcs[$key])) {
|
||||
$valuelist .= "$val, ";
|
||||
$valuelist .= $val . ', ';
|
||||
} else {
|
||||
$valuelist .= "$funcs[$key]($val), ";
|
||||
}
|
||||
}
|
||||
} // end while
|
||||
|
||||
// Builds the sql insert query
|
||||
$fieldlist = ereg_replace(', $', '', $fieldlist);
|
||||
$valuelist = ereg_replace(', $', '', $valuelist);
|
||||
$query = "INSERT INTO $table ($fieldlist) VALUES ($valuelist)";
|
||||
}
|
||||
$query = 'INSERT INTO ' . backquote($table) . " ($fieldlist) VALUES ($valuelist)";
|
||||
} // end row insertion
|
||||
|
||||
|
||||
/**
|
||||
* Executes the sql query and get the result, then move back to the calling
|
||||
* page
|
||||
*/
|
||||
mysql_select_db($db);
|
||||
$sql_query = $query;
|
||||
$result = mysql_query($query);
|
||||
|
||||
if (!$result) {
|
||||
$error = mysql_error();
|
||||
include("./header.inc.php3");
|
||||
include('./header.inc.php3');
|
||||
mysql_die($error);
|
||||
} else {
|
||||
if(file_exists("./$goto")) {
|
||||
include("./header.inc.php3");
|
||||
if (file_exists('./' . $goto)) {
|
||||
include('./header.inc.php3');
|
||||
$message = $strModifications;
|
||||
include('./' . preg_replace('/\.\.*/', '.', $goto));
|
||||
} else {
|
||||
Header("Location: $goto");
|
||||
}
|
||||
exit;
|
||||
header('Location: ' . $goto);
|
||||
}
|
||||
exit();
|
||||
} // end if
|
||||
?>
|
||||
|
206
tbl_select.php3
206
tbl_select.php3
@@ -2,44 +2,65 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
require("./grab_globals.inc.php3");
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./lib.inc.php3');
|
||||
|
||||
|
||||
if(!isset($param) || $param[0] == "") {
|
||||
include("./header.inc.php3");
|
||||
/**
|
||||
* Not selection yet required -> displays the selection form
|
||||
*/
|
||||
if (!isset($param) || $param[0] == '') {
|
||||
include('./header.inc.php3');
|
||||
$result = mysql_list_fields($db, $table);
|
||||
if (!$result) {
|
||||
mysql_die();
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<form method="POST" ACTION="tbl_select.php3">
|
||||
<input type="hidden" name="server" value="<?php echo $server;?>">
|
||||
<input type="hidden" name="lang" value="<?php echo $lang;?>">
|
||||
<input type="hidden" name="db" value="<?php echo $db;?>">
|
||||
<input type="hidden" name="table" value="<?php echo $table;?>">
|
||||
<?php echo $strSelectFields; ?><br>
|
||||
<select multiple NAME="param[]" size="10">
|
||||
|
||||
<?php
|
||||
for ($i=0 ; $i<mysql_num_fields($result); $i++) {
|
||||
$field = mysql_field_name($result,$i);
|
||||
if($i >= 0)
|
||||
echo "<option value=$field selected>$field</option>\n";
|
||||
else
|
||||
echo "<option value=$field>$field</option>\n";
|
||||
// Gets the list and number of fields
|
||||
$fields_count = mysql_num_fields($result);
|
||||
for ($i = 0; $i < $fields_count; $i++) {
|
||||
$fields_list[] = mysql_field_name($result, $i);
|
||||
$fields_type[] = mysql_field_type($result, $i);
|
||||
$fields_len[] = mysql_field_len($result, $i);
|
||||
}
|
||||
?>
|
||||
|
||||
</select><br>
|
||||
<div align="left">
|
||||
<ul><li><?php if (isset($strDisplay)) echo $strDisplay; ?> <input type="text" size=4 name="sessionMaxRows" value=<?php echo $cfgMaxRows; ?>>
|
||||
<?php if (isset($strLimitNumRows)) echo $strLimitNumRows; ?>
|
||||
<li><?php echo $strAddSearchConditions; ?><br>
|
||||
<input type="text" name="where"> <?php print show_docu("manual_Reference.html#Functions");?><br>
|
||||
|
||||
<br>
|
||||
<li><?php echo $strDoAQuery; ?><br>
|
||||
<form method="post" action="tbl_select.php3">
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="db" value="<?php echo $db; ?>" />
|
||||
<input type="hidden" name="table" value="<?php echo $table; ?>" />
|
||||
|
||||
<?php echo $strSelectFields; ?> :<br />
|
||||
|
||||
<select name="param[]" size="10" multiple="multiple">
|
||||
<?php
|
||||
echo "\n";
|
||||
// Displays the list of the fields
|
||||
for ($i = 0 ; $i < $fields_count; $i++) {
|
||||
echo ' <option value="' . urlencode($fields_list[$i]) . '" selected="selected">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select><br />
|
||||
<ul>
|
||||
<li>
|
||||
<div style="margin-bottom: 10px">
|
||||
<?php echo $strDisplay; ?>
|
||||
<input type="text" size="4" name="sessionMaxRows" value="<?php echo $cfgMaxRows; ?>" />
|
||||
<?php echo $strLimitNumRows . "\n"; ?>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div style="margin-bottom: 10px">
|
||||
<?php echo $strAddSearchConditions; ?><br />
|
||||
<input type="text" name="where" />
|
||||
<?php print show_docu("manual_Reference.html#Functions") . "\n"; ?>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo $strDoAQuery; ?><br />
|
||||
<table border="<?php echo $cfgBorder; ?>">
|
||||
<tr>
|
||||
<th><?php echo $strField; ?></th>
|
||||
@@ -47,60 +68,77 @@ if(!isset($param) || $param[0] == "") {
|
||||
<th><?php echo $strValue; ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$result = mysql_list_fields($db, $table);
|
||||
for ($i=0;$i<mysql_num_fields($result);$i++) {
|
||||
$field = mysql_field_name($result,$i);;
|
||||
$type = mysql_field_type($result,$i);
|
||||
$len = mysql_field_len($result,$i);
|
||||
$bgcolor = $cfgBgcolorOne;
|
||||
($i % 2) ? 0: $bgcolor = $cfgBgcolorTwo;
|
||||
|
||||
echo "<tr bgcolor=".$bgcolor.">";
|
||||
echo "<td>$field</td>";
|
||||
echo "<td>$type</td>";
|
||||
|
||||
$fieldsize=($len>40? 40: $len);
|
||||
echo "<td><input type=text name=fields[]
|
||||
size=\"$fieldsize\" maxlength=".$len."></td>\n";
|
||||
echo "<input type=hidden name=names[] value=\"$field\">\n";
|
||||
echo "<input type=hidden name=types[] value=\"$type\">\n";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table><br>";
|
||||
echo "\n";
|
||||
for ($i = 0; $i < $fields_count; $i++) {
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
?>
|
||||
|
||||
<input name="SUBMIT" value="<?php echo $strGo; ?>" type="SUBMIT">
|
||||
</form></ul>
|
||||
|
||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||
<td><?php echo htmlspecialchars($fields_list[$i]); ?></td>
|
||||
<td><?php echo $fields_type[$i]; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$fieldsize = (($fields_len[$i] > 40)
|
||||
? 40 : $fields_len[$i]);
|
||||
?>
|
||||
<input type="text" name="fields[]"
|
||||
size="<?php echo $fieldsize; ?>"
|
||||
maxlength="<?php echo $fields_len[$i]; ?>" />
|
||||
<input type="hidden" name="names[]" value="<?php echo urlencode($fields_list[$i]); ?>" />
|
||||
<input type="hidden" name="types[]" value="<?php echo $fields_type[$i]; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end for
|
||||
echo "\n";
|
||||
?>
|
||||
</table><br />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<input type="submit" name="submit" value="<?php echo $strGo; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
} // end if
|
||||
echo "\n";
|
||||
include('./footer.inc.php3');
|
||||
}
|
||||
include("./footer.inc.php3");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selection criteria have been submitted -> do the work
|
||||
*/
|
||||
else {
|
||||
$sql_query="SELECT $param[0]";
|
||||
// Builds the query
|
||||
$sql_query = 'SELECT ' . backquote(urldecode($param[0]));
|
||||
$i = 0;
|
||||
$c = count($param);
|
||||
while ($i < $c) {
|
||||
if($i>0) $sql_query .= ",$param[$i]";
|
||||
if ($i > 0) {
|
||||
$sql_query .= ',' . backquote(urldecode($param[$i]));
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$sql_query .= " from $table";
|
||||
if ($where != "") {
|
||||
$sql_query .= ' where ' . ((get_magic_quotes_gpc()) ? stripslashes($where) : $where);
|
||||
$sql_query .= ' FROM ' . backquote($table);
|
||||
// The where clause
|
||||
if ($where != '') {
|
||||
$sql_query .= ' WHERE ' . ((get_magic_quotes_gpc()) ? stripslashes($where) : $where);
|
||||
}
|
||||
else {
|
||||
$sql_query .= " where 1";
|
||||
$sql_query .= ' WHERE 1';
|
||||
for ($i = 0; $i < count($fields); $i++) {
|
||||
if (!empty($fields) && $fields[$i] != "") {
|
||||
$quot="";
|
||||
if ($types[$i]=="string"||$types[$i]=="blob") {
|
||||
$quot="\"";
|
||||
$cmp="like";
|
||||
if (!get_magic_quotes_gpc()) $fields[$i] = str_replace('"', '\\"', $fields[$i]);
|
||||
if (!empty($fields) && $fields[$i] != '') {
|
||||
$quot = '';
|
||||
if ($types[$i] == 'string' || $types[$i] == 'blob') {
|
||||
$quot = '"';
|
||||
$cmp = 'LIKE';
|
||||
if (!get_magic_quotes_gpc()) {
|
||||
$fields[$i] = str_replace('"', '\\"', $fields[$i]);
|
||||
}
|
||||
else if ($types[$i]=="date"||$types[$i]=="time") {
|
||||
$quot="\"";
|
||||
$cmp="=";
|
||||
}
|
||||
else if ($types[$i] == 'date' || $types[$i] == 'time') {
|
||||
$quot = '"';
|
||||
$cmp = '=';
|
||||
}
|
||||
else {
|
||||
if (strstr($fields[$i], '%')) {
|
||||
@@ -110,17 +148,25 @@ else {
|
||||
$cmp = '=';
|
||||
$quot = '';
|
||||
}
|
||||
if (substr($fields[$i],0,1)=="<" || substr($fields[$i],0,1)==">") $cmp="";
|
||||
if (substr($fields[$i], 0, 1) == '<' || substr($fields[$i], 0, 1) == '>') {
|
||||
$cmp = '';
|
||||
}
|
||||
$sql_query .= " and $names[$i] $cmp $quot$fields[$i]$quot";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($sessionMaxRows)) {
|
||||
include("./config.inc.php3");
|
||||
$sessionMaxRows = $cfgMaxRows;
|
||||
}
|
||||
Header("Location:sql.php3?sql_query=".urlencode($sql_query)."&goto=db_details.php3&server=$server&lang=$lang&db=$db&table=$table&pos=0&sessionMaxRows=$sessionMaxRows");
|
||||
} // end if
|
||||
$sql_query .= ' AND ' . backquote(urldecode($names[$i]))
|
||||
. ' ' . "$cmp $quot$fields[$i]$quot";
|
||||
} // end if
|
||||
} // end for
|
||||
} // end if
|
||||
|
||||
$url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db)
|
||||
. '&table=' . urlencode($table)
|
||||
. '&sql_query=' . urlencode($sql_query)
|
||||
. '&pos=0'
|
||||
. '&sessionMaxRows=' . $sessionMaxRows
|
||||
. '&goto=db_details.php3';
|
||||
header('Location: sql.php3?' . $url_query);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -296,7 +296,7 @@ function grant_operations()
|
||||
<?php
|
||||
if (isset($dbgrant)) {
|
||||
if (!isset($tablegrant)) echo "<option selected></option>";
|
||||
$result = mysql_query("SHOW TABLES from ".db_name($dbgrant));
|
||||
$result = mysql_query("SHOW TABLES from ".backquote($dbgrant));
|
||||
if (@mysql_num_rows($result))
|
||||
while ($row = mysql_fetch_row($result)) {
|
||||
$selected = ($row[0] == $tablegrant)? "SELECTED" : "";
|
||||
@@ -316,8 +316,8 @@ function grant_operations()
|
||||
<?php
|
||||
|
||||
if (isset($dbgrant) && isset($tablegrant)) {
|
||||
$result = mysql_query("SHOW COLUMNS FROM ".db_name($dbgrant)."." .
|
||||
tbl_name($tablegrant));
|
||||
$result = mysql_query("SHOW COLUMNS FROM ".backquote($dbgrant)."." .
|
||||
backquote($tablegrant));
|
||||
if (@mysql_num_rows($result))
|
||||
while ($row = mysql_fetch_row($result))
|
||||
echo "<option>" . $row[0] . "</option>\n";
|
||||
@@ -337,7 +337,7 @@ function grant_operations()
|
||||
<?php
|
||||
}
|
||||
|
||||
function table_grants_header($dbcheck = false) {
|
||||
function table_grants_header($dbcheck = FALSE) {
|
||||
global $cfgBorder;
|
||||
|
||||
global $strAction;
|
||||
@@ -366,7 +366,7 @@ function table_grants_tail() {
|
||||
}
|
||||
|
||||
|
||||
function table_grants($host, $user, $dbcheck = false)
|
||||
function table_grants($host, $user, $dbcheck = FALSE)
|
||||
{
|
||||
global $cfgBgcolorOne, $cfgBgcolorTwo;
|
||||
global $server, $lang, $db, $table;
|
||||
@@ -398,7 +398,7 @@ function table_grants($host, $user, $dbcheck = false)
|
||||
$table = " ";
|
||||
$column = " ";
|
||||
$priv = "";
|
||||
$grantopt = false;
|
||||
$grantopt = FALSE;
|
||||
}
|
||||
|
||||
if ($priv == "USAGE") $priv = "";
|
||||
@@ -411,7 +411,7 @@ function table_grants($host, $user, $dbcheck = false)
|
||||
if ((trim($priv) == "") && !$grantopt) continue;
|
||||
|
||||
if (!$dbcheck && !isset($show_header)) {
|
||||
$show_header = true;
|
||||
$show_header = TRUE;
|
||||
table_grants_header();
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ function table_grants($host, $user, $dbcheck = false)
|
||||
# Revoke
|
||||
$query = "server=$server&lang=$lang&db=mysql&table=user";
|
||||
$revoke_url = "sql.php3";
|
||||
// $revoke_url .= "?sql_query=".urlencode("REVOKE $priv ON " . db_name($db) . "." . tbl_name($table) . " FROM '$user'@'$host'");
|
||||
// $revoke_url .= "?sql_query=".urlencode("REVOKE $priv ON " . backquote($db) . "." . backquote($table) . " FROM '$user'@'$host'");
|
||||
$revoke_url .= "?sql_query=".urlencode("REVOKE $priv ON " . $db . "." . $table . " FROM '$user'@'$host'");
|
||||
$revoke_url .= "&$query";
|
||||
$revoke_url .= "&zero_rows=" . urlencode("$strRevokeMessage <font color=#002E80>$user@$host</font>");
|
||||
@@ -430,7 +430,7 @@ function table_grants($host, $user, $dbcheck = false)
|
||||
# Revoke GRANT OPTION
|
||||
if ($grantopt) {
|
||||
$revoke_grant_url = "sql.php3";
|
||||
// $revoke_grant_url .= "?sql_query=" . urlencode("REVOKE GRANT OPTION ON " . db_name($db) . "." . tbl_name($table) . " FROM '$user'@'$host'");
|
||||
// $revoke_grant_url .= "?sql_query=" . urlencode("REVOKE GRANT OPTION ON " . backquote($db) . "." . backquote($table) . " FROM '$user'@'$host'");
|
||||
$revoke_grant_url .= "?sql_query=" . urlencode("REVOKE GRANT OPTION ON " . $db . "." . $table . " FROM '$user'@'$host'");
|
||||
$revoke_grant_url .= "&$query";
|
||||
$revoke_grant_url .= "&zero_rows=" . urlencode("$strRevokeGrantMessage <font color=#002E80>$user@$host</font>");
|
||||
@@ -486,7 +486,7 @@ function table_grants($host, $user, $dbcheck = false)
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function table_privileges($form, $row = false)
|
||||
function table_privileges($form, $row = FALSE)
|
||||
{
|
||||
global $strDelete;
|
||||
global $strCheckAll, $strUncheckAll;
|
||||
@@ -668,7 +668,7 @@ function check_rights()
|
||||
}
|
||||
|
||||
|
||||
function table_users($host = false, $user = false)
|
||||
function table_users($host = FALSE, $user = FALSE)
|
||||
{
|
||||
global $cfgBorder, $cfgBgcolorOne, $cfgBgcolorTwo;
|
||||
global $server, $lang, $db, $table;
|
||||
@@ -861,8 +861,8 @@ if (isset($edit) && $edit) { # Edit an user
|
||||
check_operations();
|
||||
|
||||
} else { # Users actions
|
||||
if (!isset($host)) $host = false;
|
||||
if (!isset($user)) $user = false;
|
||||
if (!isset($host)) $host = FALSE;
|
||||
if (!isset($user)) $user = FALSE;
|
||||
table_users($host, $user) || mysql_die($strNoUsersFound);
|
||||
normal_operations();
|
||||
}
|
||||
|
Reference in New Issue
Block a user