Getting the customer id if session is not set |
Hi, sorry for lots questions on auto logins I am just new at that.
I am creating a auto login for my front end system. When the session has expired it unset the customer id. I use my readAutologin function to see if any rows return with customer id. But because it does not exist in the session or cookie I do not no the better way of being able to get customer id for my readAutologin My cookie data only has tokens it has no customer id's PHP Code: public function readAutologin() { I was thinking instead of PHP Code: public function readAutologin() { What is your suggestion? There is no encryption at the moment I am just playing around to it working? Full Code Here
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
You can add this to your class:
PHP Code: // Add this as a class variable What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-28-2016, 04:19 AM)InsiteFX Wrote: You can add this to your class: Do I put the bottom 2 in the __construct() area?
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
(07-28-2016, 04:27 AM)wolfgang1983 Wrote:(07-28-2016, 04:19 AM)InsiteFX Wrote: You can add this to your class: You first need to get your customers id, I would create two new methods setCustomerId() and getCustomerId() I see you are getting the customers id in the postLogin method so that would be were you would set it. You get the customer id anywhere you need it after that. Also if you do not need the customers id outside of this class then make the variable private. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-28-2016, 04:30 AM)InsiteFX Wrote:(07-28-2016, 04:27 AM)wolfgang1983 Wrote:(07-28-2016, 04:19 AM)InsiteFX Wrote: You can add this to your class: Did not work returning 0
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Sorry try this
PHP Code: static protected $customerId = 0; By all means it should be working are you sure that you are returning the customer id? What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-28-2016, 05:55 AM)InsiteFX Wrote: Sorry try this I gave it another go still not work was all way returning 0 Here is what I have done so far. The only thing that is stopping me is I cannot get the customer id for readAutologin because session expired. I have all ways been told not to hide customer id or user id in cookies only tokens. So I can not think of any other way to get id.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I'll work something up for you and get back to you later on, using the tokens and database.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-29-2016, 04:26 AM)InsiteFX Wrote: I'll work something up for you and get back to you later on, using the tokens and database. I have worked it out with tokens my self have now got the idea about serialize the tokens in the cookie into array and then encode them then decode them into read part then verify the token that is set in customer with the token that is set in customer autologin and have a key token for extra security. that would change every so often. It has been stuffing up my head but now think got it.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
All you need to do is save the customer_id to the user_id in the auth_tokens table
You already have the token for that user. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |