[Phpmyadmin-devel] header.inc.php3 safty net
jeremy brand
jeremy at nirvani.net
Thu Jul 26 16:20:26 CEST 2001
Howdy all.
I have defined "__HEADER_INC__" in header.inc.php3 and also made the
requires that require header.inc.php3 conditional.
Also, a slight programmer note:
Anyone adding code to this project should, when requiring header.inc.php3,
only do it if !defined('__HEADER_INC___').
Jeremy
--
Jeremy Brand :: Sr. Software Engineer :: +393485323988 :: jeremy at nirvani.net
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"LINUX is obsolete" -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Get your own Free, Private email at http://www.smackdown.com/
-------------- next part --------------
Index: header.inc.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/header.inc.php3,v
retrieving revision 1.10
diff -u -U6 -r1.10 header.inc.php3
--- header.inc.php3 2001/07/23 17:02:42 1.10
+++ header.inc.php3 2001/07/26 14:15:03
@@ -1,11 +1,14 @@
<?php
/* $Id: header.inc.php3,v 1.10 2001/07/23 17:02:42 lem9 Exp $ */
+define('__HEADER_INC__');
+
require('./lib.inc.php3');
-require('./ob_lib.inc.php3');
+if (!defined('__OB_LIB_INC__'))
+ require('./ob_lib.inc.php3');
if ($cfgOBGzip)
{
$ob_mode = out_buffer_mode_get();
if ($ob_mode)
out_buffer_pre($ob_mode);
Index: ldi_table.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/ldi_table.php3,v
retrieving revision 1.3
diff -u -U6 -r1.3 ldi_table.php3
--- ldi_table.php3 2001/07/06 22:33:45 1.3
+++ ldi_table.php3 2001/07/26 14:15:03
@@ -3,14 +3,15 @@
// This file inserts a textfile into a table
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
$tables = mysql_list_tables($db);
$num_tables = @mysql_numrows($tables);
?>
<form action="ldi_check.php3" method="post" enctype="multipart/form-data">
Index: main.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/main.php3,v
retrieving revision 1.17
diff -u -U6 -r1.17 main.php3
--- main.php3 2001/07/24 17:25:52 1.17
+++ main.php3 2001/07/26 14:15:04
@@ -5,13 +5,14 @@
/**
* 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 (!defined('__HEADER_INC__'))
+ require('./header.inc.php3');
if (isset($message)) {
include('./lib.inc.php3');
show_message($message);
}
Index: sql.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/sql.php3,v
retrieving revision 1.26
diff -u -U6 -r1.26 sql.php3
--- sql.php3 2001/07/23 14:33:49 1.26
+++ sql.php3 2001/07/26 14:15:04
@@ -39,13 +39,14 @@
// 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");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
echo $strDoYouReally.$stripped_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;?>">
@@ -99,13 +100,14 @@
}
} // end rows total count
if(!$result)
{
$error = mysql_error();
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
mysql_die($error);
}
$num_rows = @mysql_num_rows($result);
if($num_rows < 1)
@@ -116,13 +118,14 @@
$message = $zero_rows;
else
$message = $strEmptyResultSet;
$goto = preg_replace('/\.\.*/', '.', $goto);
if ($goto != "main.php3")
{
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
}
include('./' . $goto);
}
else
{
$message = $zero_rows;
@@ -133,13 +136,14 @@
else
{
// Displays the headers
if (isset($show_query)) {
unset($show_query);
}
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
// Define 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])) {
$display = 'simple';
} else if (!empty($which[4]) && !empty($which[5])) {
Index: tbl_addfield.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_addfield.php3,v
retrieving revision 1.6
diff -u -U6 -r1.6 tbl_addfield.php3
--- tbl_addfield.php3 2001/07/17 09:58:43 1.6
+++ tbl_addfield.php3 2001/07/26 14:15:04
@@ -1,13 +1,14 @@
<?php
/* $Id: tbl_addfield.php3,v 1.6 2001/07/17 09:58:43 staybyte Exp $ */
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
if(isset($submit))
{
$query = "";
for($i=0; $i<count($field_name); ++$i)
{
Index: tbl_alter.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_alter.php3,v
retrieving revision 1.5
diff -u -U6 -r1.5 tbl_alter.php3
--- tbl_alter.php3 2001/06/27 20:11:45 1.5
+++ tbl_alter.php3 2001/07/26 14:15:04
@@ -1,13 +1,14 @@
<?php
/* $Id: tbl_alter.php3,v 1.5 2001/06/27 20:11:45 lem9 Exp $ */
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
if(isset($submit))
{
if(!isset($query))
$query = "";
$query .= " $field_orig[0] $field_name[0] $field_type[0] ";
Index: tbl_change.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_change.php3,v
retrieving revision 1.18
diff -u -U6 -r1.18 tbl_change.php3
--- tbl_change.php3 2001/07/19 18:54:19 1.18
+++ tbl_change.php3 2001/07/26 14:15:04
@@ -1,13 +1,14 @@
<?php
/* $Id: tbl_change.php3,v 1.18 2001/07/19 18:54:19 lem9 Exp $ */
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
mysql_select_db($db);
$table_def = mysql_query("SHOW FIELDS FROM $table");
if(isset($primary_key)) {
if(get_magic_quotes_gpc()) {
Index: tbl_copy.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_copy.php3,v
retrieving revision 1.8
diff -u -U6 -r1.8 tbl_copy.php3
--- tbl_copy.php3 2001/07/24 11:49:09 1.8
+++ tbl_copy.php3 2001/07/26 14:15:04
@@ -1,13 +1,14 @@
<?php
/* $Id: tbl_copy.php3,v 1.8 2001/07/24 11:49:09 staybyte Exp $ */
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
mysql_select_db($db);
function my_handler($sql_insert)
{
global $table, $db, $new_name;
Index: tbl_create.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_create.php3,v
retrieving revision 1.5
diff -u -U6 -r1.5 tbl_create.php3
--- tbl_create.php3 2001/06/16 00:28:39 1.5
+++ tbl_create.php3 2001/07/26 14:15:04
@@ -1,13 +1,14 @@
<?php
/* $Id: tbl_create.php3,v 1.5 2001/06/16 00:28:39 lem9 Exp $ */
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
mysql_select_db($db);
if(isset($submit))
{
if(!isset($query))
$query = "";
Index: tbl_dump.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_dump.php3,v
retrieving revision 1.20
diff -u -U6 -r1.20 tbl_dump.php3
--- tbl_dump.php3 2001/07/20 20:14:26 1.20
+++ tbl_dump.php3 2001/07/26 14:15:04
@@ -9,14 +9,15 @@
if (empty($asfile)
&& (!empty($gzip) || !empty($bzip))) {
$asfile = 1;
}
if(empty($asfile))
-{
- include("./header.inc.php3");
+{
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
print "<div align=left><pre>\n";
}
else
{
if (!isset($table)) $filename=$db;
else $filename=$table;
Index: tbl_printview.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_printview.php3,v
retrieving revision 1.7
diff -u -U6 -r1.7 tbl_printview.php3
--- tbl_printview.php3 2001/07/11 19:21:30 1.7
+++ tbl_printview.php3 2001/07/26 14:15:04
@@ -4,13 +4,14 @@
require("./grab_globals.inc.php3");
if(!isset($message))
{
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
}
else
{
show_message($message);
}
Index: tbl_properties.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_properties.php3,v
retrieving revision 1.44
diff -u -U6 -r1.44 tbl_properties.php3
--- tbl_properties.php3 2001/07/23 14:33:06 1.44
+++ tbl_properties.php3 2001/07/26 14:15:04
@@ -3,13 +3,14 @@
/**
* Gets the variables sent to this script and diplays headers
*/
require('./grab_globals.inc.php3');
if (!isset($message)) {
- include('./header.inc.php3');
+ if (!defined('__HEADER_INC__'))
+ include('./header.inc.php3');
} else {
show_message($message);
}
unset($sql_query);
Index: tbl_qbe.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_qbe.php3,v
retrieving revision 1.3
diff -u -U6 -r1.3 tbl_qbe.php3
--- tbl_qbe.php3 2001/07/24 05:01:26 1.3
+++ tbl_qbe.php3 2001/07/26 14:15:04
@@ -1,14 +1,14 @@
<?php
/* $Id: tbl_qbe.php3,v 1.3 2001/07/24 05:01:26 glund Exp $ */
require("./grab_globals.inc.php3");
-
-require("./header.inc.php3");
+if (!defined('__HEADER_INC__'))
+ require("./header.inc.php3");
if(empty($Columns))
$Columns = 3; # initial number of columns
if(!isset($Add_Col))
$Add_Col = "";
Index: tbl_rename.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_rename.php3,v
retrieving revision 1.4
diff -u -U6 -r1.4 tbl_rename.php3
--- tbl_rename.php3 2001/07/17 09:59:10 1.4
+++ tbl_rename.php3 2001/07/26 14:15:04
@@ -7,21 +7,23 @@
if (isset($new_name)) $new_name=trim($new_name); // Cleanup to suppress '' tables
if (isset($new_name) && $new_name!=""){
$old_name = $table;
$table = $new_name;
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ 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;
}
else{
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
mysql_die($strTableEmpty);
}
require("./tbl_properties.php3");
?>
Index: tbl_replace.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_replace.php3,v
retrieving revision 1.7
diff -u -U6 -r1.7 tbl_replace.php3
--- tbl_replace.php3 2001/07/20 10:32:21 1.7
+++ tbl_replace.php3 2001/07/26 14:15:04
@@ -92,17 +92,19 @@
mysql_select_db($db);
$sql_query = $query;
$result = mysql_query($query);
if(!$result) {
$error = mysql_error();
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
mysql_die($error);
} else {
if(file_exists("./$goto")) {
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
$message = $strModifications;
include('./' . preg_replace('/\.\.*/', '.', $goto));
} else {
Header("Location: $goto");
}
exit;
Index: tbl_select.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/tbl_select.php3,v
retrieving revision 1.6
diff -u -U6 -r1.6 tbl_select.php3
--- tbl_select.php3 2001/07/19 18:54:19 1.6
+++ tbl_select.php3 2001/07/26 14:15:04
@@ -3,13 +3,14 @@
require("./grab_globals.inc.php3");
if(!isset($param) || $param[0] == "") {
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
$result = mysql_list_fields($db, $table);
if (!$result) {
mysql_die();
}
else {
?>
Index: user_details.php3
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/user_details.php3,v
retrieving revision 1.16
diff -u -U6 -r1.16 user_details.php3
--- user_details.php3 2001/07/17 13:45:23 1.16
+++ user_details.php3 2001/07/26 14:15:04
@@ -796,13 +796,14 @@
}
# Main Program
if(!isset($message))
{
- include("./header.inc.php3");
+ if (!defined('__HEADER_INC__'))
+ include("./header.inc.php3");
}
else
{
show_message($message);
}
More information about the Developers
mailing list