No, don't think so. A txt-file is a dumb file, and the only way to prevent others from reading it is to change the file perms.
And then php won't be able to read it either 😉
But you could put the txt-file outside your webdirectory, and open it with fopen("../username.txt", "r")
Php is not limited to your web-dir, but the surfers are 😉
knutm