The log in and logout is depends upon session management. When a user logged in ,then a session(A object) is created for that user . That same user when loggs out ,destroys the session(it is done autometically, through code).In between log in and logout everything can be stored in the "Session" object and can be used latter on.
in your apex class u need to add either in controller or any method.
public username {get,set}
public password {get,set}
Site.login(username,password);
String userinfo=Site.userInfo();
userinfo will be having current logged in user details
for logout add the below code in your apex page
<a href="{!$Site.Prefix}/secur/logout.jsp">logout</a>
The log in and logout is depends upon session management. When a user logged in ,then a session(A object) is created for that user . That same user when loggs out ,destroys the session(it is done autometically, through code).In between log in and logout everything can be stored in the "Session" object and can be used latter on.
if it helps .Pleases mark it.
Regards
Swagata