Codice PHP:
<?php
#Log Modifiche - Iniziato il 3 luglio 2005
#03/07/2005 Matteo
#04/07/2005 Matteo
#21/07/2005 Matteo
ob_start();
include("config.inc.php");
include("class.inc.php");
include("function.inc.php");
$separators=array("/") ;
$collection=$_SERVER["PATH_INFO"] ;
$collection=substr($collection,1) ;
if(substr($collection,-1)==$separators[0]){
$collection=substr($collection,0,-1) ;
}
$collection = str_replace($separators[1], $separators[0], $collection);
$varArray=explode($separators[0],$collection) ;
$_PINFO=array() ;
foreach ($varArray as $key=>$value){
if(!($key%2))
{
$_PINFO["$value"]=$varArray[$key+1] ;
}
}
$db = new MySQLConn (DB_HOST,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
$code = str_replace("'","",$_PINFO["code"]);
$code = str_replace("\\","",$code);
$code = str_replace("\"","",$code);
$lang = str_replace("'","",$_PINFO["lang"]);
$lang = str_replace("\\","",$lang);
$lang = str_replace("\"","",$lang);
$general_data = mysql_fetch_array($db->db_query("SELECT id, hotel_name, address, city, country, phone, total_rooms, booking_box_url FROM hotels WHERE hotel_code = '".$code."'"));
$name_field = "name_" . $lang;
$description_field = "desc_" . $lang;
$local_table = "hotels_" . $lang;
$keywords_table = "keys_" . $lang;
$city = mysql_fetch_array($db->db_query("SELECT ".$name_field.", ".$description_field." FROM cities WHERE id = '".$general_data["city"]."'"));
$country = mysql_fetch_array($db->db_query("SELECT ".$name_field." FROM countries WHERE id = '".$general_data["country"]."'"));
$local_info = mysql_fetch_array($db->db_query("SELECT * FROM ".$local_table." WHERE hotel_id = '".$general_data["id"]."'"));
$city_en = mysql_fetch_array($db->db_query("SELECT name_en FROM cities WHERE id = '".$general_data["city"]."'"));
$city_name_link = stripslashes(strtolower(str_replace(" ","_",$city_en["name_en"])));
$city_name_link = $city_name_link . "_" . $lang . ".html";
$country_name = stripslashes($country[$name_field]);
$city_name = stripslashes($city[$name_field]);
$city_description = stripslashes($city[$description_field]);
$hotel_id = $general_data["id"];
$hotel_name = stripslashes($general_data["hotel_name"]);
$hotel_images = "";
$dimensioni_immagini = array();
$query = $db->db_query("SELECT * FROM hotels_pictures WHERE hotel_id = '".$general_data["id"]."' LIMIT 0, 12");
while ($result_thumbs = mysql_fetch_array($query))
{
$dimensioni = getimagesize("/var/www/ehbox/images/hotels/thumbs/".$result_thumbs["id"].".jpeg");
$dimensioni_immagini[$dimensioni[0]] = $result_thumbs["id"];
}
shuffle($dimensioni_immagini,SORT_NUMERIC);
reset($dimensioni_immagini);
$i = 0;
while (list($chiave, $valore) = each($dimensioni_immagini))
{
$i++;
$hotel_images = "<a href=\"#\" onclick=\"popImage(\'http://www.ehbox.com/images/hotels/$valore.jpeg','$hotel_name, $city_name $country_name\')\"><img src=\"http://www.ehbox.com/images/hotels/thumbs/$valore.jpeg\" border=\"0\" align=\"middle\" hspace=\"5\" vspace=\"5\" alt=\"$hotel_name, Luxury Boutique Hotel in $city_name - $country_name\" title=\"$hotel_name, Luxury Boutique Hotel in $city_name - $country_name\"></a>";
if (($i % 4) == 0)
$hotel_images = "
";
}
$location = stripslashes($local_info["location"]);
$address = stripslashes($general_data["address"]);
$booking_box_small_url = str_replace("BACK_PAGE","www.avantgardehotels.com",$general_data["booking_box_url"]);
$keywords = stripslashes(mysql_result($db->db_query("SELECT keywords FROM ".$keywords_table." WHERE hotel_id = '".$general_data["id"]."'"),0,0));
#Recupero il file del template e stampo tramite la funzione eval le variabili che ho qui sopra preparato
eval("Stampa(\"".GetTemplate("templates/$lang.html")."\");");
?>