Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 blank page
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
agnivohneb




PostPosted: Sun May 20, 2007 2:37 pm   Post subject: blank page

Hello everyone

I am making a CMS for media files and this is what I have so far.
php:
<?php
define('IN_BH_MEDIA', true)// Define it as BH media
$root_path = './'// Set the root path
include($root_path . 'config.php')// Load the config.php file

$cmd = $_GET['cmd'];
if (empty($cmd)) {$cmd = 'index';}  // Cheack cmd

if ($cmd == 'index') {include($root_path . 'index2.php';}  // If index show the list
elseif ($cmd == 'player') {include($root_path . 'player.php';}  // If player show the player
else {header( 'Location:index.php' );}  // If cmd is not valid then load the page to set as index
?>

When I load the file I get a blank page when it should show me the list. The list file (index2.php) has data in it.
When I load index2.php directly is says "Hacking Attempt" and thats what I want it to say when you access it directly.

What have I done wrong?
Sponsor
Sponsor
Sponsor
sponsor
PaulButler




PostPosted: Mon May 21, 2007 12:41 pm   Post subject: RE:blank page

Well, for one thing, your location header should be formatted like this:

php:

header('Location: http://path.to/index.php');


Other than that, I don't see any obvious mistakes, so you might have some error that PHP is hiding. Use this code at the top of the page to turn error reporting on:

php:

error_reporting(E_ALL | E_STRICT);


And try again, and post any errors you get.
Amailer




PostPosted: Mon May 21, 2007 1:29 pm   Post subject: RE:blank page

php:


if ($cmd == 'index') {include($root_path . 'index2.php';}  // If index show the list
elseif ($cmd == 'player') {include($root_path . 'player.php';}  // If player show the player


the includes aren't closed (needs a ')' )

php:

if ($cmd == 'index') {include($root_path . 'index2.php');}  // If index show the list
elseif ($cmd == 'player') {include($root_path . 'player.php');}  // If player show the player
agnivohneb




PostPosted: Wed May 23, 2007 9:54 pm   Post subject: RE:blank page

Thanks a lot that worked I tried to set error reporting but its still blank not even errors I also looked at the scourc that Firefox displays and thats blank. I also tried the number form
"error_reporting(6143 | 2048);" but that didn't work ether, still blank. Sorry PaulButler it may be the way I setup my server. I don't know how to fix that. The php.ini file is fairly big. Amailer your way worked I must have over looked that. Thanks.
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: