Jump to content

Recommended Posts

This all works just fine one host but it doesn't work at all on another. No errors or anything, it just doesn't do it's function. It sits on the defined home page as though nothing else has been set, even when it has. (and before you ask, yes, I am updating the paths for the new server lol...)

 

if(!isset($p) && !isset($myblog) && !isset($portfolio) && !isset($music) && !isset($mynews)) {

$table = $homecon;

$content = file_get_contents("$pathcont/home.html");

}

elseif(isset($p)) {

$table = $elsecon;

$content = file_get_contents("$pathcont/$p.html");

}

elseif(isset($myblog)) {

$imghead = "bhead.png";

$head = file_get_contents("$pathblog/head.html");

$table = $portcon;

$content = file_get_contents("$pathblog/$myblog.html");

}

elseif(isset($portfolio)) {

$imghead = "phead.png";

$head = file_get_contents("$pathport/head.html");

$table = $portcon;

$content = file_get_contents("$pathport/$portfolio.html");

}

elseif(isset($music)) {

require("$pathmusic/music.php");

$imghead = "mhead.png";

$head = $display;

$table = $portcon;

$content = file_get_contents("$pathmusic/$music.html");

}

elseif(isset($mynews)) {

$imghead = "nhead.png";

$head = file_get_contents("$pathnews/head.html");

$table = $portcon;

$content = file_get_contents("$pathnews/$mynews.html");

}

Anything wrong with it? One more thing...

I'm variable swapping in my URLs to keep the addresses short and trim (would rather look at: ?blog=007 than ?p=blogs&blog=007 or ?p=blogs/007 for example) and also to pull separate template codes ($table / $imghead) for sub-navigation swapping but naturally this leads to big heap of code. Is there any way to trim the above to something shorter while still retaining all functions?

Juding by what your urls are. Your code relies on an outdatted setting called register_globals (which has been disabled since 2002 and is soon to be removed completely as of php6).

 

You should update your code so it doesn't rely on this setting. Doing this allows your code to be more portable and improve security.

 

To help suggest what to do you should post your code inful.

My entire get_contents.php file:

<?php

include("cont.php");
require("titles.php");

$fp = "/path/to/site/lol";

$pathcont = "$fp/contents";
$pathblog = "$fp/blogs";
$pathport = "$fp/portfolio";
$pathmusic = "$fp/music";
$pathnews = "$fp/news";

if(!isset($p) && !isset($myblog) && !isset($portfolio) && !isset($music) && !isset($mynews)) {
$table = $homecon;
$content = file_get_contents("$pathcont/home.html");
}
elseif(isset($p)) {
$table = $elsecon;
$content = file_get_contents("$pathcont/$p.html");
}
elseif(isset($myblog)) {
$imghead = "bhead.png";
$head = file_get_contents("$pathblog/head.html");
$table = $portcon;
$content = file_get_contents("$pathblog/$myblog.html");
}
elseif(isset($portfolio)) {
$imghead = "phead.png";
$head = file_get_contents("$pathport/head.html");
$table = $portcon;
$content = file_get_contents("$pathport/$portfolio.html");
}
elseif(isset($music)) {
require("$pathmusic/music.php");
$imghead = "mhead.png";
$head = $display;
$table = $portcon;
$content = file_get_contents("$pathmusic/$music.html");
}
elseif(isset($mynews)) {
$imghead = "nhead.png";
$head = file_get_contents("$pathnews/head.html");
$table = $portcon;
$content = file_get_contents("$pathnews/$mynews.html");
}

?>

cont.php is where I store the templates I call through $table and titles.php is just page titles.

Umm by looks of it

 

$p should be $_GET['p'];

$myblog should be $_GET['myblog'];

$portfolio should be $_GET['portfolio'];

$musicshould be $_GET['music'];

$mynews should be $_GET['mynews'];

Could you pull one of my statements and swap them out so I know which ones to switch exactly?

 

Just by reading that I'm thinking you mean like this:

elseif(isset($myblog)) {
   $imghead = "bhead.png";
   $head = file_get_contents("$pathblog/head.html");
   $table = $portcon;
   $content = file_get_contents("$pathblog/$_GET['myblog'].html");
}

But I want to make sure.

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.