 <?php

if (isset($_SERVER['HTTP_ORIGIN'])) {
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Max-Age: 86400'); // cache for 1 day
}

error_reporting(E_ERROR | E_PARSE);

$_SESSION['database'] = $_GET['database'];
$_SESSION['pr_id'] = $_GET['pr_id'];
$_SESSION['po_id_refe'] = $_GET['po_id_refe'];
$_SESSION['po_descripcion'] = $_GET['po_descripcion'];

include 'conn.php';
include 'funciones.php';

$jsonData = null;
$jsonTempData = null;

$sql = "update " . $_SESSION['database'] . ".tmp_producto_op " .
    " set po_id_prod = '" . $_SESSION['pr_id'] .
    "', po_descripcion = '" . $_SESSION['po_descripcion'] .
    "' where po_id_refe = " . $_SESSION['po_id_refe'];

$qur = $connection->query($sql);

if ($_SESSION['codigo'] == "99") {

    $json->datos = "false";

} else {
    $json->datos = "true";

}

print_r(json_encode($json));

@mysqli_close($connection);
?>