Help! I don’t know why this isn’t working. I’m trying to log an ip in a database and retrieve it along with a integer. All it has been doing is logging 0 as the ip and 0 as the integer.
[php] $data = mysql_query(“SELECT ip,points FROM information”)
or die(mysql_error());
if (isset($_SERVER[“HTTP_X_FORWARDED_FOR”])) {
$ip = $_SERVER[“HTTP_X_FORWARDED_FOR”];
} else {
$ip = $_SERVER[“REMOTE_ADDR”];
}
while($info = mysql_fetch_array( $data ))
{
if($info[‘ip’] != null && $info[‘ip’] == ‘ip2long($ip)’){
Print “You have $info[points] points!”;
break;
}
if($info[‘ip’] != null && $info[‘ip’] != ‘ip2long($ip)’){
mysql_query(“INSERT INTO information VALUES (‘INET_ATON($ip)’,‘0’)”);
Print “You have 0 points!”;
break;
}
}[/php]