cookie function and views