S
S
s2sk13372017-11-28 19:30:55
PHP
s2sk1337, 2017-11-28 19:30:55

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);
?>


Console
500 (Internal Server Error)

At the same time, if you go to the page / reg through the browser, then everything works fine.

ozoOEnc.png

Displays bot t to the user did not pass the test for a bot ... I already tried with GET to POST ... Still, there is no sense ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2017-11-28
@Sanes

Look at the logs, this error should be written there. If the server is given.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question