473,583 Members | 3,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to store login time and logout time for every user?

127 New Member
i wnat to store the login time and logout time in the database....

plz help... also how to retrieve stored logiin.logout times from database....

when i use the simple time disply
Expand|Select|Wrap|Line Numbers
  1. $t=time();
  2. echo ($t);
i get result as
Expand|Select|Wrap|Line Numbers
  1. time 1287032030 
i want to display the time in a correct format like 10:58 AM ... how to do it plz help
Oct 14 '10 #1
3 8494
you can use session variable to store timings
Oct 15 '10 #2
1,044 Recognized Expert Top Contributor
No idea what ~sathishauit is trying to say, but I'd ignore it if I were you. lol

Anyway, it seems like you already know how to store the time, so what you need to be able to do now is to display it. Use the date() function to display the date in the format that you want.
Oct 15 '10 #3
107 New Member
you can create a table with column ip,time, type
ip is the user's ip
time is the time for login or logout time
type is 0 for login time and 1 for logout time

after login user , you can write a record in above table
user's ip is inside $_SERVER['REMOTE_ADDR'], current time is in time(), type depend on login or logout process

for logout you can a menu for logout or can use jquery and write a record in above table with type=1
current time an user's ip

be successful
Oct 16 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: MLH | last post by:
I have tblMemberLogins with and fields. Any member may appear in the table numerous times. How can I sum up the total time spent logged in by any member in the table, I can extract the records easily enough and compute the minutes spent logged in for each record with a query. No problem. But invoking this query from code to arrive at the...
by: Joey Lee | last post by:
Hi, Does anyone knows how to control user login that only a single userid can login at a time? Thanks Joey
by: G | last post by:
Hello Friends, Can i find any sample free webbased-application for employee login and logout timing. Thanks in Advance Appreciate for your Help. Thanks G
by: G | last post by:
Hello Friends, Can i find any sample free webbased-application for employee login and logout timing. Thanks in Advance Appreciate for your Help. Thanks G
by: onlymukti4u | last post by:
Hi All, Can anyone help me out to get the code for knowing the login and logout time difference between some pages. What exactly I want is...."I have a small project having 5 pages,once the user logs in we can calculate the time and we have to calculate the last logout time and their time difference.which I need to add in a database to know...
by: donaldmazig | last post by:
Hello, I am currently working in a database with user security level. What I want to add is a field in a form with type memo where all the user's name, login and logout date and time are recorded. Can you please help me with the code of that. Thank you very much.
by: tariquetuku | last post by:
How to create a login and logout link in a php page which will affect the session variable? Any code available?
by: Thiago Macedo | last post by:
I could not find on the web a complete solution for this task. This is not the perfect solution, because it's doesn't have the ability to log the logout if browser crash or user leave it open while the session time out expires. So, any improvement would be apreciated. 1. Make the system frameable, by creating a frameset page with an...
by: aajayaprakash | last post by:
<?php if($_GET) { $time_now=mktime(date('h')+5,date('i')+30); $a=date('h:i:s',$time_now); echo $b=date(m."/".d."/".Y); include("dbc.php"); $sql="update att_details set end_time='$a' where activation_code='{$_GET}' and date='$b'"; $res =...
by: naveenkongati | last post by:
Hi, My application is designed under MVC2 architecture which includes JSP,Servlet,DAO and bean. In this application i am tracking a user login details into a table. When user logs out i am updating his login status and also taking logout time. If any user doesn't use logout button and close the browser window directly , login status remains...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.