Added function to check cookie

If an user is logged in and he refresh the page, he will be redirected
to User Panel