I have a html site and to display the content I use a php include. That means,
if you klick on the links the content will appear in the area that is set up
with the include (see below).
Well, after changing my webspace provider this system does not work anymore.
Does anyone know a method how to display the content anyway without changing the
other files (file.php)? You know, I have too many files to rewrite them and make
them compatible with the system. So the files must stay and the links must
remain like this:
Code:
index.php?site=file
Code:
(...)
if (!isset($site)) { $site="start"; }
if (file_exists($site.".php")) { include($site.".php"); }
else { echo " <b><center></center></b> "; }
?>
I suggest you look to a more tech savvy forum then
MT for help on PHP. I can't really help you since I know next to nothing
about PHP, but Neowin members will be easily able to help you. ^^
ok, first the code you provide is not secure at all. dont ever include a file by
passing the variable from url.
you can try using switch instead
[code]
<?php
$site = $_GET["site"];
switch($site)
{
case 'about':
include "about.php";
break;
I don't think I understand. Is it because your new host doesn't have PHP? If
that's the case use SSI maybe... Or ASP if you are using Windows (server)...
I have a html site and to display the content I use a php include. That means, if you klick on the links the content will appear in the area that is set up with the include (see below).
Well, after changing my webspace provider this system does not work anymore. Does anyone know a method how to display the content anyway without changing the other files (file.php)? You know, I have too many files to rewrite them and make them compatible with the system. So the files must stay and the links must remain like this:
Would be great if someone could help.
Instead of using if/else statements, use a switch statement. Heres a link to a tutorial writting on the subject: http://xangelo.com/tutorials.php?tid=7
Thank you for your support but I tried it out and got the following thing:
parse error, unexpected T_STRING
Unfortunately it doesn't seem to work. I adjusted home.php in the code to start.php like I needed it and id to site.
I suggest you look to a more tech savvy forum then MT for help on PHP. I can't really help you since I know next to nothing about PHP, but Neowin members will be easily able to help you. ^^
ok, first the code you provide is not secure at all. dont ever include a file by passing the variable from url.
you can try using switch instead
[code]
<?php
$site = $_GET["site"];
switch($site)
{
case 'about':
include "about.php";
break;
case 'works':
include "works.php";
break;
default:
include "index.php";
break;
}
?>
[/php]
let me know if you need any help
I don't think I understand. Is it because your new host doesn't have PHP? If that's the case use SSI maybe... Or ASP if you are using Windows (server)...
if his new host doesnt support php, then he wouldnt even get this error in the first place
parse error, unexpected T_STRING
Oh yeah, XP.