Jump to content
MakeWebGames

IP's


MafiaHeros

Recommended Posts

So i'm trying to fix that only 1 IP per account is allowed to create an account, yet players are still able to create accounts on the same ip...

I have added this to register.php

 $checkip = mysql_query("SELECT * FROM `grpgusers` WHERE `signupip` = '".$ip."");
 $ip = $_SERVER['REMOTE_ADDR'];
 $ip_exist = mysql_num_rows($checkip);
 if($ip_exist > 0) {
  $message = "That IP is already being used for an account on MafiaHeros.";
 }

 

Anyone know what i'm doing wrong?

Link to comment
Share on other sites

Set it like this and its still not working

 

 $ip = $_SERVER['REMOTE_ADDR'];
 $checkip = mysql_query("SELECT * FROM `grpgusers` WHERE `signupip` = '".$ip."'");
 $ip_exist = mysql_num_rows($checkip);
 if($ip_exist > 0) {
  $message = "That IP is already being used for an account on MafiaHeros.";
 }

Link to comment
Share on other sites

Well yeah you will need to place it somewhere where you can see it!! or view the source code will probably show in there.

However looking at the code you have your only

if( ip exists){ show this message }

carry on....

There is no exit from the code so it would just continue anyway.

Link to comment
Share on other sites

Allright, it works now. Thanks for the help :)

This worked:

 

$ip = $_GET['REMOTE_ADDR'];
$checkuser2 = mysql_query("SELECT * FROM `grpgusers` WHERE `ip`='$ip'");
$ip_exist2 = mysql_num_rows($checkuser2);

 if($ip_exist2 > 0){
  $message = "<div>Your IP is already being used by another account on MafiaHeros.</div>";
 }

if (isset($message)) {
echo Message($message);
}
Edited by MafiaHeros
Forgot a line
Link to comment
Share on other sites

because it's not $_GET[''REMOTE_ADDR']; but $_SERVER!

 

$ip = $_SERVER['REMOTE_ADDR'];
$checkuser2 = mysql_query("SELECT * FROM `grpgusers` WHERE `ip`='$ip'");
$ip_exist2 = mysql_num_rows($checkuser2); 
if($ip_exist2 > 0)
{
    $message = "<div>Your IP is already being used by another account on MafiaHeros.</div>";
 }
if (isset($message))
{
echo Message($message);
}
Link to comment
Share on other sites

confused about this bit

if($ip_exist2 > 0)

{

$message = "<div>Your IP is already being used by another account on MafiaHeros.</div>";

}

try

if ($ip_exist2 == $ip)

{

$message = "<div>Your IP is already being used by another account on MafiaHeros.</div>";

}

Link to comment
Share on other sites

$ip = $_SERVER['REMOTE_ADDR'];
$checkIP = mysql_query('SELECT `ip` FROM `grpg_users` WHERE (`ip` = "'.$ip.'")'); //Guessing the ip is stored as a string, theres functions for storing IP addresses you know.
if (mysql_num_rows($checkIP) == 1) {
   echo 'IP exists, blah'
   exit;
}

//Continue on.
mysql_query('INSERT INTO `grpg_users` ( ... ) ( ... )');

-Scratch, nevermind did not see page two.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...