Simple query this
$sql = "SELECT * FROM table WHERE page_id=$page AND ip='$ip'":
$result=mysql_query($sql);
if (mysql_num_rows($result) == 0) {
// do the insert
} else {
// do the other thing
}
Now, the big problem with this is that ip addys are not tied to specific computers or people. Everyone here where I am is surfing through our proxy and your server will see the same IP, and at home they will be behind their ISPs proxy and probably gets a dynamic IP when they connect so their IP will vary. Bit difficult to track users when that is going on.
MAC addresses would work for tracking computers, except that there is no way to get at it through http. Java applet would work except that the user would have to allow your applet to execute and most people would not. Most people would view that as spyware and their desktop firewall should block that level of snooping anyway.