My app is PHP / CodeIgniter / TankAuth.
I have in my database an account balance of sorts, and I want to display this account balance on my app's pages. So I've got in all nicely working, holding the balance in the session data.
The balance only changes on login, under certain conditions. So in the tank_auth components, there is a controller, a library etc. The flow is that the Auth controller login calls on the Tank_auth library login function, where the session is created, and then calls on the model to update the login info (IP address, last login etc.) That's all out the box.
So I've extended the session aspects in the library, adding my own user data 'account_balance'. which is fine, but the problem is when the balance changes, my session data is "behind", and I'm really struggling to work out how to update it.
First attempt is to simply try and update the session information after I've updated my database, in the users model (the stock standard Tank_Auth model). It doesn't work, giving me an error.
After some experimenting get this, I realise that I don't understand what this is about. :
echo $this->session->userdata('ip_address'); //works fine - no errors
echo $this->ci->session->userdata('ip_address'); //fail
The Tank_auth modules (library, controllers, models, etc) sometimes refer to ci->sessions and sometimes not, but it uses both.
In the class constructors, it also uses:
$this->ci =& get_instance(); //in the library
$ci =& get_instance(); //in the model
I'm getting 2 errors :
- Message: Undefined property: Auth::$ci
- Trying to get property of non-object
I was under the impression that one would use CI sessions, because it has some nice features, or not if one doesn't want them. But using both.....?
What am I missing?
Thanks in advance.