Page 1 of 1

Weird error

Posted: Tue Mar 21, 2006 3:30 am
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?

Posted: Tue Mar 21, 2006 3:37 am
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';
}

Posted: Tue Mar 21, 2006 3:40 am
by rsmarsha
Sorted, thanks. :)