$file="status"; $fh=fopen($file, "w+"); if($foo=="foo"){ $status="Online"; fwrite($fh, $status); fclose($fh); }