In this line:
$unique = array_unique($ip);
you're passing a scalar value to a function that takes an array. If you don't get an error message for that, it means you have error reporting turned off, at least partially. Not the best way to solve code problems.
Try using file() to put the file's lines into an array (e.g. "$file_array"), then check to see if "$ip" is in that array. You can set "$unique" to the value returned by "in_array($ip, $file_array)".
I'm stumped on this line:
$new = fread($fp, filesize("counter.txt"));
Why are you reading, from "hits.txt", the number of bytes in "counter.txt"? And how will that give you a count of site visitors?
If you count the elements in the array returned by "file()" you'll have the number of unique ip visitors.