PHP code stopped working after server upgrade to PHP5

I have quite a few scripts being used across my site to call images dynamically. When my server upgraded the scripts all stopped working. Perhaps someone can point me to the problem so I can get this PHP5 compatible?

Here is the script:

[php]<?php

if ($visual_guide == “001-Dengar-The-Vintage-Collection-VC01”) {
print (’
');
include(“http://www.jeditemplearchives.com/vintagecollection/pages/tvc-01-Dengar.shtml”);
include(“http://www.jeditemplearchives.com/vintagecollection/related/tvc-wave1.shtml”);

} elseif ($visual_guide == “002-Leia-Hoth-Outfit-The-Vintage-Collection-VC02”) {
print (’
');
include(“http://www.jeditemplearchives.com/vintagecollection/pages/tvc-02-LeiaHoth.shtml”);
include(“http://www.jeditemplearchives.com/vintagecollection/related/tvc-wave1.shtml”);

} else {
print (’
});
});

       <div class="InfoBox">
        <div class="InfoDetails">
          <p>&nbsp;</p>

 

No Visual Guide Selected. Return to the Archives and try again!

Additional Resources

'); } ?> [/php]

Here is the page that loads:

http://www.jeditemplearchives.com/vintagecollection/evg/001-Dengar-The-Vintage-Collection-VC01.html

It seems to load the else statement fine, but nothing else.

echo out the var
put above the if ($visual_guide ==
[php]echo $visual_guide;[/php]

then report back with the results

I did this:

[php]echo $visual_guide;
if ($visual_guide == “001-Dengar-The-Vintage-Collection-VC01”) {
print (’
');
include(“http://www.jeditemplearchives.com/vintagecollection/pages/tvc-01-Dengar.shtml”);
include(“http://www.jeditemplearchives.com/vintagecollection/related/tvc-wave1.shtml”); [/php]

And got the same results. While playing around I removed one of the == from the line and while it didn’t fix it, it (and every other link) did show the first item in the list only.

Yes but we need to know what is in the $visual_guide var to start with before we can figure out the problem.
The problem is visual_guide does not equal 001-Dengar-The-Vintage-Collection-VC01.

The echo $visual_guide; should have printed to the screen what the var contains as text maybe at the top of the screen try again .

Or try this, look at the top of the screen for text.
[php]print_r($visual_guide);[/php]

I added it again but nothing appears at the top of the screen when I load the page. The variable isn’t defined in the code, it is usuall called in the URL like so:

http://www.jeditemplearchives.com/vintagecollection/evg/tvcVG.php?visual_guide=001-Dengar-The-Vintage-Collection-VC01

try putting above the if(

[php] $_GET[‘visual_guide’];[/php]

Added with no change. Should I have put both the Get and the Echo statement in? Either way it appears to have no affect. Still just loads the else option at the end.

No the problem is you have nothing as a the value for the ‘visual_guide’ variable.
I tried to get the variable with the _GET[‘var’] so it would have a value as you say its being sent with the url.
tvcVG.php?visual_guide=

So you will have to show me more code maybe problem is in the tvcVG.php as this sending the right information maybe its in a session and not in the url.

Can you can try
[php]print_r[$_SESSION];[/php]

Perhaps something needs to be added to the php5.ini file? Currently this is what is in it:

allow_url_fopen
url_fopen_include
allow_url_include = 1

adding the

[php]print_r[$_SESSION];[/php]

produced an error. In the first post I posted the entire PHP code that is being used.

All files are on your site so it nothing needs to be changed in the php.ini

Sorry should be brackets not square brackets.
[php]print_r($_SESSION);[/php]

Its not the entire php code thats being used as it has to get the $visual_guide var from another page which you pointed out to be tvcVG.php this has the problem I cannot help without knowing what the code does.

This php will tell you that it have no value else it will print out the var between the 2 times chars *
[php]
if(isset($visual_guide)){
echo ‘visual_guide =’.$visual_guide.’’;
} else {
echo ‘visual_guide has no value’;
}[/php]

That code I posted is from the tvcVG.php. I would be happy to send you the full file if you think that would help.

So how does it get the url ?
Can you show me the link that sends you there or the section of page code that sends you to the page you select.

The problem is the sending of the variable between the pages it is supposed to send the variable in the url
But it has to get to get in to the url somehow.

Sure, here is the page with the links (I use a rewrite code to create a friendly URL)

http://www.jeditemplearchives.com/vintagecollection/

So, essentially
http://www.jeditemplearchives.com/vintagecollection/evg/001-Dengar-The-Vintage-Collection-VC01.html
and
http://www.jeditemplearchives.com/vintagecollection/evg/tvcVG.php?visual_guide=001-Dengar-The-Vintage-Collection-VC01

are the same URL.

The trouble is it has nothing to get the code from to get the variable correct it need to either GET or POST or REQUEST the variable from the other page, there is no where this is happening.

You cannot pick up an apple and put it in your basket with out hands.
You have the variable sent to the url (tvcVG.php?visual_guide=), so you have the apple, but you cannot put it in the basket (newpage) without picking it up and putting it there with GET, POST or REQUEST (your hands) maybe this is a better understanding of it.

hmm, maybe I’m a bit confused. All this PHP worked fine before we upgraded to PHP5. These pages have been working for years. I thought maybe I just needed to fix the logic to get in line with PHP5.

I cannot understand how it worked before the variable needs to be pasted from one page to another wich it does in the url but then there is nothing to catch it at the other end usualy would be either
[php]
$variable = $_GET[‘variable’] // used for gettiong variables from urls
$variable = $_POST[‘variable’] // used for forms
$variable = $_REQUEST[‘variable’] // used for both
$variable = $_SESSION[‘variable’] // used with sessions[/php]

So you would need one of these in your php to be able to get the value you want in to the variable.
But because you use url rewite the value is taken away and made in to words for your seo.

Well, if definitely worked before. We’ve been using this script since 2004 and it just broke yesterday. That is why I’m so confused ???

You also have other code there you have a header and footer as this is basicaly a div InfoBox in your page by the looks of it.
So there maybe other php code in these pages.

Or even java script sending the info as I see on your page you use that.

Yes, there is other code in that file to help build the page, but it has all worked before. Here is another file that is a little more simpler that uses the same php script and here is an example of the URL that used to work from that page:

http://www.jeditemplearchives.com/news/images2009a/images.php?image=224

[php]

	<TITLE>Jedi Temple Archives Image Gallery</TITLE>

<style type="text/css">

 

[/php]

OK

put this code back at the top of the page
[php]
$visual_guide = $_GET[‘visual_guide’];
echo $visual_guide;
[/php]

Then goto this url does it work how it is supposed to ?

http://www.jeditemplearchives.com/vintagecollection/evg/tvcVG.php?visual_guide=001-Dengar-The-Vintage-Collection-VC01

Sponsor our Newsletter | Privacy Policy | Terms of Service