<?php
session_start()
?>
<?php
include '../php/base.php';
$login = $_POST['login'];
$password = $_POST['password'];
mysqli_query($connection, "INSERT INTO `users` (`id`, `login`, `password`) VALUES (NULL, '$login', '$password')");
$user = mysqli_query($connection, "SELECT * FROM `users` WHERE `login` = '$login'");
$user = mysqli_fetch_assoc($user);
$_SESSION['user'] = $user['login'];
?>
<main>
<?php
$products = mysqli_query($connection, "SELECT * FROM `news`");
$products = mysqli_fetch_all($products);
foreach ($products as $product) {
?>
<div class="container_main">
<div class="item_main" id="itm1">
<h1><?= $product[0]?></h1>
<h1><?= $product[1]?></h1>
<p><?= $product[2]?></p>
</div>
</div>
<?php
}
?>
</main>