Question about redirect function in misc.functions.php
Posted: Tue Jun 20, 2006 3:39 pm
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
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