Answer the question
In order to leave comments, you need to log in
AJAX 500 Error?
Hello everyone... Here, just like that, an error 500 began to appear with an AJAX request... I don’t know what it could be connected with, it didn’t happen before... It appeared on its own...
$.ajax(
{
url: "/reg",
type: "GET",
data: (
{
password: $("#r_password").val(),
login: $("#r_login").val(),
firstname: $("#r_firstname").val(),
lastname: $("#r_lastname").val(),
grecaptcharesponse: grecaptcha.getResponse()
}
),
dataType: "TEXT",
success: ShowUserErrorReg
}
);
<?php
if(IsUserBot($_GET["grecaptcharesponse"]))
exit('bot');
$login_exist = mysqli_query($connect, "SELECT `id` FROM `users` WHERE `login` = '$_GET[login]' LIMIT 1");
if($_GET["firstname"] == "" || IsValidSrt($_GET["firstname"], NUMERAL_NOT_VALID_STR) || strlen($_GET["firstname"]) > MAX_USER_DATA)
exit('fn');
else if($_GET["lastname"] == "" || IsValidSrt($_GET["lastname"], NUMERAL_NOT_VALID_STR) || strlen($_GET["lastname"]) > MAX_USER_DATA)
exit('ln');
else if($_GET["login"] == "" || IsValidSrt($_GET["login"], DEFAULT_NOT_VALID_STR) || strlen($_GET["login"]) > MAX_USER_DATA)
exit('l');
else if(mysqli_num_rows($login_exist))
exit('l_exist');
else if($_GET["password"] == "" || strlen($_GET["password"]) > MAX_USER_DATA)
exit('p');
$password = password_hash($_GET["password"], PASSWORD_BCRYPT);
$query = mysqli_query($connect, "INSERT INTO `users` (`firstname`, `lastname`, `login`, `password`, `music_list`, `avatar_url`) VALUES ('$_GET[firstname]', '$_GET[lastname]', '$_GET[login]', '$password', '', 'img/default_avatar.png')");
setcookie("login", encode($_GET["login"], KEY), time()+60*60*24*30, "/", URL_SITE, COOKIE_HTTPS);
setcookie("password", encode($password, KEY), time()+60*60*24*30, "/", URL_SITE, COOKIE_HTTPS);
?>
500 (Internal Server Error)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question