Welcome Guest, Not a member yet? Register   Sign In
CI total newbie topic


i just started looking into to the framework. My first one. Which lightweight authentication system i should use? I only need usergroups (admin and user).


[eluser]Lucas Alves[/eluser]

In my opinion, Ion_Auth is a good choice. It's very lightweight and well coded, so you can adapt it to your needs if you want.

[eluser]Phil Sturgeon[/eluser]
+1 for Ion Auth

can someone walk me through the installation of this Ion Auth. Readme doesn't really explain it to the first time CI user.

[eluser]Lucas Alves[/eluser]
Just run the sql script and copy the files into application respective folders...

MySql Script:

The doc:

just use your own, i linked a very simple one on my blog here- http://www.taky.bz/a-basic-codeigniter-a...ontroller/

in the constructor of your controller files throw this under the parent::controller(); line:

$this->userdata = $this->session->userdata;

which will load up the userdata and return it from the sessions table as an array for you to play with. and then pass the userdata down to the view in the functions like

$data['userdata'] = $this->userdata;

so you don't do multiple queries, you just grab it each time the controller loads. moving forward you can throw this into the controller under the first line i just gave you to make sure a user is logged in:

if($this->userdata['logged']!=1){ $this->session->sess_destroy(); redirect(base()); }

so if the user tries to access an internal page it will destroy any session they may have had an redirect them to root. i truly believe this is the most versatile solution as opposed to using a precanned lib like XXXauth TEN or jAUTH or sAUTH or yaAUTHlib lol. i've even gone so far as to make access levels and a subsequent function i ended up throwing into the helper to do steps in a signup (a secure banking signup at that), so like in the constructor of your controller once again:


would allow the user access to the tenth, ninth, eighth and below pages but not to pages higher than access level 10, as defined in their respective constructor functions. i made a new function in my helper called userdata() which either returns the userdata in array format if no input is given, or, just like codeigniter can either take 2 args (a key and a val) and add them to the userdata in the sessions table or an array of data as well.

i think i posted an early version of my standard helper here: http://www.taky.bz/codeigniter-helpers-f...ile-i-use/

[quote author="Phil Sturgeon" date="1282855331"]+1 for Ion Auth[/quote]

Geesh Phil! Is there currently any CodeIgniter project that you do not currently have a hand in? When do you find the time? I'm in here on the forums too often as it is. I don't have the time (or your mad skillz) to work everyone else's project and contribute to core. Smile Some of us must work for a living! Just checking...and thanks! :-)

@keevitaja It's not terribly hard to write your own if it's simple (I mean if you've ever written session based logins before for PHP and you don't need a plethora of flexibility.) Otherwise, in Open-source World it's perfectly acceptable to build your empire on the backs of others. Enjoy the free code!

i agree with Phil +1 for Ion Auth. Simple to implement, and very easy to use. even comes with all the form templates. great lightweight auth system.

[eluser]Lucas Alves[/eluser]
And what about D.R.Y.?

how to access CI libraries from my custom library?
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class SimpleAuth {
  public function createUser($username, $password) {
    $CI =& get_instance();

this code gives me the error while loading the database

Theme © iAndrew 2016 - Forum software by © MyBB