<?php
    session_start();
    $usuarioSession = $_SESSION['USUARIO'];
    $grupo = $_SESSION['GRUPO'];
    $contacto = $_SESSION['CONTACTO'];
    $awa_session_id = $_SESSION['AWA_SESION_ID'];
    include('../includes/conex.php');
    include('../includes/eat.php');
    include('../class/Static.php');
    include('../class/Schema.php');
    if(!isset($usuarioSession) or $awa_session_id != $awa_id) {
      eatCookies();
      header('Location:../index.php');
    }
    if(isset($_COOKIE['usuario']) AND $_COOKIE['usuario'] != $staticUsu ) {
      eatCookies();
      header('Loction:../index.php');
    }
    if(isset($_COOKIE['idioma'])) {
      include('../lg/LG_' . $_COOKIE['idioma'] . '.php');
    } else {
      include('../lg/LG_SP.php');
    }
    $html = '';
    $Schema = New Schema($con);
    $provincia = Statics::SafeInput($con, $_POST['provincia']);
    $res = $Schema->executeQuery('SELECT * FROM COMUN_CIUDADES WHERE PROVINCIA = ? ORDER BY POBLACION ASC', 'i', [$provincia]);
    while($row = $res->fetch_array()) {
        $html .= '<option value="' . $row['CODIGO'] . '">' . $row['POBLACION'] . '</option>';
    }

    echo $html;
?>

