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!!
MSSQL 2000 IP loger to check for 2x regster IP
Started by Ace-SG1-, Dec 06 2006 05:38 PM
4 replies to this topic
#1
Posted 06 December 2006 - 05:38 PM
#2
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:
Should be something like that.
dEcade
<?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
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.
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
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
dEcade
#5
Posted 06 December 2006 - 08:59 PM
sweet ty
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
