Comparing strings with strpos
I don't think your approach is really good:
1) It is not really good to write to a single file from multiple requests, because the looking of the file might decrease the performance of your script. Don't you have access to any database system?
2) Do you have any account system on your page? If yes, I would prefer to restrict a second vote based on the account rather than on the IP address.
3) What do you do when you start a second poll? Create a second file?
4) fread($fh, 200)
: What happens if you have 100 locked users (IPs)? Your script only reads the first 200 bytes.
5) if($pos == true)
: I really don't like relying on the autocasting "feature" of PHP. You are expecting FALSE
or a number so check for FALSE
and >= 0
.