1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
| <?
include("header.inc.php");
$id_resto=$_GET["id"];
$query_exists = mysql_query("SELECT COUNT(id) FROM resto WHERE id='$id_resto'");
$result_exists = mysql_fetch_row($query_exists);
if ($result_exists[0]==0)
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: index.php");
die("Redirection");
}
else
{
// champs à sélectionner / à afficher
$tab_champs = array("id","title","city","note","description","address","phone","website","cap","menu_entree","menu_plat","menu_dessert","youtube_link","resa","horferm","pain","prix","serviette","latable","sympaekip","aime","aimemoins","ofinal" );
$chr_champs='';
foreach($tab_champs as $val) $chr_champs.=$val.', ';
$chr_champs=substr($chr_champs,0,-2);
$q = mysql_query("SELECT $chr_champs FROM resto WHERE id='$id_resto'");
$r = mysql_fetch_assoc($q);
$quser = mysql_query("SELECT id_user FROM users_restos WHERE id_resto='$r[id]'" ) or die(mysql_error());
$ruser = mysql_fetch_assoc($quser);
}
// mise a jour des affichages du resto
mysql_query("UPDATE resto SET hits=hits+1 WHERE id='$id_resto'");
if ($_SESSION["config_user"]["id_user"]>0 && $_SESSION["config_user"]["id_user"]!=$ruser["id_user"] && $_SESSION["fiche_"."$id_resto"]!="visited")
{
$qf = mysql_query("SELECT fiche FROM fidelite_config");
$rf = mysql_fetch_assoc($qf);
mysql_query("UPDATE users_fidelite SET fiche=fiche+'".$rf["fiche"]."' WHERE id_user='".$_SESSION["config_user"]["id_user"]."'");
mysql_query("UPDATE users SET points=points+".$rf["fiche"]." WHERE id_user='".$_SESSION["config_user"]["id_user"]."'");
mysql_query("INSERT INTO fidelite_log SET id_user='".$_SESSION["config_user"]["id_user"]."', type='fiche', points='".$rf["fiche"]."', date=NOW()");
$_SESSION["fiche_"."$id_resto"]="visited";
}
?>
<!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>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link rel="stylesheet" type="text/css" href="js_scripts/jquery.fancybox/jquery.fancybox.css" media="screen" />
<script type="text/javascript" src="js_scripts/jquery.fancybox/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js_scripts/jquery.fancybox/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js_scripts/jquery.fancybox/jquery.fancybox-1.2.1.pack.js"></script>
</head>
<body>
<h1>Restaurant à <strong><?=$r["$tab_champs[2]"];?> <?=$r["$tab_champs[1]"];?></strong> Restaurant <strong><?=$r["$tab_champs[2]"];?></strong> Restaurant <strong><?=$r["$tab_champs[2]"];?></strong></h1>
<? include("headerhtml.inc.php"); ?>
<div id="cadre">
<table width="100%" cellpadding="0" cellspacing="0" border="0" id="tfiche">
<tr>
<td style="vertical-align:top;">
<div id="details2">
<h4>Restaurant à <?=$r["$tab_champs[2]"];?><br /><i><?=$r["$tab_champs[1]"];?> </i></h4>
<?
if(trim($r["youtube_link"])!='')
{
?>
<div id="video">
<object width="400" height="260"><param name="movie" value="<?=$r["youtube_link"];?>"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent" /></param><embed src="<?=$r["youtube_link"];?>" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" allowfullscreen="true" width="400" height="260"></embed></object>
</div>
<?
}
?>
</div>
</div>
</td>
<td style="width:300px; vertical-align:top;">
<?
if ($r["$tab_champs[13]"]=='y')
{
?>
<br><div id="reserver" ><a href="reservations-<?=format_url($r["$tab_champs[1]"].'-'.$r["$tab_champs[2]"]).'-'.$r["$tab_champs[0]"];?>.html"><img src="reserver.jpg" alt="" /></a></div>
<?
}
?>
<?
$tab_photos=array();
for($i=1;$i<=8;$i++)
{
$path_img = 'photos/'.$r["id"].'_'.$i.'.jpg';
$path_img2 = 'photos/'.$r["id"].'_'.$i.'_125.jpg';
if(file_exists($path_img)) { $tab_photos[]=array($i,$id_resto,$path_img,$path_img2); }
}
if (@count($tab_photos)>0)
{
?>
<script type="text/javascript">
$(document).ready(function()
{
$("a.group").fancybox();
});
</script><br>
<div id="photos">
<?
$cpt=1;
foreach($tab_photos as $val)
{
?>
<p style="float:left; width:130px; margin-bottom:10px; <? if ($cpt%2!=0) { echo 'margin-right:10px;'; } ?>"><a class="group" rel="group" title="Photo <?=$cpt;?>" href="<?=$val[2];?>"><img src="<?=$val[3];?>" alt="Photo <?=$cpt;?>" /></a></p>
<?
$cpt++;
}
?>
</div><br>
<?
}
?>
<br><br>
</div>
</div>
</td>
</tr>
</table>
<div id="back"><a href="resultats.php?recherche=<?=urlencode($_SESSION["recherche"]);?><? if ($_SESSION["p"]>1) { echo '&p='.$_SESSION["p"]; } ?>">Retour à ma recherche</a></div>
</div>
<? include("footer.inc.php"); ?>
</body>
</html> |
Partager