Ternary is not big or clever. Generally its just makes things more complicated than they need to be. In fact here it’s totally redundant.
Code: Select all
$check = (strpos(filesize($fr)) == $ip) ? true : false;
is a superfluous way of saying
Code: Select all
$check = strpos(filesize($fr)) == $ip;
EDIT: Just noticed that was what you were doing before, which was quite correct
I am using the IP to track unique visits
A whole building (picture a 70 storey skyscraper) can be connected to the internet via a single IP. Other users, with dynamic IPs, could visit your site 3 different times with 3 different IPs.
"So what is the best why to record unique visits ole?", Sadly there is no perfect solution. Cookies combined with sessions are reasonable. Cookies are susceptible to user's clearing or disabling cookies.