add exist fuction

add a function to check if a cookie exists.