Welcome Guest, Not a member yet? Register   Sign In
Storing login and logout time
#1

[eluser]Aqsa Jamil[/eluser]
Which function is used for storing current date in codeigniter ?
Actually i want to store log-in time and log-out time in db and want to implement some functionality according to login and logout time. Can any one give me some idea ???
#2

[eluser]swgj19[/eluser]
Code:
$now = date("Y-m-d H:i:s");

You will need to use a time stamp in the database to store the time. This is easily done in mysql phpmyadmin.
#3

[eluser]Aqsa Jamil[/eluser]
I want to implement a functionality to create profile for the newly registered user. for that i need to check log-in and log-out time in order to determine if the user is newly registered user or not, if login and logout time is NULL then the create profile interface will be displayed for that user to create profile. if Not NULL then user will be redirected to some other page
Can any one give me some idea about how to write code in Model and Controller for that???
#4

[eluser]boltsabre[/eluser]
Eh? You want them to login and if it's the first time redirect them to a "register" form... how can they "login" if they haven't even registered yet?

Anyway, I'd just make a "register" form, and when the user has successfully completed this form set a user table column called "fully_registered" (or whatever you want to call it) to 1. When the user logs in just check for this and if it's 1 you know they are registered, else redirect them to the "register" form. Saves on mucking around with dates and stuff, and saves on DB storage (a tinyint(1) is much smaller that a DATETIME column).
#5

[eluser]swgj19[/eluser]
My register login profile

Check out the above link. I just finished building this register, login, and profile script. This is probably what you are trying to do. The above is just a test site link. When user registers, they are sent an email to confirm. It has a forget password login, etc.
#6

[eluser]Captain_Fluffy_Pants[/eluser]
myslq and phpmyadmin
#7

[eluser]skunkbad[/eluser]
[quote author="Aqsa Jamil" date="1346664159"]I want to implement a functionality to create profile for the newly registered user. for that i need to check log-in and log-out time in order to determine if the user is newly registered user or not, if login and logout time is NULL then the create profile interface will be displayed for that user to create profile. if Not NULL then user will be redirected to some other page
Can any one give me some idea about how to write code in Model and Controller for that???[/quote]

When you create the user, your insert data will not include a field that is defaulted in the table. For instance, if you have a user table the field could be 'new', and the value could default to '1'. When the user finally fills out their profile, the update would set it to '0'. This is super easy. If you can't figure this out by yourself, then you should re-read the entire section on database interactions, models, and controllers in the user guide. If that doesn't help, you may need to spend some time learning basic PHP.

You also might want to check out my Community Auth application. It provides a lot of working examples, and also a complete and tested user authentication library.




Theme © iAndrew 2016 - Forum software by © MyBB