123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- $host = "provalgk.beget.tech";
- $username = "provalgk_user";
- $password = "Qwer123.";
- $database = "provalgk_user";
- $pass = $_POST["password"];
- $mysql = mysqli_connect($host, $username, $password, $database);
- // Проверка соединения
- if($mysql->connect_error){
- die("Ошибка подключения". $mysql->connect_error);
- }
- // Получение данных пользователя из базы данных
- session_start();
- if (isset ($pass))
- if (isset ($_SESSION['id']))
- $user_id = $_SESSION['id'];
- $userpass = $_SESSION['password'];
- if($userpass == $pass)
- {
- header('Location: PasswordChange.html?message=Пароли+совпадают');
- echo "<script>window.location.href = 'PasswordChange.html';</script>";
- }
- else{
- $query = "UPDATE Login SET password = '$pass' WHERE id_user = $user_id";
- if($res = mysqli_query($mysql, $query))
- {
- $_SESSION['password'] = $pass;
- echo "<script>window.location.href = 'UserAccount.html';</script>";
- }
- }
- ?>
|