473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

prevent duplicate login

28
Dear All,

I would like to ask about login control. One of my I have to prevent the user duplicate login. I would like to know it is possible or not? If possible, could you tell me some logic for this.

Thanks all,
Jul 1 '09 #1
7 4107
Markus
6,050 Expert 4TB
@foekall
Could you please explain the scenario a little more?
Jul 1 '09 #2
foekall
28
@Markus
My scenario is just simple. I am writing admin control for booking system. I create only one account for admin login but there are one or more user use this admin control with one account. I want to give permission to access admin control only one user at a time.

Thanks
Jul 1 '09 #3
Markus
6,050 Expert 4TB
@foekall
This is difficult because there is no reliable way to *know* when someone logs out. Sure, they may use a 'logout' facility on your application, but they may also -- and this is much more likely -- just close the browser, and, if they do, then you (the application) are left unaware.

There is a way to overcome this, although, again, it is not perfect nor precise.

When a user (admin) logs in, you update a flag (logged_in) in your database to true. You also log the datetime of the log in (see datetime - mysql). If a user decides to use the logout facility, update the database flag to reflect this.

Now onto the 'knowing when a user is logged out'.

Everytime your admin account performs an action (deletes record, creates record, etc), you update the datetime column to the current datetime. Now we have a general understanding of the admin accounts last activity.

When a user attempts to login as admin, you first check if there is someone already logged in (logged_in). If there is, you compare the last activity time to the current time. You then decide how long someone should have remained inactive before being flagged as logged out. If the last activity time is greater than the specified time, allow the person attempting to log in that priviledge.

Any questions?
Jul 1 '09 #4
dlite922
1,584 Expert 1GB
Depending on your level of paranoia =), you could have a cron job that checks all the dates and logs all users off (let's say setting a logged_in field value to false) if the last activity time (like Markus) suggested is older than a specified period, like an hour.

Makes sense?



Dan
Jul 1 '09 #5
Markus
6,050 Expert 4TB
@dlite922
OMG! I was supposed to suggest that but completely forgot.

:D
Jul 1 '09 #6
dlite922
1,584 Expert 1GB
@Markus
Just admit it!, you can't be as good as me!! :P

BOW before the master!!

/jk




Dan
Jul 1 '09 #7
foekall
28
Dear all,

Thanks for yours advice. I will try with datetime according to yours advice. If I have any question, I would like to ask again. :)

Thanks
foekall
Jul 2 '09 #8

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

Similar topics

3
by: Mohammed Mazid | last post by:
Hi, Basically I have a problem with registering to my quiz system. I had borrowed some code from an existing program but I just do not know why it doesn't work. If (txtUsername = "" Or...
6
by: Bhavini | last post by:
Hi All, I have to prevent multiple logins for the same user accessing at same time. i.e. if xyz user is active, no other login should be allowed for the same user ID. I thought of saving...
1
by: Andy | last post by:
My application is written in .NET (C#) with the inline Edit mode from DataGrid. When a SAVE button is pressed it will perform a action on the database either to add, edit or delete data that a user...
11
by: ariel81 | last post by:
i have created a function to input data from four textboxes into a table. how do i prevent duplicate records of the same mth/Yr into the table? editing of the data in the table with reference to the...
2
by: eazyone | last post by:
I can prevent a duplicate ID from being entered, but can't figure out how to go to that specific record. I keep getting an error message on: Me.Bookmark = rsc.Bookmark Its not opening and...
6
by: Arthur Dent | last post by:
Anyone know, in VB.NET (2005) how to prevent duplicate occurrences of the same event handler on an event? e.g... I have some object which raises an event, and some other class which consumes...
4
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hi, How can I prevent from an ASP.NET page to resend all the data again when the user press the Refresh button or F5 on the browser? Thanks in advanced, Asaf
6
by: teser3 | last post by:
I have my PHP inserting into Oracle 9i. But how do I prevent duplicate record entries? I only have 3 fields in the insert in the action page: CODE <?php $c=OCILogon("scott", "tiger",...
1
by: chicago1985 | last post by:
I have a unique constraint in my Oracle table for 3 fields. If I enter duplicate info on the table using Oracle client I will get an Ora message error ORA-00001 that tells me it is a duplicate entry...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
jinu1996
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...
0
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...
0
agi2029
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,...
0
isladogs
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...

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.