Limiting registration based on IP.

09/20/2011 22:02 [Dev]RiseAgainst#1
The title says it all. I would like to know how in the registration script do i make it so that you cant register more then once on the same ip address/ computer.
09/20/2011 22:24 [GM]Hazel#2
lol i would like to know myself
09/20/2011 22:38 JohnHeatz#3
I'm not an "expert" on PhP, but the basics of it would be to simply check the IP that is being used while registering with every UserIP registered on the Database, so, (again this won't be PhP based, not even really for any specific language, just something for you to get the idea) there would need to be something like this:

Code:
Function Search ([COLOR="SeaGreen"]Send the IP you receive from the registering User[/COLOR])
        [COLOR="DeepSkyBlue"]counter[/COLOR] = [COLOR="Red"]0[/COLOR]
        Try
            connect_to_database[[COLOR="SeaGreen"]PS_UserData[/COLOR]]
            Select * from dbo.Users_Master where UserIp = [COLOR="Red"]Sent_IP[/COLOR] 
            DataAdapter.SelectCommand = [[COLOR="SeaGreen"]query_from_above[/COLOR]]
            DataSet.Clear()
            Conection.Open()
            DataAdapter.Fill(DataSet, "dbo.Users_Master")
            Conection.Close()

            If oDataAdapter.Fill(DataSet) > 0 Then
                [COLOR="DeepSkyBlue"]counter[/COLOR] = [COLOR="Red"]1[/COLOR]
            End If
            Return [COLOR="DeepSkyBlue"]counter[/COLOR]
        Catch ex As Exception
        End Try
    End Function
I know it looks weird, I tried to make it simple, but this is what I got. What you are doing here is:

1- Starting a function which will receive the IP of the user who is registering an account (up to you on how you will get it)
2- You start a variable (boolean -Yes,No-) counter which is the one who will tell you if you found the IP already on your database.
3- You use a SQL Query to compare that IP from the registering user against the IPs that are stored on your PS_UserData.dbo.Users_Master to try and find a match between them
4- Then you are storing the information you got from it (as boolean) to know if there was or not a match
5- You send back that information, then you will have to code what you are going to show if the IP had a match on your database (The user had already registered an account under that IP) and/or just let that registration go smoothly

Again, this might look weird, but that is where I would start if I had to do something like this; I am sure that there could be many other ways of doing this, and If i knew PhP properly I would've posted it, but unfortunately I don't know much about PhP
09/20/2011 22:42 [Dev]RiseAgainst#4
Quote:
Originally Posted by JohnHeatz View Post
I'm not an "expert" on PhP, but the basics of it would be to simply check the IP that is being used while registering with every UserIP registered on the Database, so, (again this won't be PhP based, not even really for any specific language, just something for you to get the idea) there would need to be something like this:

Code:
Function Search ([COLOR="SeaGreen"]Send the IP you receive from the registering User[/COLOR])
        [COLOR="DeepSkyBlue"]counter[/COLOR] = [COLOR="Red"]0[/COLOR]
        Try
            connect_to_database[[COLOR="SeaGreen"]PS_UserData[/COLOR]]
            Select * from dbo.Users_Master where UserIp = [COLOR="Red"]Sent_IP[/COLOR] 
            DataAdapter.SelectCommand = [[COLOR="SeaGreen"]query_from_above[/COLOR]]
            DataSet.Clear()
            Conection.Open()
            DataAdapter.Fill(DataSet, "dbo.Users_Master")
            Conection.Close()

            If oDataAdapter.Fill(DataSet) > 0 Then
                [COLOR="DeepSkyBlue"]counter[/COLOR] = [COLOR="Red"]1[/COLOR]
            End If
            Return [COLOR="DeepSkyBlue"]counter[/COLOR]
        Catch ex As Exception
        End Try
    End Function
I know it looks weird, I tried to make it simple, but this is what I got. What you are doing here is:

1- Starting a function which will receive the IP of the user who is registering an account (up to you on how you will get it)
2- You start a variable (boolean -Yes,No-) counter which is the one who will tell you if you found the IP already on your database.
3- You use a SQL Query to compare that IP from the registering user against the IPs that are stored on your PS_UserData.dbo.Users_Master to try and find a match between them
4- Then you are storing the information you got from it (as boolean) to know if there was or not a match
5- You send back that information, then you will have to code what you are going to show if the IP had a match on your database (The user had already registered an account under that IP) and/or just let that registration go smoothly

Again, this might look weird, but that is where I would start if I had to do something like this; I am sure that there could be many other ways of doing this, and If i knew PhP properly I would've posted it, but unfortunately I don't know much about PhP
Ill try this out. And even if you dont know much ty for the attempt. Its greatly appreciated.
09/20/2011 22:49 JohnHeatz#5
That is a modified function I use while codeing on other languages (basically) what I did there was to simplify it, at least, by having that information you should be able to get the idea on what you need to do when you get it to PhP, because I use it on other languages when I have to do some "checking" for this kind of information to allow/forbid the income/outcome of information
09/20/2011 22:55 [DEV]xXDASHXx#6
must go inside the executing procedure tied into the account regestration page..

$ip = $_SERVER['REMOTE_ADDR']; // added attop with other defining info grabs the ip they useto fill out the regestration form

// check tosee if ip used to fill out form is regestered already thre the users details tabel. if so ends all execution and doenot creat the account
$ipcheck = @mssql_query("SELECT * FROM PS_UserData.dbo.Users_Detail WHERE RegesterdIP=('".$ip."')");

if(@mssql_num_rows($ipcheck) > 0){
die("The registering IP has already been used");
}else{



// how i use the regestration tostoredregesterd ips and est of my info i requier apone regestration

$query3 = mssql_query("INSERT INTO PS_UserData.dbo.Users_Detail (UserID,RealName,PwQuestion,PwAnswer,Email,Gender, JoinDate,RegesterdIP) VALUES ('".$userid."','".$realname."','".$passq."','".$pa ssa."','".$email."','".$gender."','".$date."','".$ ip."')");

you may need to change some info in the last section to have store in user details as mine is compleatly redone and new /deleated colums in my table.



if already have regesterd accounts without the ip being stored inside the details tabel can try

$ipcheck = @mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserIp=('".$ip."')");

if(@mssql_num_rows($ipcheck) > 0){
die("The registering IP has already been used");
}else{


that one asuming your db stores ips on login to game will tke any loged in account from the ip that i atempting to regester asumming it has been ued to log ingame and stop th regestration proces...

the only downfall i have foun to this is

1: same comp brother/sister /mom/dad/cusins and all the rest liveing in 1 home with 1 comp will be forced to share1singel account..

2: if get the funy glitch like i do and stores 1 ip for multiple accounts loging ingame from same modemyet difrent ips/comps wil cause yet another singel account abel to regester in the household
09/25/2011 01:15 -III-#7
I have released a method I use, primarily put together by Abrasive.

You can find it by [Only registered and activated users can see links. Click Here To Register...]