coded up php file read and write, still buggy