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 08-31-2007, 07:51 PM   PM User | #1
Masterslave
Regular Coder

 
Masterslave's Avatar
 
Join Date: Dec 2005
Posts: 287
Thanks: 2
Thanked 0 Times in 0 Posts
Masterslave is an unknown quantity at this point
Internet Explorer [Sessions][IE 5] Auth wrong or something else?

Hi all,

I'm working on a web application and I'm almost done for the first version.
I check several browser to see how the application is showing it's html css.
But when I use Internet Explorer 5 I can't login and I don't know why.

Some explanation:
The code if you entered a valid username with password:
PHP Code:
session_start();
if( isset( 
$_SESSION['login']) || $_SESSION['login'] )
{
    
header("Location: index.php?page=home");
}
else
{
   if( 
$correctLogin )
   {
      
$_SESSION['account_id'] =  mysql_result($getUsr00); //account id opslaan
      
$_SESSION['real_name'] = mysql_result($getUsr03); //user opslaan vanuit het formulier in de sessie
      
$_SESSION['login'] = true//als login klopt sessie login aanmaken
            
            
$setIsLoggedIn "
                UPDATE " 
ACCOUNT_TABLE 
                SET 
                    is_logged_in = '1'
                WHERE account_id='" 
$_SESSION['account_id'] . "'";

                
mysql_unbuffered_query$setIsLoggedIn ) or die( mysql_error() );

            
header("Location: index.php?page=home");
     }

In every page of the application there's checking a PHP file if your are logged in, if so than you may view the requested page else go to login.php
PHP Code:
<?php
//auth
session_start();
if ( !isset(
$_SESSION['login']) || !$_SESSION['login'] )
{
    
header("Location: login.php");
}
?>
Allright, if I change header("Location: index.php?page=home"); into http://website.com then the header works fine, with index.php?page=home it redirects to login again.
So I think the //auth code isn't working well, this is only with IE5. With FF,IE6+,Opera7+ etc etc it is working well.

Can anybody tell me why IE5 doesn't login to my application?

Thanks in advance.
__________________
Do you Ubuntu?
Mozilla Firefox!

Last edited by Masterslave; 08-31-2007 at 08:51 PM..
Masterslave is offline   Reply With Quote
Old 08-31-2007, 08:57 PM   PM User | #2
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
My first question would be: Why?

I'm all for supporting different browsers. But a browser without any reasonable marketshare?

(I'm not trying to flame, just curious)

Quote:
So I think the //auth code isn't working well
I think if all major browsers handle it properly, and an older browser does not, I think you're dealing with a bug.

It might not be able to deal with relative forwards as well.

Are you sure it's doing what you think it is doing? Usually when something is acting completely illogical, I like to go back and be 100% sure that what I think is happening, is in fact what is happening.

Using Fiddler, and logging statements (so you can see in a seperate file where the code goes) evaluate what is happening.

It's possible that IE5 doesn't handle the session cookie properly with the location forward call, resulting in it thinking that it is a new session (echo out the session ID into a debug file).

EDIT: Looks like I found a fellow Dutchian

Last edited by aedrin; 08-31-2007 at 09:01 PM..
aedrin is offline   Reply With Quote
Old 08-31-2007, 09:07 PM   PM User | #3
Masterslave
Regular Coder

 
Masterslave's Avatar
 
Join Date: Dec 2005
Posts: 287
Thanks: 2
Thanked 0 Times in 0 Posts
Masterslave is an unknown quantity at this point
Hehe, I knew that somebody will asked that.
Why I'm supporting IE5, I don't now actually.
I'm obsessed that my code is working in many browsers, I don't know I like that. (It's hard to express thit in English for me...but ok).

I thought also it is bug, but I'm not sure, so I posted a tread .
Yes, I'm sure it's doing what I'm thinking it is doing for 99%.

I do that PHPSESSIONID debug thing tomorrow(now I'm getting a beer at the bar).
__________________
Do you Ubuntu?
Mozilla Firefox!
Masterslave is offline   Reply With Quote
Old 09-02-2007, 02:34 PM   PM User | #4
Masterslave
Regular Coder

 
Masterslave's Avatar
 
Join Date: Dec 2005
Posts: 287
Thanks: 2
Thanked 0 Times in 0 Posts
Masterslave is an unknown quantity at this point
I couldn't test it so far because my IE5 crashes all the time...
I don't know why, anybody any idea to to solve my problem?
__________________
Do you Ubuntu?
Mozilla Firefox!
Masterslave is offline   Reply With Quote
Old 09-02-2007, 02:52 PM   PM User | #5
CFMaBiSmAd
Senior Coder

 
CFMaBiSmAd's Avatar
 
Join Date: Oct 2006
Location: Denver, Colorado USA
Posts: 2,712
Thanks: 2
Thanked 251 Times in 243 Posts
CFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the rough
This is not really a bug, but following a standard. From the header() section of the php manual -
Quote:
Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:
PHP Code:
<?php
/* Redirect to a different page in the current directory that was requested */
$host  $_SERVER['HTTP_HOST'];
$uri   rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra 'mypage.php';
header("Location: http://$host$uri/$extra");
exit;
?>
Only some browsers/versions support relative addresses in a header() redirect.
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.
CFMaBiSmAd is online now   Reply With Quote
Users who have thanked CFMaBiSmAd for this post:
Masterslave (09-05-2007)
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 10:10 PM.


Advertisement
Log in to turn off these ads.