I just got in touch with PHP for less than 3 months, and I got a noob ..... the trial website uses SESSION to keep SESSION calls. without closing the browser, I manually delete all cookie files on the client and refresh the website, found that the account is logged on... what's going on? As often as I do... I just got in touch with PHP for less than 3 months, and I got a noob ..... the trial website uses SESSION to keep SESSION calls. without closing the browser, I manually delete all cookie files on the client and refresh the website, found that the account is logged on... what's going on?
Some websites that I usually use usually exit the logon status as long as the cookies are cleared...
The following is the problem Code of the younger brother. please kindly advise me ..
Page A for processing login code
// Log on successfully. keep the logon status function login_true ($ username) {session_start (); $ _ SESSION ['userinfo'] = array ('uid' => 476283675, 'username' => $ username );}
Page B of the logon page is displayed.
/* If $ _ SESSION ['userinfo'] or $ _ SESSION ['userinfo'] ['uid'] is EMPTY *, it indicates that no logon is performed, bootstrap user logon */session_start (); if (empty ($ _ SESSION ['userinfo']) or empty ($ _ SESSION ['userinfo'] ['uid']) {echo "click my logon"; die ('log on first ');} echo 'good evening ';
After the cookie file is cleared, the logon status remains unchanged. what is the problem?
Reply content:
I just got in touch with PHP for less than 3 months, and I got a noob ..... the trial website uses SESSION to keep SESSION calls. without closing the browser, I manually delete all cookie files on the client and refresh the website, found that the account is logged on... what's going on?
Some websites that I usually use usually exit the logon status as long as the cookies are cleared...
The following is the problem Code of the younger brother. please kindly advise me ..
Page A for processing login code
// Log on successfully. keep the logon status function login_true ($ username) {session_start (); $ _ SESSION ['userinfo'] = array ('uid' => 476283675, 'username' => $ username );}
Page B of the logon page is displayed.
/* If $ _ SESSION ['userinfo'] or $ _ SESSION ['userinfo'] ['uid'] is EMPTY *, it indicates that no logon is performed, bootstrap user logon */session_start (); if (empty ($ _ SESSION ['userinfo']) or empty ($ _ SESSION ['userinfo'] ['uid']) {echo "click my logon"; die ('log on first ');} echo 'good evening ';
After the cookie file is cleared, the logon status remains unchanged. what is the problem?
Use the clear button that comes with the browser.
By default, the cookie is cleared successfully, and the sessionid stored in the cookie is no longer available. when a session is requested to the backend session mechanism, the sessionid cannot be obtained to obtain information from the corresponding session file. I don't know which loop is handling exceptions. Cookie not cleared? Is sessionid included in the request body in other forms?
A session stores a session by passing the session_id value during each request. There are two transmission methods: one is through cookies carried by each request, another method is to pass through the url. if you set cookies in php, the server will automatically generate a new session_id as long as the original cookies under the corresponding domain name are deleted, that is, the original session is lost. As for your problem, I think the deletion method is incorrect. since it is a developer, use the browser's opener tool, all cookies under the current domain name can be displayed or deleted. In addition, chrome is recommended for browsers!