<?php
    $userLogin = $_POST['login_api_phone'];
    $userPassword = $_POST['password_api_phone'];
    $password = md5($userPassword);

    // echo $userLogin."  ".$password;

    $pdo = new PDO('mysql:host=localhost;dbname=web4_intranet;charset=utf8', "web4_intranet", "WewJedjuAbEynk3"); 
    $GLOBALS["pdo_conn"] = $pdo;

    $noPublish = "SELECT main_contact_id AS contact_id FROM main_contact_department INNER JOIN main_contact ON main_contact_department.main_contact_id=main_contact.id WHERE main_contact.shortcut='$userLogin' AND main_contact.password='$password'";
    
    
    $stmt = $pdo->prepare($noPublish);
    $stmt->execute();

    // $pp = md5($userPassword);
    $row = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($row) {
        echo $row["contact_id"];
    }else {
        echo "null";
    }
?>