Fixed couple of errors majority is functions that communicated with database, others is checking cookie ID