123456789101112131415161718192021222324252627282930313233 |
- <?php
- session_start();
- $host = "blueris.beget.tech";
- $username = "blueris_base";
- $password = "Qwer123.";
- $database = "blueris_base";
- $mysql = new mysqli($host, $username, $password, $database);
- if($mysql->connect_error){
- die("Ошибка подключения". $mysql->connect_error);
- }
- $user = $_POST['login'];
- $pass = $_POST['password'];
- $quary = "SELECT * FROM login WHERE login like'$user' AND password like '$pass'";
- $result = mysqli_query($mysql, $quary);
- $row = mysqli_fetch_assoc($result);
- $id = $row['id_user'];
- $userpass = $row['password'];
- $userlogin = $row['login'];
- if (mysqli_num_rows($result) > 0) {
- setcookie('id', $id, time() + 3600, 'session');
- $_SESSION['login'] = $userlogin;
- $_SESSION['password'] = $userpass;
- echo "<script>window.location.href = 'index.php';</script>";
- }
- else {
- header('Location: formLogin.php?message=Неверные+данные');
- }
- ?>
|