Do I usually use cookies or sessions to write login. php? I don't know which one to choose. Can you tell me what you use? ------ Solution ------------------ SESSION ------ solution -------------------- SESSION security, high pressure on servers. ------ Solution ------------------ do you usually use cookies or sessions to write login. php?
I don't know which one to choose.
Can you tell me what you use?
------ Solution --------------------
SESSION
------ Solution --------------------
SESSION Security puts a lot of pressure on servers.
------ Solution --------------------
The session is better !!!
------ Solution --------------------
Important Information uses sessions, such as logon information.
The server segment is running and memory is occupied during the session status. When it is disabled, the memory is released.
Due to the small amount of information, session is generally used for security considerations.
Cookies for non-important information
------ Solution --------------------
Session
------ Solution --------------------
Session is good. cookies are mainly used on clients. they are not good and dangerous.
------ Solution --------------------
Session is not a very popular website.
Will not reflect the pressure on the server
------ Solution --------------------
Hybrid use
Using cookies to control the time of refreshing sessions ensures security and does not put pressure on the server.
------ Solution --------------------
Occasionally use session, without cookie.
------ Solution --------------------
We can use cookies to simulate sessions and encrypt data in some way.
$ Chkcode = md5 ($ row ['id']. $ row ['username']. $ activetime. $ ['auth _ Code']);
Setcookie ("member_id", $ row ['id'], null, "/", null );
Setcookie ("username", $ row ['username'], null, "/", null );
Setcookie ("activetime", $ activetime, null, "/", null );
Setcookie ("chkcode", $ chkcode, null, "/", null );
------ Solution --------------------
SESSION is an application of COOKIE.
It is easier for medium and small sites to directly use sessions for big sites and multi-sites. the COOKIE is better.
------ Solution --------------------
"SESSION is a COOKIE application and cannot be equivalent to a comparison"
For session, there are three methods to save the client id: 1. cookie 2.url 3. hidden field
Cookie is one of the containers of a session.
In contrast, the session is highly secure because it is stored on the server.
To ensure high security, you must encrypt/decrypt the data.
Session stores a large amount of data. of course, this also consumes resources on the server, and the maximum size of cookie data stored is 4 kB.
------ Solution --------------------
Even session