WordPress handles this for you by setting 2 cookies when you log in:
When you log into WordPress from http://example.com/wp-login.php, WordPress stores the following two cookies:
Your user name
A double-hashed copy of your password
WordPress uses the two cookies to bypass the password entry portion of wp-login.php. If WordPress recognizes that you have valid, non-expired cookies, you go directly to the WordPress Administration interface. If you don't have the cookies, or they're expired, or in some other way invalid (like you edited them manually for some reason), WordPress will require you to log in again, in order to obtain new cookies.
http://codex.wordpress.org/WordPress_Cookies
If you want to use the data else where with WordPress you can use the is_user_logged_in conditional statement:
<?php
if ( is_user_logged_in() ) { echo 'Welcome, registered user!';} else { echo 'Welcome, visitor!';};?>