Forum Moderators: coopster
<? include_once("inc/auth.inc.php"); $user = _check_auth($_COOKIE);?>
<html>
<head>
<title>Super Secret Area</title>
<link href="style.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<table id="main">
<tr>
<td>
<div id="header">Super Secret Area</div>
</td>
</tr>
</table>
<table id="main">
<tr>
<td id="left" align="left" valign="top">
<div class="title">+ Admin Menu</div>
<ul id="nav">
<li><a href="/index.php">Home</a></li>
<li><a href="index.php">Main</a></li>
<li><a href="?page=postnews">Post News</a></li>
<li><a href="?page=postshows">Post Shows</a></li>
<li><a href="?page=helpinfo">Help/Info</a></li>
<li><a href="logout.php">Logout</a></li>
<ul>
</td>
<td id="center" valign="top">
<?php
switch ($page) {
//Options
case "options":
include('options.php');
break;
//Post News
case "postnews":
include('postnews.php');
break;
//Post News
case "postshows":
include('postshows.php');
break;
//Modify News
case "modifynews":
include('modifynews.php');
break;
//Modify News
case "modifyshows":
include('modifyshows.php');
break;
//New Process
case "newsprocess":
include('newsprocess.php');
break;
//Show Process
case "showprocess":
include('showprocess.php');
break;
//Help/Info
case "helpinfo":
include('helpinfo.php');
break;
//Default (Current News)
default:
echo "hello";
}
?>
</td>
<td id="right" valign="top">
<div class="title">+ News Archieve</div>
<div id="news">
<?php
include("config.php");
$db = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname) or die("Cannot connect to database");
$query = "SELECT * FROM qlitenews ORDER BY id";
$result = mysql_query($query);
echo "<ul>\n";
while ($r = mysql_fetch_array($result)) {
echo "<li><a href=\"index.php?page=modifynews&id=$r[id]\">$r[title]</a></li>\n";
}
echo "</ul>\n";
?>
</div></div>
<div class="title">+ Shows</div>
<div id="news">
<?php
$query1 = "SELECT * FROM shows ORDER BY showdate";
$result1 = mysql_query($query1);
echo "<ul>\n";
while ($r1 = mysql_fetch_array($result1)) {
echo "<li><a href=\"index.php?page=modifyshows&id=$r1[id]\">$r1[showdate] $r1[location]</a></li>\n";
}
echo "</ul>\n";
?>
</div></div>
</td>
</tr>
</table>
</body>
</html>
register_globals enabled ... then disabled (as it should be), leading to the breaking script. If you don't have access to the php.ini file, you can write a little <?php echo phpinfo()?> file to see what the settings are.
Without
register_globals being turned on either in the php.ini file or for your own directory using an .htaccess file or another explicit instruction, the original script probably would not have functioned as posted, as it relied on register_globals being turned on ($page instead of $_GET['page']). What
$_GET['page'] does is access the $_GET environment variable array, where $page refers to a stand-alone variable that may or may not have been initialized. register_globals can recognize $page from its inclusion in the $_GET environment, but without register_globals being turned on, there's no way for PHP to know what the variable reference refers to unless it has been defined on the page preceding its use.