Здравствуйте. Пишу регистрацию, вроде все сделал, а данные в базу данных не заносятся. Второй день не могу понять из-за чего.
register.php
<?php
require ('../settings/config.php');
$fn = $_GET['fn'];
$ln = $_GET['ln'];
$email = $_GET['email'];
$pass = $_GET['pass'];
$query = 'SELECT * FROM users WHERE Email="'.$email.'"';
$result = mysqli_query($con,$query);
$user = mysqli_fetch_assoc($result);
//$password = md5($pass);
if(count($users) == 0)
{
$result = mysqli_query($con,"INSERT INTO `users`(`Email`, `Password`, `SurName`, `LastName`, `Balance`, `Admin`, `Moder`, `theme`, `Avatar`) VALUES ('$email','$pass','$fn','$ln','0','0','0', 'dark', '/engine/img/avatars/0.png')");
mysqli_close($con);
die('YES');
exit();
} else
die('#Ошибка На данный момент регистрация закрыта!');
exit();
?>
Основная регистрация
<?php
require ("check/settings/config.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo $panelname;?> | Магазин скриптов для вашего проекта</title>
<!-- Custom fonts for this template-->
<link href="/engine/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel="stylesheet">
<!-- Custom styles for this template-->
<link href="https://panel.sagms.site/engine/includes/css/sb-admin-2-dark.min.css" rel="stylesheet">
<link rel="stylesheet" href="/engine/dist/simple-notify.min.css" />
<script src="/engine/dist/simple-notify.min.js"></script>
<style>
.bg-login-image {
background: url(/pages/img/fw.jpg);
background-position: center;
background-size: cover
}
.bg-register-image {
background: url(/pages/img/fw.jpg);
background-position: center;
background-size: cover
}
.bg-password-image {
background: url(/pages/img/fw.jpg);
background-position: center;
background-size: cover
}
::-webkit-scrollbar{width:3px}
::-webkit-scrollbar-thumb{background:#FFFFFF;border:none;border-radius:0;opacity:.2}
::-webkit-scrollbar-track{background:#424242;border:none;border-radius:0}
::-webkit-scrollbar {
width: 8px;
height: 5px;
background-color: #48494D;
}
::-webkit-scrollbar-thumb {
background-color: #686868;
}
::-webkit-scrollbar-thumb:hover {
background-color: #4A4A4A;
} </style>
</head>
<body class="bg-gradient-primary">
<div class="container">
<div class="card o-hidden border-0 shadow-lg my-5">
<div class="card-body p-0">
<!-- Nested Row within Card Body -->
<div class="row">
<div class="col-lg-5 d-none d-lg-block bg-register-image"></div>
<div class="col-lg-7">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">Регистрация</h1>
</div>
<form id="regform" class="user">
<div class="form-group row">
<div class="col-sm-6 mb-3 mb-sm-0">
<input type="text" class="form-control form-control-user" id="exampleFirstName"
placeholder="Имя" name="fn">
</div>
<div class="col-sm-6">
<input type="text" class="form-control form-control-user" id="exampleLastName"
placeholder="Фамилия" name="ln">
</div>
</div>
<div class="form-group">
<input type="email" class="form-control form-control-user" id="exampleInputEmail"
placeholder="Электронная почта" name="email">
</div>
<div class="form-group row">
<div class="col-sm-6 mb-3 mb-sm-0">
<input type="password" class="form-control form-control-user"
id="exampleInputPassword" placeholder="Пароль" name="pass">
</div>
<div class="col-sm-6">
<input type="password" class="form-control form-control-user"
id="exampleRepeatPassword" placeholder="Повтор пароля">
</div>
</div>
<button class="btn btn-primary btn-user btn-block" onclick="myFunction()">Зарегестрироваться</button>
</form>
<hr>
<div class="text-center">
<a class="small" href="/pages/authorization.php">Авторизация</a> <div class="text-center">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="/engine/vendor/jquery/jquery.min.js"></script>
<script src="/engine/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="/engine/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="/engine/js/sb-admin-2.min.js"></script>
<script>
function myFunction()
{
var fn = document.getElementById("exampleFirstName").value;
var ln = document.getElementById("exampleLastName").value;
var email = document.getElementById("exampleInputEmail").value;
var pass = document.getElementById("exampleInputPassword").value;
var rpass = document.getElementById("exampleRepeatPassword").value;
if(fn < 3 || ln < 3 || email < 8 || pass < 8 || rpass < 8)
{
new Notify ({
title: 'Ошибка',
text: "Необходимо заполнить все поля!",
status: 'error',
autoclose: true,
autotimeout: 2000
})
event.preventDefault();
return false;
}
if(pass != rpass)
{
new Notify ({
title: 'Ошибка',
text: "'Введенные вами пароли не совпадают!",
status: 'error',
autoclose: true,
autotimeout: 2000
})
event.preventDefault();
return false;
}
$("#regform").on('submit', function(e) {
e.preventDefault();
$.ajax({
type:'GET',
url: '/pages/check/profile/regestration.php',
data: $('#regform').serialize(),
cache: false,
success: function(data) {
if (data.search('#Ошибка') != -1) {
data = data.replace('#Ошибка', '');
new Notify ({
title: 'Ошибка',
text: data,
status: 'error',
autoclose: true,
autotimeout: 1500
})
event.preventDefault();
return false;
}
else if (data == '#Флуд') {
new Notify ({
title: 'Ошибка',
text: 'Вы можете зарегистрироваться только через 2 минуты!',
status: 'success',
autoclose: true,
autotimeout: 1500
})
}
else if (data == 'YES') {
new Notify ({
title: 'Успешно',
text: 'Вы успешно зарегистрировались!',
status: 'success',
autoclose: true,
autotimeout: 1500
})
setInterval(() => {
window.location = "/pages/authorization.php"
}, 1550);
}
}
});
});
}
</script>
</body>
</html>
Поключение к БД
<?php
$con = mysqli_connect('135.181.177.214','gs16241' '',' ');
$panelname = "FIREWORK GAMES";
$vklink = "vk.com/firework_games";
$sitelink = 'https://arz-firework.ru';
?>