cookie function written for remembering login