Forum Moderators: coopster

Message Too Old, No Replies

Suddenly Not Switching Content

All of a sudden the links to switch content are not working.

         

riotfire

7:33 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



When you click link, the main content of the page is supposed to switch and include content from another document. But it is not working. Below is my code.

<? 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&amp;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&amp;id=$r1[id]\">$r1[showdate] $r1[location]</a></li>\n";
}
echo "</ul>\n";
?>
</div></div>
</td>
</tr>
</table>

</body>
</html>

StupidScript

7:42 pm on Jun 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you recently turn
register_globals
off?

Try:

switch ($_GET['page']) {

riotfire

7:48 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



that worked! Thanks ten million. I do have to ask, why would that make it work when it didn't before. The register_globals have been shut off. I am doing this for a client that has his page hosted at GoDaddy and I have had nothing but problems with them.

StupidScript

11:25 pm on Jun 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it possible that GoDaddy re-installed or upgraded PHP for your shared server? They may have had
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.

riotfire

3:58 pm on Jun 28, 2005 (gmt 0)

10+ Year Member



Ya, i checked the phpinfo and it was turned off. I am unaware if they updated or changed anything. i just know that my script stopped working. Thanks for everything!