Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-17-2008, 05:43 AM   PM User | #1
hothousegraphix
Regular Coder

 
Join Date: May 2003
Location: Chicago, IL
Posts: 131
Thanks: 3
Thanked 0 Times in 0 Posts
hothousegraphix is an unknown quantity at this point
Redirect function not exicuting as expected

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.
PHP Code:
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
Code:
http://www.site.com/fileTransfer/login.php/
Once confirmed as an "administrator", in FF & Safari they are sent to
Code:
http://www.site.com/fileTransfer/login.php/UserAdmin.php
rather than the correct location of
Code:
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?

Thanks
hothousegraphix is offline   Reply With Quote
Old 12-17-2008, 05:52 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,741
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
hothousegraphix (12-19-2008)
Old 12-17-2008, 05:54 AM   PM User | #3
lokeshshettyk
Regular Coder

 
lokeshshettyk's Avatar
 
Join Date: Aug 2008
Location: On the way to the moon!
Posts: 157
Thanks: 5
Thanked 20 Times in 20 Posts
lokeshshettyk is an unknown quantity at this point
Try specifying the absolute url in the header. It's recommended by PHP
lokeshshettyk is offline   Reply With Quote
Users who have thanked lokeshshettyk for this post:
hothousegraphix (12-19-2008)
Old 12-17-2008, 05:58 AM   PM User | #4
hothousegraphix
Regular Coder

 
Join Date: May 2003
Location: Chicago, IL
Posts: 131
Thanks: 3
Thanked 0 Times in 0 Posts
hothousegraphix is an unknown quantity at this point
Thank you both for responding so quickly. I will make these changes and post back my results later.

I appreciate the assistance.

Thanks
hothousegraphix is offline   Reply With Quote
Old 12-19-2008, 06:14 PM   PM User | #5
hothousegraphix
Regular Coder

 
Join Date: May 2003
Location: Chicago, IL
Posts: 131
Thanks: 3
Thanked 0 Times in 0 Posts
hothousegraphix is an unknown quantity at this point
Thank you both for the help, this was in fact my problem.

Regards.
hothousegraphix is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:36 AM.


Advertisement
Log in to turn off these ads.