I want to implement authentication in my application, and I don't know how check name and password entered by the user to be the same as the one in the database, and I don't know how the query in php file must be. in the database of Table 'client', I have NomClient and mdp(password).
login.html
<ion-content class="padding" ng-controller="loginCtrl">
<div class="list list-inset" >
<label class="item item-input">
<input type="text" placeholder="nom" required="" ng-model="NomClient">
</label>
<label class="item item-input">
<input type="password" placeholder="Password" ng-model="mdp">
</label>
<button class="button button-block button-positive" ng-click="submit()">Login</button>
</ion-content>
app.js
app.controller('loginCtrl', function($scope,$state,$http){
$scope.submit= function(){
$http.post(
"http://localhost/deb/login.php",
{
'NomClient':$scope.NomClient,
'mdp':$scope.mdp
}
).success(function(data){
}
};
login.php
<?php
$connect = mysqli_connect("localhost", "root", "", "tem");
$data = json_decode(file_get_contents("php://input"));
if(count($data) > 0)
{
$NomClient = mysqli_real_escape_string($con, $data->N);NomClient
$mdp = mysqli_real_escape_string($con,$data->mdp);
$query =("??");
$que = mysqli_query($con, $query);
$count = mysqli_num_rows($que);
if($count==1){
echo 'correct';}
else{
echo 'wrong';
}
}
?>