<?php


// Имя ДБ: turistpr_erv
// Пользователь: turistpr_erv
// Пароль: c7vOXbmG
// Адрес хоста: 141.8.194.131
// таблица lexrpiority





if(isset($_POST['action']) && !empty($_POST['action'])) {
  $action = $_POST['action'];
  switch($action) {
      case 'user_verify' : user_verify(); break;   
   
  }
}

function user_verify() {

  $finded_row['success']="false";


  //$link = mysqli_connect("141.8.194.131", "turistpr_erv", "c7vOXbmG");
  $link = mysqli_connect("localhost", "ci20465_erv", "c7vOXbmG");

  if ($link == false){
   
  }
  else {
    
  }



  $birthday = $_POST['birthday'];
  $inn = $_POST['inn'];
  //$sql =  "SELECT * FROM turistpr_erv.lexrpiority";
  $sql =  "SELECT * FROM ci20465_erv.lexrpiority";  
  $result = mysqli_query($link, $sql); 

  $finded_row=array("success"=>"false","message"=>"Полис не найден", "result" => "");

  if($inn) {
  while ($row = mysqli_fetch_assoc($result)) {   
   if($inn==$row['voucher']) { 
    $finded_row['success']="true";
    $finded_row['message']="Полис найден";
    $finded_row['result']=$row;
   }
  }  
}
  echo json_encode($finded_row);
}

?>