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

[eluser]tkyy[/eluser]
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:

Code:
$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

Code:
$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:

Code:
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:

Code:
access(10);

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/


Messages In This Thread
CI total newbie topic - by El Forum - 08-26-2010, 08:56 AM
CI total newbie topic - by El Forum - 08-26-2010, 09:38 AM
CI total newbie topic - by El Forum - 08-26-2010, 09:42 AM
CI total newbie topic - by El Forum - 08-26-2010, 02:14 PM
CI total newbie topic - by El Forum - 08-26-2010, 02:55 PM
CI total newbie topic - by El Forum - 08-26-2010, 05:29 PM
CI total newbie topic - by El Forum - 08-26-2010, 06:08 PM
CI total newbie topic - by El Forum - 08-26-2010, 08:50 PM
CI total newbie topic - by El Forum - 08-26-2010, 08:51 PM
CI total newbie topic - by El Forum - 08-27-2010, 02:05 AM
CI total newbie topic - by El Forum - 08-27-2010, 07:28 AM
CI total newbie topic - by El Forum - 08-28-2010, 02:25 AM
CI total newbie topic - by El Forum - 08-28-2010, 02:39 AM
CI total newbie topic - by El Forum - 08-28-2010, 04:59 AM
CI total newbie topic - by El Forum - 08-28-2010, 02:47 PM
CI total newbie topic - by El Forum - 08-28-2010, 02:53 PM
CI total newbie topic - by El Forum - 08-29-2010, 06:02 AM
CI total newbie topic - by El Forum - 08-29-2010, 03:27 PM
CI total newbie topic - by El Forum - 08-30-2010, 02:08 AM
CI total newbie topic - by El Forum - 08-30-2010, 03:00 AM
CI total newbie topic - by El Forum - 08-30-2010, 07:09 AM
CI total newbie topic - by El Forum - 08-31-2010, 02:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB