lots of updates. moving to mysqli. added logout