<?php
$array[0] = "http://www.link1.it" ;
$array[1] = "http://www.link2.it" ;
$array[2] = "http://www.link3.it" ;
/* seleziono accaso uno dei link,
rand(0,2) perchè l'array arriva a [2]
l'array potrebbe arrivare a [6] a questo
punto sarebbe rand(0,6) */
$iniSrc = $array[rand(0,2)] ;
$ipArray[0] = "192.168.1.10" ;
$ipArray[1] = "192.168.1.11" ;
$ipArray[2] = "192.168.1.12" ;
foreach ( $ipArray as $runIpArray )
{
/* verifico che l'IP arrivata è nel array dove immagazino gli indirizzi IP permessi */
$ctrl_IP = ( $runIpArray == $_SERVER['REMOTE_ADDR'] ) ? "SI" : $ctrl_IP ;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php /* condizione che deciderà se visualizzare l'eframe */
if($ctrl_IP=="SI"){ ?><iframe id="myIframe" src="<?php echo $iniSrc ?>" style="border:0px; width:100%; height:100%;"></iframe><?php } ?>
</body>
</html>