Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts

    Checking IPs on sign up

    My website is fully run in PHP, very little html, JS.

    I allow people to have up to 3 accounts, which I have a IP feature that checks for matches to see who has how many.

    However I would like when they go to the register page it say something like:
    (Your IP Address Logged: 100.118.50.62)

    so then when they try to create an account, it'd check the database and count the number of accounts that match that IP. So if 3 or more comes up, it will cancel the register.

    Any ideas on how to do this? I figure Ajax could do it easily and better, but I know 0 things about ajax.

  • #2
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    The IP Address is stored in $_SERVER['REMOTE_ADDR'], so whenever a new account is created, you should store that with the account information, so you can check afterwards, if there are already three of those.

    There is no reason why adding ajax to the mix would make it any easier.

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I do log IP's which is how it checks the database for them. Do I just do something like this?

    PHP Code:
    $query mysql_query("SELECT ipaddress FROM users WHERE ipaddress='".$_SERVER['REMOTE_ADDR']."'");

    $howmany mysql_num_rows($query);

    if (
    $howmany >= '3') {
    //Cancel the register


  • #4
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Yes, why not? Does it work? Or haven't you tried yet?

  • #5
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    The problem with using the IP address for identification purposes is that it can change whenever the user logs off then back on to the internet. Email might be better and seems to be the standard for most sites that require signing up.


    ---
    Leonard Whistler

  • #6
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Quote Originally Posted by Len Whistler View Post
    The problem with using the IP address for identification purposes is that it can change whenever the user logs off then back on to the internet. Email might be better and seems to be the standard for most sites that require signing up.


    ---
    Yes but I had a problem with someone creating like 100 accounts, and kept making new hotmail and yahoo email accounts. So I figure IP is the best way to go.

  • #7
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    some ISP's - I think I should not say which - can change IP during sessions. It is unreliable to rely on ip addresses.

    This might be as reliable (but you might see the draw backs easier) - time limit each account. delete the account if they didn't login within say 2 days. it would get rid of those which were over your limit because it would be such a chore for the user to keep them active.

    drawbacks I see are
    1. it wouldn't limit to 3 but it would get rid of a load of the 100 or so you mentioned.
    2. it would delete the genuine accounts of those who were not able to login often enough

    Does a user account store much data, in terms of byteage? if not then you could delete the unused ones after say a week or so, like some ISP's do with their own email accounts.

    Is there a reason why they create so many? is the process of logging in to an existing account more difficult than creating a new one, perhaps if they forget a pwd? if so, then it might be worth considering a change there.

    hth

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •