473,396 Members | 1,966 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,396 software developers and data experts.

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 2204

gehegerade...@gmail.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***********@gmail.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***********@gmail.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
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...
5
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...
2
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...
8
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...
5
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...
6
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...
3
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...
15
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...
5
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,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.