<?php ob_start(); // este script lo usa la caja
session_set_cookie_params(0);
session_start();


if(isset($_SESSION['inicio'])){
	$horaInicio = new DateTime($_SESSION['inicio']);
	$horaTermino = new DateTime($timer);
	$interval = $horaInicio->diff($horaTermino);
	//echo $interval->format('%i %s');

	require_once('../../Connections/odonto_connection1.php');

	$codigo = $_SESSION['codigo'];

	$query_rs_todos = "SELECT hash FROM `mesas` WHERE codigo LIKE '$codigo'";
	$rs_ingreso0 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
	$row_rs_ingreso0 = mysqli_fetch_assoc($rs_ingreso0);

	$hash_leido = $row_rs_ingreso0['hash'];

	$hash_de_session = $_SESSION['hash'];

	if($hash_leido != $hash_de_session) $deslogear = 1;

	if($interval->format('%h') >= '1' || $deslogear) {
		session_destroy();
		$deslog = 1;
	}
}

$_SESSION['voy']='voy';
	
if(isset($_GET['boton'])) $boton=$_GET['boton'];

switch ($boton) {
    case "1":
        header("Location:" . "index_mozo1.php");
		break;
    case "2":
        header("Location:" . "index_carta.php");
		break;
    case "3":
        header("Location:" . "index_cuenta.php");
		break;
    case "4":
		if(isset($_GET['suge'])) header("Location:" . "index_sugerencias.php");
		else header("Location:" . "index0_rate.php");
		break;
    case "6":
        header("Location:" . "index_precios.php");
		break;
    case "7":
        header("Location:" . "index0.php");
		break;
    case "8":
        header("Location:" . "index_mozo.php");
		break;
    default:
        header("Location:" . "index_suge.php");
		
}

	?>
<?php ob_end_flush();?>