Advanced search  

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]

Pages: [1]   Go Down

Author Topic: [Solved]: Problem identifying calling URL in PHP script  (Read 7161 times)

0 Members and 1 Guest are viewing this topic.

steveeh131047

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Posts: 217
[Solved]: Problem identifying calling URL in PHP script
« on: March 19, 2008, 01:04:51 pm »

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
« Last Edit: March 19, 2008, 03:08:59 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: Problem identifying calling URL in PHP script
« Reply #1 on: March 19, 2008, 01:24:43 pm »

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.
Logged

steveeh131047

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Posts: 217
Re: Problem identifying calling URL in PHP script
« Reply #2 on: March 19, 2008, 02:09:27 pm »

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
Logged

Nibbler

  • Guest
Re: Problem identifying calling URL in PHP script
« Reply #3 on: March 19, 2008, 02:16:35 pm »

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

steveeh131047

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Posts: 217
[Solved]: Problem identifying calling URL in PHP script
« Reply #4 on: March 19, 2008, 03:04:32 pm »

Nibbler,

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

Thanks for your help.

Steve
Logged
Pages: [1]   Go Up
 

Page created in 0.013 seconds with 15 queries.