httprequest to php login system I'm trying to make a login system for my website which I'll be releasing in public later on. I have inserted some main samples of my code in here and I would like some useful advise or suggestions. Also if I'm doing anything unsafe or anything which may cause problems in future please let me know. Thanks

login.inc.php:

&lt;?php
    error_reporting(0);
    $error_message = "Website ran into an error";
    session_start();
    if (isset($_SESSION['user_id'])) {
        exit();
    }
    $parameters = json_decode(file_get_contents('php://input'), true);

    if (isset($parameters["inserted_id"]) &amp;&amp; isset($parameters["inserted_password"])) {
        // FOR TEST USE I'M USING xampp server, localhost
        $connection = mysqli_connect("localhost", "root", "", "users") or die($error_message);
        $inserted_id = $parameters['inserted_id'];
        $inserted_password = $parameters['inserted_password'];

        $statement = mysqli_stmt_init($connection) or die($error_message);
        if (mysqli_stmt_prepare($statement, "SELECT id, account_name, password FROM user WHERE account_name=? OR email=?;")) {
            mysqli_stmt_bind_param($statement, "ss", $inserted_id, $inserted_id);
            mysqli_stmt_execute($statement) or die($error_message);
            if (($row = mysqli_fetch_assoc(mysqli_stmt_get_result($statement))) == null) {
                echo("No records found with inserted inputs");
                mysqli_stmt_close($statement);
                mysqli_close($connection);
                exit();
            } else {
                if (password_verify($inserted_password, $row['password'])) {
                    $_SESSION['user_id'] = $row['id'];
                    $_SESSION['account_name'] = $row['account_name'];
                    echo("pass");
                } else {
                    echo("Wrong password");
                }
                mysqli_stmt_close($statement);
                mysqli_close($connection);
                exit();
            }
        }
        mysqli_close($connection);
        exit();
    }
?&gt;


login.js:

var request_sent = false;
document.querySelector("button").onclick = function () {
  if (!request_sent) {
    var inserted_id = document.getElementById("inserted_id").value;
    var inserted_password = document.getElementById("inserted_password").value;
    if (inserted_id == "" || inserted_password == "") {
      alert("Both fields need to be filed out");
    } else {
      request_sent = true;
      http_request("login.inc.php", JSON.stringify({"inserted_id":inserted_id, "inserted_password":inserted_password}));
        }
    }
}

function http_request(url, params) {
  $.ajax({
    type: "POST",
    url: url,
    data: params,
    success: function(data) {
      if (data == "pass") {
          window.open("../website", "_self", "", false);
      } else {
          alert(data);
      }
      request_sent = false;
    }
  });
}


login.html:

&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;input id="inserted_id" type="text" placeholder="Account Name/e-mail"/&gt;
  &lt;input id="inserted_password" type="password" placeholder="Password"/&gt;
  &lt;button&gt;SUBMIT&lt;/button&gt;
  &lt;script src="login.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
isset() accepts multiple parameters, you can simplify:

if (isset($parameters["inserted_id"]) &amp;&amp; isset($parameters["inserted_password"])) {


To

if (isset($parameters["inserted_id"], $parameters["inserted_password"])) {

When ever I read anyone's code or database schema and I see any mention of id, I immediately assume that I am dealing with a positive integer.  If the value is anything other than a positive integer, I never use id in the field/column/variable name.
I never use mysqli's init() call because it is optional.  I'll recommend objected-oriented mysqli syntax because it is less verbose.
I don't think I'd json encode/decode your form data -- it seems like unnecessary extra data handling.  See here: jQuery Ajax POST example with PHP
echo doesn't need those parentheses. 
I am confident that @YourCommonSense will post a comprehensive answer containing the 3 pieces of commented advice and more, so I'll leave those recommendations to him.
You don't need to write out all those close() calls, just echo your message and let the script end naturally.  If you're going to kill the script at if (isset($_SESSION['user_id'])) { be sure to sure to echo something for consistency. 
I find javascript alert() boxes to be terribly annoying and a bit trashy to be honest.  Give your site some "class" and fashion an attractive presentation for any response messages that you plan to offer.
Your .html has form fields, but no form -- that doesn't feel valid to me.  I'll recommend adding the form tags and names attributes.  Some discussions: https://stackoverflow.com/q/33370025/2943403