开发者

Codeigniter first time user

开发者 https://www.devze.com 2022-12-14 04:47 出处:网络
I need a way to tell if it\'s a user\'s first time to log in--so I can display relevant information to that user about what they need to do.

I need a way to tell if it's a user's first time to log in--so I can display relevant information to that user about what they need to do.

How开发者_如何学JAVA can this be achieved? I'm at a loss here and examples would be appreciated! :)


It is often useful to store the 'last login' time and date for users. If you did that you could simply check if last_login was NULL in your users table and then display your message or whatever.


this isn't really a codeigniter specific question. You would want to interact with a database that stores user information. A "user" table could have a field in it that gets set to "true" (or some value) when a user logs in for the first time (which you could subsequently query). Codeigniter does make it easier for you to interact with a database - just do a search (or look in their excellent documentation) for Codeigniter ActiveRecord. Good luck.


You'll have to store something like that in the database:

username varchar 255
password varchar 255
first_login bool default 1

If first_login is 1, display the information and set first_login to 0


You can store one field in the database, like flagFirstLogin = 1 uppon the registration and after the first login you just change that to 0.

0

精彩评论

暂无评论...
验证码 换一张
取 消