Codeigniter refreshes page after login

Discussion in 'PHP' started by danramosd, Dec 21, 2010.

  1. #1
    I have a simple login where the user submits their login credentials, everything is checked, and if their credentials are correct they are redirected to the members section. If the criteria fails the login screen is reloaded with an error message. I am using a simple redirect() in codeigniter which works fine in all my browsers except IE (what a shocker). I read it's a caching problem and they said to add this line
    
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta http-equiv="pragma" content="no-cache" /> 
    <meta http-equiv="Expires" content="-1" /> 
    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" /> 
    
    </head> 
    
    HTML:
    Which is what i did. For some reason the page just keeps refreshing every time i try to login. The really weird thing is when I use IE 8 on a windows machine it refreshes the page, but running parallels on my mac with the same windows 7 IE 8 setup, i DONT get the refresh problem. I used to have the problem on my parallels setup until i read that i should change ci_sessions to cisessions and that fixed it. But i still have the problem with multiple PC's running IE. Does anyone have the slightest clue as to what could be going on here?
     
    danramosd, Dec 21, 2010 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    One time I ran into a similar problem, however, it only happened on my localhost (wamp), when the site went up, the problem went away.

    Are you testing this live or on localhost?
     
    ThePHPMaster, Dec 21, 2010 IP
  3. danramosd

    danramosd Active Member

    Messages:
    115
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    83
    #3
    Ive used it on local (MAMP on OSX) without a problem and moved it live to a LAMP site which is where I have the problem.
    Doesnt work with 2 machines using IE 8 and windows 7
    DOES work using all other browsers and parallels running windows 7 with IE 8

    I cannot figure out how in the hell to fix this or what is going on. Does anyone have a suggestion?
     
    danramosd, Dec 22, 2010 IP
  4. danramosd

    danramosd Active Member

    Messages:
    115
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    83
    #4
    I fixed my problem! For anyone else having the same problem this is what i did (where i messed up). In the config file set
    $config['sess_use_database'] = TRUE;

    I had it set true up top and false below which obviously caused a problem. After that set:
    $config['sess_table_name'] = 'cisessions';

    Make sure cisessions is not using an _ which gives IE some problems for what ever reason. Lastly make sure you have the cisessions table setup in your database. Between these three things I was able to get everything working fine.
     
    danramosd, Dec 22, 2010 IP
  5. shofstetter

    shofstetter Well-Known Member

    Messages:
    178
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    120
    #5
    You may be having a "session" problem. On the pc where it is not working check to make sure that session cookies are enabled. I believe that in most versions of internet explorer session cookies are disabled by default.


    Try clearing the browser cache on the pc's that are still having the problem, just to make sure it's not a phantom.

    If it is not a phantom check the codeignigter code for redirect() their code not yours, and see what headers they are sending. A typical php redirect looks like this:

    <?php
    header("location: http://somepage.com/gohere");

    ?>
    But you can also send headers like the ones you have set in your meta tags.


    Looks like I should have "refreshed" before I posted. A little late:)
     
    Last edited: Dec 22, 2010
    shofstetter, Dec 22, 2010 IP
  6. backlinkneeded

    backlinkneeded Member

    Messages:
    285
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #6
    I had the same problem and I paid about $150 for to fix it. so you guyz just saved that much money.
     
    backlinkneeded, Dec 22, 2010 IP