working with CI sessions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: working with CI sessions (/showthread.php?tid=26892) |
working with CI sessions - El Forum - 01-26-2010 [eluser]sasori[/eluser] hi this is my first time to try sessions of CI and im in trouble LOL here's my controller code Code: public function login() model Code: public function login($username,$password) view Code: <?php when i try to log-in with a correct data, I'm just getting the "you aren't logged in" working with CI sessions - El Forum - 01-26-2010 [eluser]guidorossi[/eluser] 2 things... 1- are you loading the session library? 2- I think Code: isset($_SESSION['username'] Code: isset($this->session->userdata('username')) Code: echo "you are logged in as .". $_SESSION['username']; Code: echo "you are logged in as .". $this->session->userdata('username'); working with CI sessions - El Forum - 01-26-2010 [eluser]sasori[/eluser] ok i tried what you said, now am getting this error Code: Fatal error: Can't use method return value in write context in C:\xampp\htdocs\myapp\application\views\member_view.php on line 4 where line 4 is the Code: if(isset($this->session->userdata('username'))){ (btw the session class is autoloaded from the config) working with CI sessions - El Forum - 01-26-2010 [eluser]guidorossi[/eluser] Sorry about that, it should be Code: <?php but I suggest you to take a look at this video tutorial from nettuts to get some good practices because I think your code have some security issues like setting the cookie data before calling the login model.... http://net.tutsplus.com/videos/screencasts/codeigniter-from-scratch-day-6-login/ working with CI sessions - El Forum - 01-26-2010 [eluser]sasori[/eluser] lol , too late, I was already downloading it since my last reply from this thread. but anyway. thanks for the help. |