Fixing the bugs in ze codez

1. database disconnect after every query
2. adding session check on add/edit/delete pages
3. checking if user has logged in on the start page of cms