Copy link to clipboard
Copied
Hi there,
I have the following file call football.php. When you view it, it pulls the football text and football navigation stuff from the dec folder and displays it on the page.
<?php
if(isset($_REQUEST['suppliers']))
{
$companies=array(
"addidas",
"nike",
"head",
"converse",
"puma",
"reebok",
);
if(in_array($_REQUEST['suppliers'],$companies))
{
include "dec/suppliers/".$_REQUEST['suppliers'].".php";
}
}
?>
<?php include "dec/football-text.php";?>
<?php include "dec/football-navigation.php";?>
An example of the football navigation.php from above looks like this:
<td><a href="<?php echo $URLPREFIX;?>/feature-football.html?&suppliers=nike"><img src="images/football2010/images/Nike.jpg" alt="Nike"></td>
<td><a href="<?php echo $URLPREFIX;?>/feature-football.html?&suppliers=reebok"><img src="images/football2010/images/Reebok.jpg" alt="Reebok"></td>
<td><a href="<?php echo $URLPREFIX;?>/feature-football.html?&suppliers=puma"><img src="images/football2010/images/Puma.jpg" alt="Puma"></td>
Copy link to clipboard
Copied
Your description doesn't make sense, because the links in the navigation points the browser to feature-football.html, not football.php.
Copy link to clipboard
Copied
Hi David,
Sorry, I should point out that feature-football.php does exist.
This file is a module called "football" that sits in a specific folder called "feature". For example:
If ($_REQUEST['module']=="football")
{
$fullbody.=file_get_contents($THEMEFOLDER."/football.php");
}
The html extension is done to improve the url structure for SEO purposes.
I have found a solution to this problem. Hopefully I have also addressed the security issues with the includes?
<?php
if(isset($_REQUEST['suppliers']))
{
$companies = array(
"addidas",
"nike",
"head",
"converse",
"puma",
"reebok");
if(in_array($_REQUEST['suppliers'], $companies))
{
include "dec/suppliers/".$_REQUEST['suppliers'].".php";
if(!in_array($_REQUEST['suppliers'],$companies))
{
echo "Sorry your request could not be found in the list of suppliers";
}
else
{
include "dec/football-navigation.php";
}
}
else
{
include "dec/football-text.php";
include "dec/football-navigation.php";
}
}
?>
Copy link to clipboard
Copied
volterony22 wrote:
The html extension is done to improve the url structure for SEO purposes.
That's a myth. There's nothing magical about using an .html extension.
Hopefully I have also addressed the security issues with the includes?
Looks OK to me, although using $_REQUEST is considered to be less secure than using $_GET or $_POST explicitly.