Just started the introduction session) Write it in the following way. Data is used in the personal Cabinet.
$userId = User::checkUserData($email, $password);
public static function auth($userId)
$_SESSION['user'] = $userId;
The first time after entering the personal Cabinet, all works perfectly. But after about 30 minutes of use the personal Cabinet, the following occurs: javascrtipt on the page works successfully, but user not saved in the database.
Only after reboot it becomes apparent that an error occurred and the data entered by the user is not preserved. Tell me how to avoid such mistakes? How to extend session time, so that the user can open the same page through the day (if you have not closed the browser) and to enter data without re-entry to the personal account? Or somewhere need to save session data? I will be grateful for the answer =)