views:

78

answers:

4

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 can this be achieved? I'm at a loss here and examples would be appreciated! :)

A: 

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

SeanJA
+1  A: 

Hello, 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.

Tms
It's ActiveRecord.
Alix Axel
Thanks, I updated the post
Tms
A: 

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.

Alix Axel
+3  A: 

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.

mrinject
A last_login timestamp is generally more useful than a simple first_login flag, and is no more difficult to implement.
meagar
Thanks, again! Your answer was helpful to a beginner!
Kevin Brown