•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,771 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,511 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2177 | Replies: 1
![]() |
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
•
•
•
•
Originally Posted by michael123
I have a login script, I want to modify it to restrict the sharing username access, by IP address, what will be a good method to do this?
What I think I hear you say is you want to be able to detect if more than one IP address logs in with the same username? You want to use this to detect account sharing? Please clarify.
Detecting the IP address is very easy, create a PHP page with only this code in it:
[PHP]
<php
phpinfo();
?>
[/PHP]
Run the page in a browser, then look for the server variables such as "REMOTE_ADDR". In PHP, you access these using the $_SERVER object.
[PHP]
$ip = $_SERVER['REMOTE_ADDR'];
[/PHP]
I should add that this is not a good way to detect account sharing unless you want to make it clear to your users that they can only use their account on a single computer and if the cable/dsl company changes their dynamic IP, they will lose access to their account.
I should also point out that the opposite is true, one IP could be hundreds of people. Almost any company on the Internet has all of its employees surfing the web behind a single IP--the IP of their firewall or router. In the old days, IP used to equate to unique identity on the Internet. That is no longer true.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- resultset updatable (Oracle)
- username=email address inputted on submission>is this possible (PHP)
- Problem with filesharing on XP home (Windows NT / 2000 / XP / 2003)
- Postfix configuration (*nix Software)
- Stuck on Mail() Function (PHP)
- ftp client issues...im so confused...plz help!!! (Windows Software)
Other Threads in the PHP Forum
- Previous Thread: $rs=mysql_query($sql) or die("error in common.inc.php at line 257");
- Next Thread: Need help with existing code


Linear Mode