[Solved]: Problem identifying calling URL in PHP script [Solved]: Problem identifying calling URL in PHP script
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Solved]: Problem identifying calling URL in PHP script

Started by steveeh131047, March 19, 2008, 01:04:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

steveeh131047

With some assistance from Nibbler I now have cpg nicely integrated into my web site. Just one feature doesn't work.

I use a PHP script to dynamically generate my Navigation Bar which is called as part of {CUSTOM_HEADER} - it mostly works fine. However there are a couple of places in the script where I check the calling URL so that I can highlight the current page in the Navigation Bar, and I can generate a "breadcrumb" string. Neither of these elements work.

I'm using:  $url=$_SERVER['PHP_SELF']; to pick up the URL, but if I echo $url at this point in the script it is null.

I could just hard-code the Navigation Bar for the gallery page, but it would be nice to use the script if possible. Any ideas what might be wrong?

Steve

Nibbler

We overwrite $_SERVER['PHP_SELF'] in init.inc.php, although it shouldn't be null. You can use $ORIGINAL_PHP_SELF instead which contains the original value.

steveeh131047

Nibbler,

$ORIGINAL_PHP_SELF also seems to be null.

If I simply insert echo $ORIGINAL_PHP_SELF early in my script would I expect to see something? I'm no expert on PHP but could it be something to do with declaring variables as Global?

Thanks for your help.
Steve

Nibbler

Yeah, if you use it inside a function you need to global it.

steveeh131047

Nibbler,

Perfect! A global declaration fixed it. Guess I need to take some more PHP lessons :)

Thanks for your help.

Steve