Weird error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

Weird error

Post by rsmarsha »

My host recently moved my sites to a new server and since then i've noticed a problem with one site and the links.

The site is just a portal site, havn't changed it in ages. http://irealms.co.uk

The links are in the format : index.php?page=pagename

and are included into the index in a content file like :

if ($page=='') include 'home.php';
if ($page=='home') include 'home.php';
if ($page=='about') include 'about.php';
if ($page=='scripts') include 'scripts.php';

All worked fine until i spotted the error now. No idea whats causing it.

Any ideas? Could it be something to do with the new server setup?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

1st this is a php question so don't worry, you can ask this in the php forum ;) . I would bet $100 that your old server had register_globals on since you are using ?page=home and whatnot. do this

Code: Select all

$page = $_GET['page'];//notice the superglobal $_GET. you should use this when getting a variable from a URL

switch ($page)
{
    case 'scripts':
        include 'scripts.php';
        break;
    case 'about':
        include 'about.php';
        break;
    default:
        include 'home.php';
}
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

Post by rsmarsha »

Sorted, thanks. :)
Post Reply