SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE6 vs IE5 Help..

    Quite a generic query really, not sure whether anyone can help me..

    I've been teaching myself PHP over the last couple of weeks (Procedural, not OO).. I’ve been playing with the code found in a couple of books I bought, then started my own application from scratch.

    I designed it whilst constantly testing in primarily FF, but gave it a run out in IE6&7 too. I was delighted to recently get it working perfectly on all three platforms above much quicker than I thought I would.

    The application is a simple user authentication + shopping cart application.

    Now I have just given it a whirl on IE5.1 + 5.5 and the authentication simply doesn't work. No errors, it just doesn't work.

    Before I start posting up chunks of code, is there some major difference between 5.5 and 6 that affects PHP?

    What I am essentially doing is capturing a username through a form, and checking it against a database.. then setting a flag as a session variable, which is checked before any secure page is displayed.

    I just thought I would ask the simple question first in case it wasn't in the books I read.

    Thanks for your time and patience in helping the new guys
    Last edited by Cobant; Jan 3, 2007 at 12:46. Reason: Spelling

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    wwwwooooaaa there.
    PHP has nothing to do with your browser. The server only returns pure Client-Side code (e.g. HTML).

    The problem is with some client side coding, maybe some javascript is new, or some CSS isn't backwards-compatible
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    keep in mind sessions by default will not work unless the browser accepts your session cookie. theres numerous reasons why a browser wouldnt accept a cookie, some mentionables:
    IE's privacy settings
    extra security software

    forms behave a bit different as well in some aspects.
    some mentionables:
    elements which submit the form, like type=submit and type=image buttons

    do not test for these elements to test for form submission, its not needed and behavior will be inconsistant.
    instead test for the field which contains the value you will actually use, or just use
    if (!empty($_POST)) {}

    do some debugging. inspect the values of ALL of your variables.
    print_r() and var_dump() are handy here. always view your html source, never let the browser render the page for you.

    for example, print_r($_POST); and make sure everything is exactly the same. look carefully.

  4. #4
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arkinstall View Post
    wwwwooooaaa there.
    PHP has nothing to do with your browser. The server only returns pure Client-Side code (e.g. HTML).

    The problem is with some client side coding, maybe some javascript is new, or some CSS isn't backwards-compatible
    I am aware of what you are saying, but these are vanilla interfaces.. not a bit of CSS or Java in sight.. I will apply the design after I have a 100% working app.

    I asked the question as I have not been using it for very long, hence why I was wondering whether there was a well known problem with the handling sessions or something I was not aware of.

    Thanks for your input.

  5. #5
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher View Post
    keep in mind sessions by default will not work unless the browser accepts your session cookie. theres numerous reasons why a browser wouldnt accept a cookie, some mentionables:
    IE's privacy settings
    extra security software

    forms behave a bit different as well in some aspects.
    some mentionables:
    elements which submit the form, like type=submit and type=image buttons

    do not test for these elements to test for form submission, its not needed and behavior will be inconsistant.
    instead test for the field which contains the value you will actually use, or just use
    if (!empty($_POST)) {}

    do some debugging. inspect the values of ALL of your variables.
    print_r() and var_dump() are handy here. always view your html source, never let the browser render the page for you.

    for example, print_r($_POST); and make sure everything is exactly the same. look carefully.
    Thanks for that.. I'll take another look as suggested..

  6. #6
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've broken it down to its bare bones, and I'm just at a loss as to explain why it works perfectly on 6+ & FF, get not on 5.x

    extract from login.php
    PHP Code:
    $_SESSION['aeauthflag']="yes";                     
    $_SESSION['logname'] = $_POST['fuser_name'];  
    $_SESSION['fullname'] = $first_name." ".$last_name;
               
    //echo $_SESSION['aeauthflag'];
    //exit();
                
    header("Location: home.php"); 
    If you include those commented out statements, it displays 'yes'.. if you don't, it successfully passes to home.php..

    start of home.php
    PHP Code:
    <?php
    session_start
    ();
    if (@
    $_SESSION['aeauthflag'] != "yes")
    {
    header("Location: login.php");
    exit();
    }
    when run, it will always point back to login.php. Take out the IF statement, and home.php will load fine. Add some code to print out $_SESSION['aeauthflag'] at the beginning of home.php, and the variable is empty.

    Just throwing this out there incase I've made a glaring mistake.

    Thanks for any help, I'm sure there are neater and tidier ways to write the code I'm writing, but please do take into consideration that I am only just learning this stuff.

    Thanks!
    Last edited by Cobant; Jan 3, 2007 at 14:18. Reason: Spelling & Tidy code layout

  7. #7
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    print_r($_COOKIE);

    to see if the browser is sending the session cookie.

  8. #8
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher View Post
    print_r($_COOKIE);

    to see if the browser is sending the session cookie.
    Array ( )
    Suggests not, eh?



    Any ideas why? Sorry, I'm slightly lost now..

    Thanks for your help!

  9. #9
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    probably due to privacy/security settings.

    as a test, does it work if you loosen the settings?
    can you manually set a cookie with setcookie() ?

  10. #10
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher View Post
    probably due to privacy/security settings.

    as a test, does it work if you loosen the settings?
    can you manually set a cookie with setcookie() ?
    PHP Code:
    $value "test";
    setcookie("TestCookie",$value); 
    I put that in just before the re-direct, and the print_r still returned no value.. (but it did on FF & IE6)

    The security settings on IE 5.1 are reduced to minimum.. and cookies are definately on.

    God knows what I've done

  11. #11
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is there a particular reason why you need to support IE5.x?? the simplest solution is to not support IE5... and continue support on IE6+, FF and Safari.
    Robust, Scalable, Custom Ecommerce Solution

  12. #12
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you using IIS as your webserver? i recall hearing an issue with setting cookies on a page that redirects, although im not sure of the details. i would think it would affect other browsers too though if it was a platform issue.

  13. #13
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AaronM View Post
    is there a particular reason why you need to support IE5.x?? the simplest solution is to not support IE5... and continue support on IE6+, FF and Safari.
    No particular reason, I will just inevitably get someone come back who is still running it and won't be able to log in.. rather sort it now than later.

    Not quite sure where to go from here though..

    By the way, I am also Aaron M. well done on having an excellent name - Only met about three Aarons before in my life!

  14. #14
    SitePoint Enthusiast Cobant's Avatar
    Join Date
    Feb 2005
    Location
    Leeds, UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by clamcrusher View Post
    are you using IIS as your webserver? i recall hearing an issue with setting cookies on a page that redirects, although im not sure of the details. i would think it would affect other browsers too though if it was a platform issue.
    Hi mate.. thanks for your continued help.

    The server is a LAMP setup as I understand it.. I host with an ISP. they are still on PHP 4 I think.

    I'll have a play with doing a manual re-direct.

    Thanks,

    Aaron


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •