Jump to content

Inproper data being echoed


unkwntech

Recommended Posts

I'm not sure what I am doing wrong with this one.

I have index.php:

<?php error_reporting(E_ALL); ini_set('display_errors', true); ?>
<?php require 'database.config.php'; require 'uriParser.php'; $loadStartTime = microtime(); ?>
//HTML here
<tr>
  <td background="http://beta.phpsnipz.com/images/bodyTop.png"><font color="#FFFFFF"><?php echo $page['title']; ?></font></td>
</tr>
<tr>
  <td background="http://beta.phpsnipz.com/images/bodyCenter.png"><font color="#FFFFFF"><?php echo $page['content']; ?></font></p></td>
</tr>

uriParsers requires main.inc.php which defines 2 variables $page['title'] = 'Test Title' and $page['content'] = 'This is my test content'

When the page is viewed all that is outputted is 'W' for both title and content

Link to comment
Share on other sites

uriParser.php:

<?php
//$parts = '/test.php/users/view/0/unkwntech/';
$parts = $_SERVER['REQUEST_URI'];
$parts = preg_replace('%\/index\.php%', '', $parts);
$parts = preg_replace('%\/test\.php%', '', $parts);
$parts = preg_split('%/%', $parts);
foreach($parts as $part)
{
if(!(is_null($part) || strlen($part) < 1))
 {
	$uriParts[] = $part;
 }
}
//echo "parts['0'] - " . print_r($uriParts);
switch($uriParts['0'])
{
	case 'users':
		require 'users.inc.php';
		users($uriParts['1'], $uriParts['2']);
		break;
	case 'snipz':
		require 'snipz.inc.php';
		snipz($uriParts['1'], $uriParts['2']);
		break;
	case 'admin';
		require 'admin.inc.php';
		admin($uriParts['1'], $uriParts['2'], $uriParts['3']);
		break;
	default:
		require 'main.inc.php';
		break;
}
?>

main.inc.php:

<?php
$page['title'] = "Welcome to PHP Snipz -";
$page['content'] = "We are still building the site.";
?>

main.inc.php is being included, no errors are being presented, and the variables are only being set staticly set for testing.

Link to comment
Share on other sites

Yes but I viewed the source.  And now I am seeing some more interesting errors.

On line 2 of index.php I have $loadStartTime = microtime(); then on line 110 I have echo $loadEndTime - $loadStartTime;

and I am getting Notice: index.php line 110 - Undefined variable: loadStartTime

The uriParser.php does still contain print_r($page);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.