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

How to restrict one user from one IP

I want to allow only one account currently logged in from one IP.
Sometimes user open two or three accounts from one IP.
Is there any way to stop that?

I m thinking of getting IP and storing it in session variables and
making a check but not clear about the whole process.

Regards
Rahi
Feb 26 '08 #1
5 2645
ra**********@gmail.com wrote:
I want to allow only one account currently logged in from one IP.
Sometimes user open two or three accounts from one IP.
Is there any way to stop that?

I m thinking of getting IP and storing it in session variables and
making a check but not clear about the whole process.

Regards
Rahi
You can't do it reliably.

Many medium and large companies have a proxy that all computers on their
network use, so externally, all of their computers will have the same IP
address.

But worse, many large companies and ISP's (such as AOL) use multiple
proxies, and a request can come from any of the proxies. That means
every request may come from a different IP address.

And even if neither of the above is true, dynamic addressing means a
user can get a different IP address when his current lease expires.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Feb 26 '08 #2
ra**********@gmail.com wrote:
I want to allow only one account currently logged in from one IP.
Sometimes user open two or three accounts from one IP.
Is there any way to stop that?

I m thinking of getting IP and storing it in session variables and
making a check but not clear about the whole process.
$_SESSION

--
Freundliche Grüße,
Franz Marksteiner

Feb 26 '08 #3
On Tue, 26 Feb 2008 07:51:55 +0100, ra**********@gmail.com
<ra**********@gmail.comwrote:
I want to allow only one account currently logged in from one IP.
Sometimes user open two or three accounts from one IP.
Is there any way to stop that?

I m thinking of getting IP and storing it in session variables and
making a check but not clear about the whole process.
Rather then restrict it by ip, I use tables to store a session:

table sessions:
session-id (primary key, session-id from PHP)
user-id (from the users table or null)
values (default serialized session data)

table user:
id
name
etc...

On a login attempt, a user can identify himself, which will mean his
user-id gets coupled to the session, all other session(s) having that
user-id will have their user-id set to null (effectively logged out). The
user-id is 'manualy' (i.e. with PHP code querying the database)
overwritten in the $_SESSION array.

The advantage is that a user can be logged in with only one session-id,
regardless of changing/static ip addresses (several users from one, or one
hopping addresses is no trouble), the disadvantage could be that one user
which deploys different UA's which don't share their cookies (MSIE & FF
for instance), he can't stay logged in in both UA's.
--
Rik Wasmus
Feb 26 '08 #4
On Feb 26, 1:51 am, "rahismail...@gmail.com" <rahismail...@gmail.com>
wrote:
I want to allow only one account currently logged in from one IP.
Sometimes user open two or three accounts from one IP.
Is there any way to stop that?

I m thinking of getting IP and storing it in session variables and
making a check but not clear about the whole process.

Regards
Rahi
$_SESSION wont help with this on it's own as two computers would have
separate SESSION_IDs
you would have to store IP addresses with SESSION_ID in a database or
something
then you'd have to search the db for that IP on every page access, and
if the SESSION_ID doesn't match... handle it...

but the problems with this have been highlighted and if it's something
like someone flooding your site, throttle Login actions to y attempts
every x seconds
Feb 26 '08 #5


ra**********@gmail.com wrote:
I want to allow only one account currently logged in from one IP.
Sometimes user open two or three accounts from one IP.
Is there any way to stop that?

I m thinking of getting IP and storing it in session variables and
making a check but not clear about the whole process.

Regards
Rahi
Search the archives, you will find the answer! Do not ask the question
which were answered!..
Feb 26 '08 #6

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

Similar topics

2
by: Gerry | last post by:
I have a developer here with a website running with only "Windows Integrated Authentication" set on a Windows 2000 member server that uses GetObject to get a user's group membership in the domain....
3
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to restrict access to certain pages, using the built...
3
by: Agnes | last post by:
In textbox, I know I can set e.handled = false in keypressevent , So I can restrict the user to input some invalid character or disallow the user to input any thing Now, in datagrid, there are 3...
5
by: toddles666 | last post by:
Hi- Is there any way of restricting access to a database by application & account? For example, I only want the application APP1 to access the database using the USER1 account. I've tried to...
12
by: Me | last post by:
I'm trying to wrap my head around the wording but from what I think the standard says: 1. it's impossible to swap a restrict pointer with another pointer, i.e. int a = 1, b = 2; int *...
21
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no...
2
by: den 2005 | last post by:
Hi everybody, How do restrict entering these characters <>\"%';()& and telling user these caharcters are not allowed to be enter in the textbox field using RegularExpression Validator? I put in...
1
by: =?Utf-8?B?Qw==?= | last post by:
I want to restrict the user entering nonalphanumeric keys using Javascript onKeypress. One exception is that I want to allow the user to enter spaces. How can I do this? Thanks in Advance.
3
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi there, I've got the standard Dreamweaver restrict access to page behaviour below – <% ' *** Restrict Access To Page: Grant or deny access to this page MM_authorizedUsers="1,2,3"...
1
by: Mubs | last post by:
Hi PPL, On my website i have setup user log in. once they log in i want to restrict certain users from certain pages.. and on some pages i want the user to enter their username and password...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.