If you want to write the info if it is not contained in the file, you need to change
strpos(file_get_contents("recent.txt"),$write) !== false
to
strpos(file_get_contents("recent.txt"),$write) === false
!== false
means that the file contents do contain the user you were looking for. It would return false
if the string was not found.
Additionally, you may want to add a call to isset()
to check if $_GET['user']
is actually set.
And depending on how large you expect this file to get, using a database to do this may be a much better (more efficient) option.