improved ajax php interface, prepared statements, and misc.