Problem with Login form. PHP, JS and HTML

Hello guys, first post here.
I hope the day finds you all well.

I am having problems with a login form created in php, js and html. Whenever I try to enter the web system I click “Enter” and it works without entering any username nor password which is totally wrong since it should ask for these credentials and if not entered it shouldn’t allow the access to the system.
Here’s the code… Could you guide me? What’s wrong? Any help would be highly appreciated. I am thinking about the query but it might another thing. Thank you.

HTML CODE

<form role="form" ng-submit="login(user,password)">
  <div class="form-group">
    <input type="user" class="form-control" ng-model='user' placeholder="Usuario">
  </div>
  <div class="form-group">
    <input type="password" class="form-control" ng-model='password' placeholder="Contraseña">
  </div>
  <div class="alert alert-warning" id='alert' style="display:none">Revise la informacion...</div>
  <div class="alert alert-danger" style="display:none" id='alertErr'>Error Usuario o Contraseña Erronea intentelo de nuevo</div>
  <button type="submit" class="btn btn-primary">Ingresar</button>
</form>

PHP CODE

<?php
	require_once 'database.php';
	$db = new Database();
	$body = json_decode(file_get_contents('php://input'));
	$user =$db->query("SELECT * FROM usuario WHERE usua_login = '".$body->user."' AND usua_pass = '".$body->password."'");
	if($user == false){
		http_response_code(404);
	}
	else{
		http_response_code(200);
		echo json_encode($user);
	}
?>

Javascript

'use strict';

/**
 * @ngdoc function
 * @name belkitaerpApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the belkitaerpApp
 */
angular.module('belkitaerpApp')
  .controller('MainCtrl', function ($scope,$http,$location) {


    	$scope.login = function(user,password){
    		console.log('Login...');
    		if(user =='' || password ==''){
    			$('#alert').show("slow");
             	
             	setTimeout(function() {
                	$('#alert').hide('slow');
           		 }, 3000);
    		}
    		else{
    			$http.post('../serverSide/login.php',{user:user,password:password}).success(function(data){
    				console.log('OK!');
    				$location.path('/products');	
    			}).error(function(data){
    				$('#alertErr').show("slow");
             	
             		setTimeout(function() {
                		$('#alertErr').hide('slow');
           			 }, 3000);
    			});
    		}
    	}
  });

I think you want $_POST[‘user’] rather than $body = json_decode(file_get_contents(‘php://input’));

The form should be submitting POST variables
to be sure, put both of these after json_decode


echo 'Body '.$body.' print_r';
print_r($POST);

You should see values after the print_r.

Hello lorenw and thank you for answering.
Turns out I was using an old version of Xampp which wasn’t supporting last version of PHP. Updated it and got it to work.
Thank you very much.