Why Does CodeIgniter Set Cookie Not Work?

Well, because CodeIgniter is garbage, and you should probably be using Yii.

If you want to fix CodeIgniter, open up system/core/Input.php and scroll down to line 248 to see this line:

$expire = time() - 86500;

Well that's silly ... someone decided to set the cookie's expiration date to yesterday!

If you change the '-' to a '+', your cookies will be good for 24 hours. If you want your cookie to be good for 40+ years, try this:

$expire = time() * 2;

This bug may have been fixed in later versions, but it certainly was not in mine.


4 comments:

  1. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!

    Canada’s Premier Web Marketing /SEO /SMM /SEM Company!

    ReplyDelete
  2. Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.
    First Canadian Aligning R&D for SR&ED Tax Credits

    ReplyDelete
  3. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks! A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article.
    Php course in chennai

    ReplyDelete
  4. CodeIgniter is gaining popularity these days. It is easier, faster and more reliable as compared to other frameworks. Kanhasoft is leading CodeIgniter Development Company in India which has successfully completed many Customized CodeIgniter Application Development projects. Visit our site.

    ReplyDelete