IP History

[php]
$UserIpInfoSql = “SELECT * FROM ip_history WHERE user_name=’”.$UserInfo->user_name."’";
$UserIpInfoSqlQuery = $mysqli->query($UserIpInfoSql);
$UserIpInfo = $UserIpInfoSqlQuery->fetch_object();
$UserIpRows = $UserIpInfoSqlQuery->num_rows;
$UserIp = protect($_SERVER[“REMOTE_ADDR”]);
$Date = date(“M, jS (g:iA) Y”);

			if($UserIpInfo->user_ip == $UserIp){
				//No Update.
			}
			else {
              			if($stmt = $mysqli->prepare('INSERT INTO `ip_history` (`user_ip`,`user_name`,`logged_date`)VALUES(?, ?, ?)') or die($mysqli->error)) {
	    			$stmt->bind_param('sss', $UserInfo->user_name, $UserIp, $Date);
	   			$stmt->execute();
                			$stmt->error && die($stmt->error);
               	 		$stmt->close();
             	 		}
			}

[/php]

I need to the if to check all the users ips entered in the db.

Can anyone help or need a better explanation?

Sponsor our Newsletter | Privacy Policy | Terms of Service