Page 1 of 1

Question about redirect function in misc.functions.php

Posted: Tue Jun 20, 2006 3:39 pm
by ejweidl
I'm a CMSMS newbie. Kinda new to PHP, too.

I downloaded and installed 0.13 under IIS on XP yesterday. The install went smoothly and the main site worked well; however, I got an error anytime I clicked on a submit button in the admin area.

After digging around the code a bit I found the redirect() function in misc.functions.php. I did some debugging and found that the function wasn't adding the admin subdirectory to the URL. For example, it was created "http://localhost/listusers.php" when it should have been generating "http://localhost/admin/listusers.php".

It looks like the code was checking the contents of the $_SERVER['PHP_SELF'] variable, but right at the top of the function, it sets that variable to NULL:

...
function redirect($to, $noappend=false)
{
$_SERVER['PHP_SELF'] = null;
...

When I commented out that line, the function generates the correct redirect URL and the site is working properly.

Is that a mistake in the code or am I not understanding how the code works?

Eric

Re: Question about redirect function in misc.functions.php

Posted: Tue Jun 20, 2006 4:07 pm
by Ted
I agree.  This seems incredibly pointless to me.  I know I committed the code, but I can't remember why.  :)  I'm almost thinking it was test code that never got removed.

I'll look into it.  Thanks.