$token = mysqli_real_escape_string($connect_bd, $_SESSION['token']);
$name = mysqli_real_escape_string($connect_bd, $_POST['name']);
$user = mysqli_prepare($connect_bd, "SELECT * FROM `bd_users` WHERE `token` = ? LIMIT 1");
mysqli_stmt_bind_param($user, "s", $token);
mysqli_stmt_execute($user);
$userArr = mysqli_fetch_array(mysqli_stmt_get_result($user), MYSQLI_ASSOC);
if ($userArr && !empty($name)) {
$userUpdate = mysqli_prepare($connect_bd, "UPDATE `bd_users` SET `name` = ? WHERE `id` = ?");
mysqli_stmt_bind_param($userUpdate, "si", $name, $userArr['id']);
mysqli_stmt_execute($userUpdate);
}
Content-Type: text/html; charset=iso-8859-1
Date: Thu, 18 Jan 2024 08:07:49 GMT
Location: https://domen.ru/lk/
Server: nginx
Strict-Transport-Security: max-age=31536000;
// static.domen/test.php
session_start([ 'cookie_domain' => 'domen', ]);
$_SESSION['key'] = 'value';
// domen/index.php
session_start();
print_r($_SESSION); // пустой массив
// static.domen/test.php
session_set_cookie_params(3600, '/', '.domen');
session_start();
$_SESSION['test'] = 'new test';