[solved]cant set cookies |
[eluser]Bianca Migueis[/eluser]
trying to update an existing website to codeigniter but got stuck at the login function... the if statement works since im redirected to the hoome page with the right password and username but for some reason it wont create a cookie... any thoughts... please? Code: public function authorize()
[eluser]InsiteFX[/eluser]
Thats because you are not setting them right! CodeIgniter User Guide - Set Cookie You need to set an expiration time! InsiteFX
[eluser]Bianca Migueis[/eluser]
Thank you for the link of the page I have printed right in front of me. I have read that page and many others I found on this forum and online but still can't figure out what I'm doing wrong so if you'd be so kind as to tell me why do you say i'm not setting them right I would be forever grateful ![]() EDIT: "Only the name and value are required. To delete a cookie set it with the expiration blank." that's from the user guide. Therefore I left it blank (''), should I use NULL or something like that? I've tried everything I can think of... ![]()
[eluser]InsiteFX[/eluser]
I did you need to set and expiration time, also if your using IE you need to change the cookie name to cisession not ci_session Code: // application/config/config.php You should not store passwords in a cookie! InsiteFX
[eluser]Bianca Migueis[/eluser]
Thank you, I misread the part where it says to leave it blank to delete. I thought it meant it wouldn't have an expiration date if it was set to blank. Do you know how to do that without an expiration? I want to leave it there until I decide to delete it. I usually use encryption and store passwords in cookies. What do you usually do to keep users signed in even after a couple of days? Thank you for the IE tip ![]()
[eluser]InsiteFX[/eluser]
I create a remember me cookie that hods a timeout and token in the database users table, I then regenerate this cookie on the fly to protect it. user comes to your site check to see if they have a remember me cookie, if they do you auto log them in. if they do not then they are forced to login. They will stay loggin until they click logout. On logout you delete the remember ne cookie. InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |