Need to access $user_ID

I need to access the $user_ID in a non-WP php script. How can I set the value of $user_ID to a session variable or a cookie when a user logs in?