<?php
/*ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);*/
$connect = mysqli_connect("localhost", "", "") or die('Не удалось подключиться');
mysqli_select_db($connect, "");
session_start();
$email = $_POST['email'] ;
$login = $_POST['login'];
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$tel = $_POST['tel'];
$id = $_POST['id'];
if (isset($_POST['submit-reg'])) {
$query = mysqli_query($connect, "SELECT id FROM users WHERE login='$login' LIMIT 1,1");
$fetch = mysqli_fetch_array($query);
if ($fetch == 0) {
$fill = mysqli_query($connect, "INSERT INTO users (id,tel,email,login,password) VALUES ('','$tel
email','$login','$password')");
$arr = array('$login','$tel','$email');
echo "<div style='color:green; font-family: 'Lobster', cursive;'><p style='margin:0; display:inline-block;'>Добро пожаловать,</
p>".$login."<p style='margin:0;display:inline-block;'>!</p></div>";
$_SESSION['logged_user'] = $arr;
}
}elseif ($fetch != 0) {
echo "<div style='color:red; font-family: 'Lobster', cursive;'>"."<p style='margin:0;'>Пользователь с таким именем уже существует!
p>"."</div>";
}
}
?>