Counting unique viewers?

You have to take into consideration the ISPs who force user requests
through their proxy servers. Those users will appear to have the same
IP address a lot of the time, AOL users for example. I usually go
with checking that the UP address isn't new in the last 24 hours or
so, since dial up users stand a good chance of getting assigned a
different proxy their next session.

If you're using MySQL I wouldn't store raw IP addresses. That will
cost you a varchar(15) field which may be up to 16 bytes. Instead
convert the IP to a signed integer before storing it. That will only
cost you 4 bytes, until ipv6 gets more love anyway.

def ip2long( ip )
  long = 0
  ip.split( /\./ ).reverse.each_with_index do |x, i|
    long += x.to_i << ( i * 8 )