Custom portal.... a few problems encountered :S

Started by Ploy1886, February 01, 2005, 07:14:08 PM

Previous topic - Next topic

Ploy1886

Heya.... I'm working on a custom portal system at the moment, however I've encountered a problem.

This so far is the main bit of the portal:


<?
error_reporting(E_ALL);
ob_start();

//$ssi_theme = 1;
$ssi_layers = array('site');

// If you want SSI.php to start gzipping for you ;)
$ssi_gzip = true;

// Site title
$sitetitle = 'NeutronChat';

// $_REQUEST[] variables
//$action = $_GET['action'];

require($_SERVER['DOCUMENT_ROOT'].'/atomize/forums/SSI.php');

echo '
<div id="headerarea"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td id="bodyarea" style="padding: 1ex 20px 1ex 20px;">';

if($_REQUEST['action']) {
$action = $_REQUEST['action'];

if(file_exists($_SERVER['DOCUMENT_ROOT'].'/atomize/backend/'. $action .'.php')) {
include($_SERVER['DOCUMENT_ROOT'].'/atomize/backend/'. $action .'.php');
} else {
Error(404);
}
} else {
$action = "news";
include($_SERVER['DOCUMENT_ROOT'].'/atomize/backend/'. $action .'.php');
}

echo '
    </td>
  </tr>
</table>

<div id="footerarea" align="center" padding="2px 2px;">
  <span style="font-size: 8pt;">
    <b>Copyright &copy; 2004-2005 NeutronChat.  All Rights Reserved.</b><br />
    <b>Powered By NeutronCMS v0.2b</b>
  </span>
</div>';

// Start the main functions
function Error($num)
{
$q = DBQuery('SELECT * FROM site_errors WHERE errorID="$num"');

if(DBNumRows($q) == 1) {
$r = DBResults($q);

} else {
echo '
        <b>1000: Error Not Found</b><br /><br />

        The Error System was unable to locate and display a necessary error output.';

}
}

function DBQuery($sql)
{
$dbq = mysql_query($sql);

return $dbq;
}

function DBNumRows($q)
{
$dbnr = mysql_num_rows($q);

return $dbnr;
}

function DBResults($q)
{
$dbr = mysql_fetch_array($q);

return $dbr;
}

ssi_shutdown();
ob_flush();
?>


Its a pretty crappy little script, but its a start.... the template uses the forum template (with layers... I commented out $ssi_theme so that it works with all the themes I install).

The problem is whenever I run it, the template loads fine, but I get the folllowing error:

Notice: Undefined index: action in /usr/local/www/data-dist/atomize/index.php on line 25

How do I sort this problem out?

Thanks :D

Ploy1886

Never mind... I sorted it.


I changed this:
if($_REQUEST['action']) {

to:
[codeif(isset($_REQUEST['action'])) {

That sorted the problem!  I can't believe I didn't put that in in the first place :S

[Unknown]

Yeah, unlike most scripts SMF runs with error_reporting set to full.  This is done to detect as many possible problems as possible.

-[Unknown]

OvermindDL1

And I love the fact it runs it at full, never change it.

Advertisement: