Loginsystem with sessions. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Loginsystem with sessions. (/showthread.php?tid=9374) |
Loginsystem with sessions. - El Forum - 06-23-2008 [eluser]Jesse2303[/eluser] Hi all, back again I've got a question. How I make a good login with sessions ? What files I need to update and what sort of query I need to use. How I update my menus and how I write them in a view file ?. Before Code: <?php After Code: Give me please :) Thanks a lot. See also this topic... Loginsystem with sessions. - El Forum - 06-23-2008 [eluser]Colin Williams[/eluser] Well, you should probably create or use a more robust library to handle such systems. I would recommend doing more than simply checking for the existence of a session variable. CodeIgniter includes a Session library, and there are several improvements in the Wiki to consider using as a base for your login system. The user library I use has an access method that lets you easily perform these types of checks: Code: if ($this->user->access()) As you can see, the method reads well and provides multiple uses to streamline code. I'd suggest trying something similar. Loginsystem with sessions. - El Forum - 06-23-2008 [eluser]Jesse2303[/eluser] [quote author="Colin Williams" date="1214265746"]Well, you should probably create or use a more robust library to handle such systems. I would recommend doing more than simply checking for the existence of a session variable. CodeIgniter includes a Session library, and there are several improvements in the Wiki to consider using as a base for your login system. The user library I use has an access method that lets you easily perform these types of checks: Code: if ($this->user->access()) As you can see, the method reads well and provides multiple uses to streamline code. I'd suggest trying something similar.[/quote] Thanks for this part but I need to add something in the config/autoload.php ? And how I build the loginfunction ? See also this topic... Loginsystem with sessions. - El Forum - 06-23-2008 [eluser]Colin Williams[/eluser] The code I included is only an example of how I use a system I developed. It's not standard CI stuff. You might not need to add anything to autoload.php... But I suggest using the Session class to handle sessions. It's all in the User Guide. I would also suggest storing user data in a database, so you'll need to use the Database class. You'll want to encrypt sensitive data like passwords, so you'll want to make use of the Encryption class. Quote:And how I build the loginfunction ? I'm not sure if you're expecting pre-rolled code or what, but if so, check out the Wiki or Ignited Code forum for user authentication/authorization libraries. There are several out there, but they're all needlessly bloated IMO. If you want something even more automated/pre-rolled for you, look into something with a full user system built in, like Drupal. Loginsystem with sessions. - El Forum - 06-23-2008 [eluser]Jesse2303[/eluser] Hi, My Login works perfectly. Only my menu won't update. Login Function Code: function login() { Autoload Code: /* Menu ( words in dutch if you don't mind Code: <?php |