ALWAYS check the return value from open(); you're inconsistent in your error checking
You use local when you mean my in the error routine.
You slurp the file rather than reading line by line (granted that if you get to point that that would be an issue you'd really want a real database anyhow . . .)
You don't do any sort of file locking to guarantee that you don't clobber the database if multiple people hit simultaneously (or close enough to simultaneously)