currently im using session to log in the user. but when i close the browser and open it again i have to log in again. how do you keeo the user logged in in lets say 2 weeks.
Yes. You use cookies to implement the "auto login" (or "remember me") functionality.
This google search or SO search results, should point you to a right direction.