473,585 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

logging in twice with one user account

Is there a way to prevent one user-account from logging in twice on the
same system when using sessions?

I also put the session of a user in a mysql database :

CREATE TABLE `login_sessions ` (
`login_id` int(10) unsigned NOT NULL auto_increment,
`login_session_ id` varchar(32) NOT NULL default '',
`login_user_id` int(10) unsigned NOT NULL default '0',
`login_date` int(14) unsigned NOT NULL default '0',
PRIMARY KEY (`login_id`)
) ENGINE=MyISAM AUTO_INCREMENT= 154 DEFAULT CHARSET=utf8
AUTO_INCREMENT= 154 ;

I can check whether the user_id is already in the database, but what if
the user doesn't log out properly?

Any tips, or links to articles about this?

Thanks!

Dec 4 '06 #1
3 2226

gehegerade...@g mail.com wrote:
Is there a way to prevent one user-account from logging in twice on the
same system when using sessions?
[snip]
>
Any tips, or links to articles about this?

Thanks!
You could have a 'last activity' timestamp in there (you have to do a
lot of updating on your session tracking DB, such as for every DB
access) and then if it has been a while since lass activity, grant
access.

Or you could just put up an "already logged in" mesage with a reminder
to log out properly the next time (BOFH solution)

Dec 4 '06 #2
ge***********@g mail.com schreef:
Is there a way to prevent one user-account from logging in twice on the
same system when using sessions?

I also put the session of a user in a mysql database :

CREATE TABLE `login_sessions ` (
`login_id` int(10) unsigned NOT NULL auto_increment,
`login_session_ id` varchar(32) NOT NULL default '',
`login_user_id` int(10) unsigned NOT NULL default '0',
`login_date` int(14) unsigned NOT NULL default '0',
PRIMARY KEY (`login_id`)
) ENGINE=MyISAM AUTO_INCREMENT= 154 DEFAULT CHARSET=utf8
AUTO_INCREMENT= 154 ;

I can check whether the user_id is already in the database, but what if
the user doesn't log out properly?
- Add a 'loginnumber' column to each user.
- Every time the user logs in you increment the loginnumber by one and
store it in the users session
- On every page request you verify if the loginnumber in the session is
still the persisted one

-advantage: the previous 'loginnumber' will expire as soon as the user
logs in again. No need to think about expiring older sessions...

-disadvantage: you have to verify the loginnumber on each page request
(but if you're going to keep track of the 'last requested' page you have
to do this too...)
--
Tim Van Wassenhove <url:http://www.timvw.be/>
Dec 4 '06 #3

Tim Van Wassenhove schreef:
ge***********@g mail.com schreef:
Is there a way to prevent one user-account from logging in twice on the
same system when using sessions?

I also put the session of a user in a mysql database :

CREATE TABLE `login_sessions ` (
`login_id` int(10) unsigned NOT NULL auto_increment,
`login_session_ id` varchar(32) NOT NULL default '',
`login_user_id` int(10) unsigned NOT NULL default '0',
`login_date` int(14) unsigned NOT NULL default '0',
PRIMARY KEY (`login_id`)
) ENGINE=MyISAM AUTO_INCREMENT= 154 DEFAULT CHARSET=utf8
AUTO_INCREMENT= 154 ;

I can check whether the user_id is already in the database, but what if
the user doesn't log out properly?

- Add a 'loginnumber' column to each user.
- Every time the user logs in you increment the loginnumber by one and
store it in the users session
- On every page request you verify if the loginnumber in the session is
still the persisted one

-advantage: the previous 'loginnumber' will expire as soon as the user
logs in again. No need to think about expiring older sessions...

-disadvantage: you have to verify the loginnumber on each page request
(but if you're going to keep track of the 'last requested' page you have
to do this too...)
--
Tim Van Wassenhove <url:http://www.timvw.be/>
Thanks,

but I think the opposite will happen : the new user will be logged in,
and the existing session will be ended... What I want is to prevent the
new user (with the same user-account) to log-in to the system...

Dec 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3709
by: Karthik | last post by:
Hi, I have a website running on ASP.Net on IIS 6.0. This website has more than 10000 users login everyday. At times the users login with the same user name and password more than once at the same time. I would like to prevent this from happening as it creates a huge problem at the back end (SQL 2k). I maintain all logins in a session...
5
2064
by: Michelle Stone | last post by:
Hi everybody I am writing a simple asp.net application using form authentication. I store the list of all users and their passwords in an SQL Server database table. My client recently told me that he wants me to do something through which only one user can login using any given account name. I mean to say, for example, when a user...
2
2894
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public users). If user is from intranet, web server should recognize it and application should create additional options in controls regarding groups the user...
8
2755
by: TS | last post by:
Hi, i have inherited a page from another user. The page is the target frame in a frameset. for some reason the whole page runs twice (page_load, init, etc. all run twice) I can't figure out how this is happening. there are no transfers or redirects that are occurring in the pages. the page runs thru all of its events then starts all over...
5
6072
by: Ritesh Raj Sarraf | last post by:
import os, sys, logging logger = logging.getLogger("my_app") conerr = logging.StreamHandler(sys.stderr) conerr.setLevel(logging.DEBUG) conerr_formatter = logging.Formatter('%(levelname)s %(message)s') conerr.setFormatter(conerr_formatter) console = logging.StreamHandler(sys.stdout)
6
2037
by: Frank Rizzo | last post by:
I have the following situation: 1. Application X1 runs under a regular user account (this user is also the currently logged on user). 2. Application X1 kicks off Application X2 using an Administrator account and then quits itself. 3. Application X2 does a couple of things, then restarts Application X1 using the regular User account,...
3
5393
by: nicholas.petrella | last post by:
I am currently trying to use the python logging system as a core enterprise level logging solution for our development and production environments. The rotating file handler seems to be what I am looking for as I want the ability to have control over the number and size of log files that are written out for each of our tools. I have noticed...
15
1514
by: Andrew Robinson | last post by:
In the past, I remember all kinds of security related issues when trying to write to the event log but don't remember the specifics. Was there an issue with creating a new source? Can you write if you are using the ASP.NET account or Network Services account? Did this change with .NET v2.0 and/or Win 2003 SP1? thanks,
5
15595
by: Shiao | last post by:
Hi, I am getting duplicate log entries with the logging module. The following behaves as expected, leading to one log entry for each logged event: logging.basicConfig(level=logging.DEBUG, filename='/tmp/foo.log') But this results in two entries for each logged event:
0
7908
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, 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...
0
7836
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...
0
8199
Oralloy
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. ...
0
8336
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
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...
0
6606
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.