<?php
$skip_inizio_fine = true;
require_once 'ict_init.php';

$mk_time_corrente = mktime (date('H'),date('i'),date('s'),date('m'),date('d'),date('Y'));
$ts_data_inizio = get_ts($cfg_concorso[$lb_data_inizio]);

if ($mk_time_corrente < $ts_data_inizio){
	require($pagina_prima);
	exit;
}
		
// Pulisco le variabili in arrivo
cleanVariables();
			
//Detect special conditions devices
$iPod    = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad    = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");

//do something with this information
if( $iPod || $iPhone || $iPad){
    header('Location: pdf/regolamento_ios.pdf');
	exit;
} 
else {		
	$data = file_get_contents("pdf/regolamento.pdf");
	header("Content-type: application/octet-stream");
	header("Content-disposition: attachment;filename=regolamento.pdf");
	
	echo $data;
	exit;
}
