By
cookies and
session.
When you login to a website it stores a random string (example:
89d01edf48df6e4d26e8459104442f17) known as a session id on your web browser.
The session id is sent back to the website each time you visit a page on that website.
In addition the website also stores the session id with your user id that you login with on the server side.
Example might be:
89d01edf48df6e4d26e8459104442f17=ceecookie
8374f9fd1c2b734ad03b0fee59400e8a=ndmmxiaomayi