Jump to content

Isset not working


philjm82

Recommended Posts

Hi there,

 

I have just move hosts with our website and it loads the frontpage but non of the subsequent pages. The site works like this, depending on the variables in the address depends which page and which template are loaded into it. If the template is "ros" it loads rosettes template, if it is "tro" it loads trophy template, and then the name of the item, ie "hazel" will load up the hazel product page. All it is doing at the moment is loading the home.php page.

 

The code to do this is below:

 

<?

if (!isset($template)) {include ("static/home.php");} else if (isset($id)) {

if (!file_exists("site_templates/$template.php")) {
echo "OOPS! <P> The template you have requested does not exist!<BR><BR><BR><BR><BR><BR>";
}elseif (file_exists("site_templates/$template.php")) {
include ("site_templates/$template.php");
}
}
?>

 

It worked with our last host, but refuses to work now. Is there someone out there that can help.

 

Thanks in advance,

Phil

Link to comment
Share on other sites

You need to use $_GET['template'], $_GET['id'], ...

 

The code you posted is dependent on register_globals to magically set program variables from the external data in POST, GET, COOKIE,... variables. Unfortunately, register_globals also magically lets hackers set your session variables by simply putting a same name GET parameter on the end of the URL when they request one of your pages. A lot of web sites have been taken over.

 

Register_globals were turned off by default in php4.2 in the year 2002 and I am surprised that we are still seeing php code that has not yet been updated to run with register_globals turned off. Now is the time to update your code because register_globals are scheduled to be completely removed in an upcoming php version.

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.