<?php

//$file = fopen("log.txt", "w");   /// BORRAR LOG
//fwrite($file, "Error $error". PHP_EOL);
//fclose($file);

$ras=$_GET["ras"];
$config = require ('config.php');
$conexion=$config['conexion']; 

$conn = pg_pconnect("$conexion");

$sql="select * from control where control='RELOAD'";
$result = pg_query($conn, $sql);
while ($row = pg_fetch_array($result, NULL, PGSQL_ASSOC)) {

	$sql="delete from control where control='RELOAD'";
	$resul2 = $conn->query($sql);
	pg_close($conn);
	echo 'OK|RELOAD';
	return;

}
pg_free_result($result);

$sql="select * from control where control='ALIVE'";
$result = pg_query($conn, $sql);
while ($row = pg_fetch_array($result, NULL, PGSQL_ASSOC)) {

	pg_close($conn);
	echo 'OK|ALIVE_PY';
	return;

}
pg_free_result($result);

pg_close($conn);
echo 'OK|NADA';

?>