I am building a weak chat system, more like a tag board, and it has a simple user system. When the user loads the tagboard, it reads the cookie and writes their username to file, and when they log out, it loads the users.txt file and replaces their username with a null string. But whenever I log out, it writes to file a seemingly random number less than 10.
<?
//Log out
if($un!=""){
$f=readfile("users.txt");
$f=str_replace("$un","",$f);
$fID=fopen("users.txt","w");
fwrite($fID,$f);
fclose($fID);
}
?>