Jump to content


MSSQL 2000 IP loger to check for 2x regster IP


4 replies to this topic

#1 Ace-SG1-

    Young Padawan

  • Members
  • Pip
  • 17 posts
  • Location:USA, Hawaii

Posted 06 December 2006 - 05:38 PM

Hi, is there a way to check MSSQL DB to look for if that players IP is allready in the DB? something liike a Email checker or username (need thos too)?? its for a regster site for a game....

so like if a player makes 1 username, than 1week later makes a new username. The new user name is block saying that the IP is allready regstered in the DB.

THX!!

#2 dEcade

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 1,850 posts
  • Gender:Male
  • Location:Saskatoon, Saskatchewan
  • Interests:Guitar, Programming, Storm Chasing, Games (Designing and playing), Hockey, Photography

Posted 06 December 2006 - 07:20 PM

Yes there is. The easiest way is to use PHP so after they register it runs a sql script and checks. So something like this:

<?php
$ip_var   =   $_SERVER["REMOTE_ADDR"];
$sql		=	mysql_query("SELECT * FROM table_name WHERE ip='$ip_var'");
if($sql > 0)
{
	// IP is already there
}
else
{
	// IP is not in database.
}
?>

Should be something like that.

dEcade

Edited by dEcade, 06 December 2006 - 07:21 PM.


#3 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 06 December 2006 - 07:40 PM

Of course then you should obviously have the user's IP in the database to begin with.

And dEcade, he's using MSSQL, so your function would be changed.
I don't know much if there is a difference with MSSQL and MySQL, but I would assume there is hardly much in terms of using commands.
$ip_query = mssql_fetch_row(mssql_query("SELECT COUNT(*) FROM `members` WHERE `ip` = '{$_SERVER['REMOTE_ADDR']}' LIMIT 1"));

if($ip_query[0] > 0){
// IP Found, Terminate Subscription
}
else{
// No IP Found, Continue
}


#4 dEcade

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 1,850 posts
  • Gender:Male
  • Location:Saskatoon, Saskatchewan
  • Interests:Guitar, Programming, Storm Chasing, Games (Designing and playing), Hockey, Photography

Posted 06 December 2006 - 08:07 PM

lol sorry about using the mysql function didn't read it good enough just glanced at it and assumed it was MySQL.

dEcade

#5 Ace-SG1-

    Young Padawan

  • Members
  • Pip
  • 17 posts
  • Location:USA, Hawaii

Posted 06 December 2006 - 08:59 PM

sweet ty





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users