...

View Full Version : Redirect function not exicuting as expected



hothousegraphix
12-17-2008, 06:43 AM
I have a file management application whose login process is functioning differently across different browsers. In short, it works correctly in IE6, IE7, Chrome, and Opera 9. However, in FF and Safari it does not.

I have 2 different types of users. "Clients" and "Administrators". In all browsers, after authenticating of the "client" UN' and PW', the user is redirected to the proper location. However, when an "administrator's" credentials are authenticated, that users is logged in but the location they are redirected to is not correct.


function redirect_to_home()
{
//header('Location: client_upload.php');

if (isAdmin())
{
header('Location: UserAdmin.php');
}
else
{
header('Location: client_upload.php');
}
}

When the user is an administrator, what occurs in both FF and Safari is that the URL to the location is not properly formed.

When logging in the user is located at

http://www.site.com/fileTransfer/login.php/
Once confirmed as an "administrator", in FF & Safari they are sent to

http://www.site.com/fileTransfer/login.php/UserAdmin.php
rather than the correct location of

http://www.site.com/fileTransfer/UserAdmin.php
(again: which does occur correctly in IE6, IE7, Chrome, and Opera 9)

Odd to say the least...any clues? :confused:

Thanks

Fou-Lu
12-17-2008, 06:52 AM
Absolute paths are not an option.
According to RFC2616 http 1.1 specification, use of Location requires an absolute URI.
So, change up you're info from UserAdmin.php to http://www.site.com/fileTransfer/UserAdmin.php.

You can use PHP to detect and build these url's for you as well based on the current host. This is handy if you're using the same software on different hosts.

lokeshshettyk
12-17-2008, 06:54 AM
Try specifying the absolute url in the header. It's recommended by PHP

hothousegraphix
12-17-2008, 06:58 AM
Thank you both for responding so quickly. I will make these changes and post back my results later.

I appreciate the assistance.

Thanks

hothousegraphix
12-19-2008, 07:14 PM
Thank you both for the help, this was in fact my problem.

Regards.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum