Answer the question
In order to leave comments, you need to log in
"Eternal" sessions in PHP. Will the server survive?
Good afternoon.
Initial conditions:
1. There is a Raspberry Pi minicomputer with Apache (LAMP) installed
2. There is an authorization page using Ajax and JS with a "remember me" function.
3. The number of registered users will not exceed 10.
4. The number of simultaneous accesses to the page - no more than 3.
I want to stop using Cookies for the "Remember me" function in favor of the session, while making them "eternal". This is due to the fact that without additional dances with tambourines, some problems arise with cookies, so I want to store such information on the server.
Prompt, whether the similar solution will overload the server under the above conditions?
Answer the question
In order to leave comments, you need to log in
How do you think sessions work in PHP? All through the same Cookies, the session identifier is simply stored in the Cookie, and the data is stored on the server in the file system (by default, but the behavior can be changed). Will survive.
Read first how sessions are organized in PHP php.net/manual/ru/intro.session.php
You can get by with a simple check:
Two cookies, one for the user ID and the other for the session. You
can check this stuff like this: (this is just an example)
function session()
{
@$i = $_COOKIE['account'];
@$h = $_COOKIE['hash'];
if (!empty($i) && int_($i) && !empty($h) && $h === hash('sha1', $i . SLAT, false))
return (int)$i;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question