replaced text files with mysql database and added sessions