<?php
 session_start();  $codeTheme=$_GET['codeTheme']; if (! is_numeric($codeTheme)) exit(); $idMin=$_GET['idMin']; if (! is_numeric($idMin)) exit(); $nbResult=$_GET['nbResult']; if (! is_numeric($nbResult)) exit(); $nbPhotos=$_GET['nbPhotos']; if (! is_numeric($nbPhotos)) exit(); if (isset($_GET['chrono'])) { if ($_GET['chrono']=='date') $_SESSION['SESS_CHRONO']='date'; else $_SESSION['SESS_CHRONO']='rand';   $chrono=$_SESSION['SESS_CHRONO'];  } else  if (isset($_SESSION['SESS_CHRONO'])) $chrono = $_SESSION['SESS_CHRONO']; else $chrono = 'rand';   if (isset($_SESSION['SESS_LOGIN'])) $login=$_SESSION['SESS_LOGIN']; else $login='public';  include("fotoweb77.php"); include("script_outils.php"); include("fotoweb57.php"); $queryRelation = "SELECT niveau FROM relationthemepersonne WHERE nomPers='$login' AND codeTheme='$codeTheme'"; $resultRelation = mysql_query ($queryRelation) or die ("La requête de sélection des thèmes a échoué"); $niveau = mysql_fetch_row($resultRelation); if ($niveau == "") $niveau = '0'; else $niveau = $niveau[0];  /* Free resultset */ mysql_free_result($resultRelation); if ($chrono == 'date' || !isset($_SESSION['picinfo'])){  if ($login == 'public' || $niveau == '0') { $querySelect = "SELECT id,nom,codeTheme,prive,dateOriginale FROM image WHERE codeTheme='$codeTheme' AND prive='0' ORDER BY 'dateOriginale','nom' LIMIT ".$idMin.",".$nbPhotos; } else { if($niveau == '1') $querySelect = "SELECT id,nom,codeTheme,prive,dateOriginale FROM image WHERE codeTheme='$codeTheme' AND prive!='2' ORDER BY 'dateOriginale','nom' LIMIT ".$idMin.",".$nbPhotos; if($niveau == '2') $querySelect = "SELECT id,nom,codeTheme,prive,dateOriginale FROM image WHERE codeTheme='$codeTheme' ORDER BY 'dateOriginale','nom' LIMIT ".$idMin.",".$nbPhotos; } $resultSelect = mysql_query ($querySelect) or die ("La requête de sélection des photos a échoué");  $imax = mysql_num_rows($resultSelect);  for( $i = 0; $i < $imax; $i++) { $tabPhotosPage[] = mysql_fetch_array($resultSelect); } mysql_free_result($resultSelect);  } else{ $picinfo=$_SESSION['picinfo']; for( $i = $idMin; ($i < $nbPhotos+$idMin) && ($i<sizeof($picinfo)); $i++) $tabPhotosPage[]=$picinfo[$i];  } $queryTheme = "SELECT repertoire FROM theme WHERE codeTheme='$codeTheme'"; $resultTheme = mysql_query ($queryTheme) or die ("La requête de sélection du theme a échoué"); $lineTheme = mysql_fetch_row($resultTheme); $rep = $lineTheme[0];  mysql_free_result($resultTheme); $nbPage=ceil($nbResult/$nbPhotos); $max = $idMin + $nbPhotos; ?> <html> <head> <link rel='stylesheet' href='ergonomie/style.css'> <script language='javascript' src='script/script.js'></script> </head> <body> <table border='0' align='center'> <?php
echo "<tr>"; echo "<td>"; $pageEnCours = ($idMin/$nbPhotos) + 1; echo "<input type='hidden' value='".$pageEnCours."' id='txtNumPage' name='txtNumPage'>"; echo "<tr>"; echo 	"<td width='70px' align='left'>"; if ($idMin > 0) { echo "<img src='ergonomie/_images/precedent.gif' alt='Photos précédentes' style='cursor:pointer;cursor:hand' id='precedent' onClick=precedente('".$codeTheme."','".$nbPhotos."','".$idMin."','".$nbResult."','".$nbPage."',1,'".$chrono."') onMouseOver=rolloverIn('precedent') onMouseOut=rolloverOut('precedent')>"; } echo "</td>"; echo "<td>"; echo 	"<table class='operation' border='0' align='center'>"; echo 		"<tr>"; for( $i = 0; $i < sizeof($tabPhotosPage); $i++) { $id = $tabPhotosPage[$i]['id']; $nom = $tabPhotosPage[$i]['nom']; $codeTheme = $tabPhotosPage[$i]['codeTheme']; $prive = $tabPhotosPage[$i]['prive']; $path = ""; if($prive == 2) { $path = "../".$rep."/vip/".getNomMiniature($nom); $pathPhoto = "../".$rep."/vip/".$nom; } if($prive == 1) { $path = "../".$rep."/prive/".getNomMiniature($nom); $pathPhoto = "../".$rep."/prive/".$nom; } if($prive == 0) { $path = "../".$rep."/".getNomMiniature($nom); $pathPhoto = "../".$rep."/".$nom; } $comment = str_replace("'","&#39",getTitreIptc($pathPhoto));  echo 	"<td align='center' title='".$comment."'>"; echo 		"<img border='1' src='$path' alt='".getTitreIptc($pathPhoto)."' class='lienImage' onClick=\"ouvrirImage('".$id."','".$pathPhoto."')\">"; echo 	"</td>"; echo 	"<td width='10px'>&nbsp;</td>"; } echo 	"</tr>"; echo "</table>"; echo "</td>";    echo "	<td width='70px' align='right'>"; if ($max < $nbResult) { echo "<img src='ergonomie/_images/suivant.gif' alt='Photos suivantes' style='cursor:pointer;cursor:hand' id='suivant' onClick=suivante('".$codeTheme."','".$nbPhotos."','".$idMin."','".$nbResult."','".$nbPage."',1,'".$chrono."') onMouseOver=rolloverIn('suivant') onMouseOut=rolloverOut('suivant')>"; } echo 	"</td>"; echo "</tr>"; echo "</td>"; echo "</tr>"; ?> </table> </body> </html> 