Do not log in to WordPress, when you open a webpage, this page can not be edited.
Now, I login to WordPress, and then re-refresh the page just now, found that can be edited.
Excuse me, what happened in this process?
Reply content:
Do not log in to WordPress, when you open a webpage, this page can not be edited.
Now, I login to WordPress, and then re-refresh the page just now, found that can be edited.
Excuse me, what happened in this process?
You lose the right user name and password, the server will put an identity in your browser, and then you visit the server according to this identity know "Oh!" You're the one who lost the right password! ", so I'll show you the page you can edit.
Add:
Pop... The first time you see something that you don't understand, you ask for more terminology, okay?
WordPress According to what know you can edit?
Depending on your sign-in status.
How does it know you are logged in?
When you log in, the login form sent to the server program, the program from the database to remove the user and verify the password, the correct words will be placed in the user's ID session
, every time you visit because there is a session in, the server knows you are logged on users, has the right to edit.
How does the session work?
http
The protocol is non-connected, stateless ( websocket
not counted), you each time 请求
an address, the server 响应
ends, the entire HTTP service process is over, the next time you visit, the server does not know you are not just that person. So why does the session know?
A session is a data structure maintained by the service-side program that distinguishes the user from successful login. When you log in successfully, the server will put one in your browser cookie
, which records a sessionid
, when you visit again, the browser will bring this cookie to the server, the service-side program according to the SessionID, you know which session is open for you, You can access the data from it.
As if, the server for each user opened a safe, service side although do not know who to open the cupboard, but as long as he with the key, he opened the corresponding safe.
What is a cookie?
Cookies are some of the data that the server stores in the browser during the request-response process, and they are very short. Cookies are stored when they visit which domain name they are accessing, so when the domain name is accessed again, the cookie is carried to the server and the server can read the data it placed in the browser.
In simple terms, that's it.
Determine if you can have edit permissions based on login status
Since the landlord is under PHP asked me a little more detailed, generic cookie-based session:
1, the first time to open a General PHP program page, the server will generate an identity (session_start);
2, then the server through the HTTP request Set-cookie set to your browser, is generally phpsessid;
3. When you send the request to the server again, your browser will bring this cookie information and the server can read the session through this cookie.
4, login, the server will be the user name, in the database to find your user information, saved in the session;
5, after all the other requests on the server side can be read through the session of your user information-the session has been kept;