Mon code:
<HTML>
<HEAD>
<TITLE>V A N I L A</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#" )!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?" ))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</HEAD>
<style type="text/css">
<!--
body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small}
table { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small}
-->
</style>
<BODY BGCOLOR=#FFFFFF onLoad="MM_preloadImages('../images/test_15_over.jpg','../images/test_17_over.jpg'">
<div align="center">
<TABLE WIDTH=781 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
<IMG SRC="../images/test_01.jpg" WIDTH=15 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_02.jpg" WIDTH=12 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_03.jpg" WIDTH=444 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_04.jpg" WIDTH=12 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_05.jpg" WIDTH=35 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_06.jpg" WIDTH=95 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_07.jpg" WIDTH=34 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_08.jpg" WIDTH=102 HEIGHT=169></TD>
<TD>
<IMG SRC="../images/test_09.jpg" WIDTH=32 HEIGHT=169></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/test_10.jpg" WIDTH=15 HEIGHT=34></TD>
<TD>
<IMG SRC="../images/test_11.jpg" WIDTH=12 HEIGHT=34></TD>
<TD>
<IMG SRC="../images/test_12.jpg" WIDTH=444 HEIGHT=34></TD>
<TD>
<IMG SRC="../images/test_13.jpg" WIDTH=12 HEIGHT=34></TD>
<TD>
<IMG SRC="../images/test_14.jpg" WIDTH=35 HEIGHT=34></TD>
<TD><a href="../intro.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('INTRO','','../images/test_15_over.jpg',1)"><img name="INTRO" border="0" src="../images/test_15.jpg" width="95" height="34" align="middle"></a></TD>
<TD>
<IMG SRC="../images/test_16.jpg" WIDTH=34 HEIGHT=34></TD>
<TD><a href="../photos.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('PHOTOS','','../images/test_17_over.jpg',1)"><img name="PHOTOS" border="0" src="../images/test_17_on.jpg" width="102" height="34" align="middle"></a></TD>
<TD>
<IMG SRC="../images/test_18.jpg" WIDTH=32 HEIGHT=34></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/test_19.jpg" WIDTH=15 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_20.jpg" WIDTH=12 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_21.jpg" WIDTH=444 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_22.jpg" WIDTH=12 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_23.jpg" WIDTH=35 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_24.jpg" WIDTH=95 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_25.jpg" WIDTH=34 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_26.jpg" WIDTH=102 HEIGHT=24></TD>
<TD>
<IMG SRC="../images/test_27.jpg" WIDTH=32 HEIGHT=24></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/test_28.jpg" WIDTH=15 HEIGHT=18></TD>
<TD>
<IMG SRC="../images/test_29.jpg" WIDTH=12 HEIGHT=18></TD>
<TD>
<IMG SRC="../images/test_30.jpg" WIDTH=444 HEIGHT=18></TD>
<TD>
<IMG SRC="../images/test_31.jpg" WIDTH=12 HEIGHT=18></TD>
<TD colspan="4" background="../images/test34-36.jpg"></TD>
<TD>
<IMG SRC="../images/test_36.jpg" WIDTH=32 HEIGHT=18></TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/test_37.jpg" WIDTH=15 HEIGHT=330></TD>
<TD background="../images/test_38.jpg"> </TD>
<TD valign="middle">
[#b84600]<?php
require ("_admin/conf.php" );
////////////////////////////////////////////////////////////////////////////////
// ouverture du dossier contenant les fichiers --> nbphotos
function nb_ph($fdirectory){
$handle=opendir($fdirectory);
$nb_photos = 0;
while ($file = readdir($handle)) {
if ($file != "." && $file != ".." && $file != "_commentaire.txt" && $file != "thumbs" && $file != "_com_img.txt" ) {
// $file contient le nom d'un fichier
$nb_photos = $nb_photos + 1;
}
}
closedir($handle);
return ($nb_photos);
}
// fin ouverture du dossier contenant les fichiers --> nbphotos
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// NAME
function no_ext($t_file){
$pt = strrpos($t_file, "." );
$s_file = substr($t_file, 0, $pt);
return $s_file;
}
// FIN NAME
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// THUMBS NAME
function t_name($file){
$pt = strrpos($file, "." );
$s_file = substr($file, 0, $pt);
$file_ext = substr($file, $pt + 1, strlen($file) - $pt - 1);
$file_ext = strtolower($file_ext);
$s_file = $s_file . "_m." . $file_ext;
return $s_file;
}
// FIN THUMBS NAME
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////
// NB COMMENTAIRES
function get_nb_com($dir, $img){
$file = $dir . "/_com_img.txt";
if (!$op_file = @fopen($file,"r" )){
$nb_com = 0; // Problème ouverure fichier de commentaire
} else {
$nb_com = 0;
while (!feof($op_file)){
$line = fgets($op_file, 4096);
$arr_data = explode("/", $line);
// 0:nom image
if ($arr_data[0] == $img){
$nb_com++;
}
}
fclose($op_file);
}
return($nb_com);
}
// END NB COMMENTAIRES
///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Construction du tableau html
function constr_tab($fnb_photos, $fint_nb_pages, $fint_no_page, $fhnamep, $fnb_lim, $ffirst, $fall_nb_photos, $fdirectory, $jnb_phpage){
require ("_admin/conf.php" );
if ($fint_no_page < $fint_nb_pages){
$fnb_photos = $fnb_lim ;
}
else{
$fnb_photos = $fnb_photos - ($fnb_lim * ($fint_no_page - 1));
}
$cpt_init = ($fint_no_page - 1) * $fnb_lim + 1;
include ("head.php" );
echo "$head_jbrowser";
if ($fnb_photos == 0){
echo "<center><font face=\"Verdana, Arial, Helvetica\" size=\"2\">Dossier vide<br><br><a href=\"photos.php\">Retour</a></font></center>";
include("foot.php" );
die;
}
else {
echo "<table border=\"0\" width=\"$table_width\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" bgcolor=\"$bodybgcolor\">";
echo "<tr><td colspan=\"$jnb_phpage\" align=\"center\" bgcolor=\"$bgcolor_titre\"><font size=\"$titre_size\" color=\"$titre_color\" face=\"$titre_face\"><b><u>$st_texte</u></b></font></td></tr>";
$reste = $fnb_photos % $jnb_phpage;
$juste = $fnb_photos - $reste;
$quotient = $juste / $jnb_phpage;
echo "<tr><td colspan=\"1\"><font size=\"1\" face=\"$titre_face\">";
echo "Page : $fint_no_page/$fint_nb_pages </font></td>";
$photo_start = 1 + ($fint_no_page - 1) * $fnb_lim;
$photo_end = $photo_start + $fnb_photos - 1;
$cjnb_phpage = $jnb_phpage-1;
echo "<td colspan=\"$cjnb_phpage\" align=\"right\"><font size=\"1\" face=\"$titre_face\">";
echo "Photos : $photo_start à $photo_end / $fall_nb_photos</font></td></tr>";
if ($quotient == 0){ // moins de cinq
$cpt_empty = 0;
for ($i = $cpt_init; $i <= ($reste + $cpt_init - 1); $i++){
$filetoopen = "$fdirectory/" . $fhnamep[$i];
$size_ph = getimagesize($filetoopen); // taille de l image
$wnd_w = $size_ph[0] + 60;
$wnd_h = $size_ph[1] + 60;
if ($c_aff == 0){
$ts_name = no_ext($fhnamep[$i]);
} else {
$ts_name = $size_ph[0] . "x" . $size_ph[1];
}
$th_name = t_name($fhnamep[$i]);
$th_name = $fdirectory . "/thumbs/" . $th_name;
$th_size = getimagesize($th_name);
echo"<td bgcolor=\"$tabbgcolor\" width=\"10%\" align=\"center\"><a href=\"#\" onClick=\"MM_openBrWindow('window.php?img_name=$fdirectory/$fhnamep[$i]&img_w=$size_ph[0]&img_h=$size_ph[1]','photo','scrollbars=yes,resizable=yes,width=$wnd_w,height=$wnd_h'\"><img src=\"$th_name\" align=\"center\" border=\"0\" $th_size[3] alt=\"$fhnamep[$i]\"></a><br><font size=\"1\" face=\"Verdana, Arial, Helvetica\">$ts_name ";
if ($use_com == 1){
$nb_com = get_nb_com($fdirectory, $fhnamep[$i]);
if ($nb_com != 0)
echo "<br><a href=\"#\" onClick=\"MM_openBrWindow('commentaire.php?img_dir=$fdirectory&img_name=$fhnamep[$i]','com','scrollbars=yes,resizable=yes,width=320,height=500'\"><br><img src=\"img_src/com.gif\" width=\"17\" height=\"16\" align=\"absmiddle\" alt=\"Voir ou ajouter des commentaire à l'image $fhnamep[$i]\" border=\"0\">$nb_com Commentaires</a>";
else
echo "<br><a href=\"#\" onClick=\"MM_openBrWindow('commentaire.php?img_dir=$fdirectory&img_name=$fhnamep[$i]','com','scrollbars=yes,resizable=yes,width=320,height=500'\"><br><img src=\"img_src/com.gif\" width=\"17\" height=\"16\" align=\"absmiddle\" alt=\"Ecrire un commentaire sur $fhnamep[$i]\" border=\"0\">Commentaire</a>";
}
echo "</font></td>";
$cpt_empty++;
}
for ($ce=$cpt_empty ; $ce < $jnb_phpage ; $ce++){
echo"<td width=\"10%\"> </td>";
}
echo "</tr>";
}else{ // plus de cinq ou egale
for ($i = 1; $i <= $quotient; $i++){
echo "<tr>";
for ($j = 1; $j <= $jnb_phpage; $j++){
$k =($cpt_init - 1) + ($i - 1) * $jnb_phpage + $j;
$filetoopen = "$fdirectory/" . $fhnamep[$k];
$size_ph = getimagesize($filetoopen); // taille de l image
$wnd_w = $size_ph[0] + 60;
$wnd_h = $size_ph[1] + 60;
if ($c_aff == 0){
$ts_name = no_ext($fhnamep[$k]);
} else {
$ts_name = $size_ph[0] . "x" . $size_ph[1];
}
$th_name = t_name($fhnamep[$k]);
$th_name = $fdirectory . "/thumbs/" . $th_name;
$th_size = getimagesize($th_name);
echo"<td bgcolor=\"$tabbgcolor\" width=\"10%\" align=\"center\"><a href=\"#\" onClick=\"MM_openBrWindow('window.php?img_name=$fdirectory/$fhnamep[$k]&img_w=$size_ph[0]&img_h=$size_ph[1]','photo','scrollbars=yes,resizable=yes,width=$wnd_w,height=$wnd_h'\"><img src=\"$th_name\" align=\"center\" border=\"0\" $th_size[3] alt=\"$fhnamep[$k]\"></a><br><font size=\"1\" face=\"Verdana, Arial, Helvetica\">$ts_name ";
if ($use_com == 1){
$nb_com = get_nb_com($fdirectory, $fhnamep[$k]);
if ($nb_com != 0)
echo "<br><a href=\"#\" onClick=\"MM_openBrWindow('commentaire.php?img_dir=$fdirectory&img_name=$fhnamep[$k]','com','scrollbars=yes,resizable=yes,width=320,height=500'\"><br><img src=\"img_src/com.gif\" width=\"17\" height=\"16\" align=\"absmiddle\" alt=\"Voir ou ajouter des commentaire à l'image $fhnamep[$k]\" border=\"0\">$nb_com Commentaires</a>";
else
echo "<br><a href=\"#\" onClick=\"MM_openBrWindow('commentaire.php?img_dir=$fdirectory&img_name=$fhnamep[$k]','com','scrollbars=yes,resizable=yes,width=320,height=500'\"><img src=\"img_src/com.gif\" width=\"17\" height=\"16\" align=\"absmiddle\" alt=\"Ecrire un commentaire sur $fhnamep[$k]\" border=\"0\">Commentaire</a>";
}
echo "</font></td>";
}
echo "</tr>";
}
echo "<tr>";
for ($l = 1; $l <= $reste; $l++){
$m = $k + $l;
$filetoopen = "$fdirectory/" . $fhnamep[$m];
$size_ph = getimagesize($filetoopen); // taille de l image
$wnd_w = $size_ph[0] + 60;
$wnd_h = $size_ph[1] + 60;
if ($c_aff == 0){
$ts_name = no_ext($fhnamep[$m]);
} else {
$ts_name = $size_ph[0] . "x" . $size_ph[1];
}
$th_name = t_name($fhnamep[$m]);
$th_name = $fdirectory . "/thumbs/" . $th_name;
$th_size = getimagesize($th_name);
echo"<td bgcolor=\"$tabbgcolor\" width=\"10%\" bgcolor=\"$tabbgcolor\" align=\"center\"><a href=\"#\" onClick=\"MM_openBrWindow('window.php?img_name=$fdirectory/$fhnamep[$m]&img_w=$size_ph[0]&img_h=$size_ph[1]','photo','scrollbars=yes,resizable=yes,width=$wnd_w,height=$wnd_h'\"><img src=\"$th_name\" align=\"center\" border=\"0\" $th_size[3] alt=\"$fhnamep[$m]\"></a><br><font size=\"1\" face=\"Verdana, Arial, Helvetica\">$ts_name ";
if ($use_com == 1){
$nb_com = get_nb_com($fdirectory, $fhnamep[$m]);
if ($nb_com != 0)
echo "<br><a href=\"#\" onClick=\"MM_openBrWindow('commentaire.php?img_dir=$fdirectory&img_name=$fhnamep[$m]','com','scrollbars=yes,resizable=yes,width=320,height=500'\"><br><img src=\"img_src/com.gif\" width=\"17\" height=\"16\" align=\"absmiddle\" alt=\"Voir ou ajouter des commentaire à l'image $fhnamep[$m]\" border=\"0\">$nb_com Commentaires</a>";
else
echo "<br><a href=\"#\" onClick=\"MM_openBrWindow('commentaire.php?img_dir=$fdirectory&img_name=$fhnamep[$m]','com','scrollbars=yes,resizable=yes,width=320,height=500'\"><img src=\"img_src/com.gif\" width=\"17\" height=\"16\" align=\"absmiddle\" alt=\"Ecrire un commentaire sur $fhnamep[$m]\" border=\"0\">Commentaire</a>";
}
echo "</font></td>";
}
if ($reste != 0){
for ($kl=$reste ; $kl < $jnb_phpage ; $kl++){
echo"<td width=\"10%\"> </td>";
}
}
echo "</tr>";
}
echo "<tr><td width=\"10 %\" colspan=\"1\" align=\"left\"><font size=\"1\" face=\"$titre_face\"><a href=\"photos.php\">Menu</a> ";
/////////////////////////////
// liens page
$other_cpt_l = 0;
$other_cpt_r = 0;
for ($cpt = 1 ; $cpt <= $fint_nb_pages ; $cpt++){
if ($cpt <= $fint_no_page + 3 && $cpt >= $fint_no_page - 3){
if ($fint_no_page != $cpt)
echo " | <a href=\"browser.php?first=$ffirst&int_nb_photos=$fnb_photos&int_nb_pages=$fint_nb_pages&int_no_page=$cpt&directory=$fdirectory\">$cpt</a>";
else
echo " | <b>$cpt</b>";
}
else{
if ($cpt < $fint_no_page && $other_cpt_l < 3){
$other_cpt_l++;
echo " .";
} else if ($cpt > $fint_no_page && $other_cpt_r < 3){
$other_cpt_r++;
echo " .";
};
};
};
// lien page
/////////////////////////////
$cjnb_phpage = $jnb_phpage-1;
echo "</font></td><td colspan=\"$cjnb_phpage\" width=\"20 %\" align=\"center\"><font size=\"2\">";
/////////////////////////////
// prev next
if (($fint_no_page - $fint_nb_pages) <= 0 && $fint_no_page != 1){ // prev
$fnb_photos = $fall_nb_photos - ($fnb_lim * ($fint_no_page - 1));
$fint_no_page = $fint_no_page - 1;
echo "<a href=\"browser.php?first=$ffirst&int_nb_photos=$fnb_photos&int_nb_pages=$fint_nb_pages&int_no_page=$fint_no_page&directory=$fdirectory\"><img src=\"img_src/prev.gif\" border=\"0\" alt=\"Page précédente\"></a> ";
$fint_no_page = $fint_no_page + 1;
}
if (($fint_nb_pages - $fint_no_page) > 0){ // next
$fint_no_page = $fint_no_page + 1;
$fnb_photos = $fall_nb_photos - ($fnb_lim * ($fint_no_page - 1));
echo " <a href=\"browser.php?first=$ffirst&int_nb_photos=$fnb_photos&int_nb_pages=$fint_nb_pages&int_no_page=$fint_no_page&directory=$fdirectory\"><img src=\"img_src/next.gif\" border=\"0\" alt=\"Prochaine page\"></a>";
}
// prev next
/////////////////////////////
echo "</font></td></tr><tr><td width=\"10 %\" colspan=\"$jnb_phpage\" align=\"center\" height=\"4\" bgcolor=\"$bgcolor_titre\"></td></tr></table>";
include("foot.php" );
die;
}
}
// fin Construction du tableau html
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// affichage
$nb_lim = $jnb_phpage * $nb_line;
///////////////////////////////////////////////////////
// rempli tableau des noms
$handle=opendir($directory);
$nb_photos = 0;
while ($file = readdir($handle)) {
if ($file != "." && $file != ".." && $file != "_commentaire.txt" && $file != "thumbs" && $file != "_com_img.txt" ) {
// $file contient le nom d'un fichier
$nb_photos++;
$hnamep[$nb_photos] = $file;
}
}
$hnamep[$nb_photos+1] = "";
sort($hnamep);
closedir($handle);
// fin rempli tableau des noms
//////////////////////////////////////////////////////
$int_nb_photos = nb_ph($directory); // nombre de photos
$all_nb_photos = $int_nb_photos;
$tmp_reste = $int_nb_photos % $nb_lim;
if ($tmp_reste == 0){
$int_nb_pages = $int_nb_photos / $nb_lim;
}
else{
$tmp_juste = $int_nb_photos - $tmp_reste;
$int_nb_pages = $tmp_juste / $nb_lim + 1; // nombre de pages
}
if ($first != "NO" ){
$first = "NO";
$int_no_page = 1;
}
constr_tab($int_nb_photos, $int_nb_pages, $int_no_page, $hnamep, $nb_lim, $first, $all_nb_photos, $directory, $jnb_phpage);
// fin affichage
////////////////////////////////////////////////////////////////////////////////
?></TD>
[#b84600]<TD background="../images/test_40.jpg"> </TD>
<TD background="../images/test_41-2.jpg"> </TD>
<TD background="../images/test_42-2.jpg" valign="top">
<br>
<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">**PHOTOS**</font>
<div align="center"><img src="../images/yokos.gif" width="37" height="25"></div>
</TD>
<TD background="../images/test_43-2.jpg"> </TD>
<TD background="../images/test_44-2.jpg"> </TD>
<TD background="../images/test_45.jpg"> </TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/test_46.jpg" WIDTH=15 HEIGHT=25></TD>
<TD>
<IMG SRC="../images/test_47.jpg" WIDTH=12 HEIGHT=25></TD>
<TD> <IMG SRC="../images/test_48.jpg" WIDTH=444 HEIGHT=25 usemap="#Map" border="0"></TD>
<TD>
<IMG SRC="../images/test_49.jpg" WIDTH=12 HEIGHT=25></TD>
<TD>
<IMG SRC="../images/test_50.jpg" WIDTH=35 HEIGHT=25></TD>
<TD>
<IMG SRC="../images/test_51.jpg" WIDTH=95 HEIGHT=25></TD>
<TD>
<IMG SRC="../images/test_52.jpg" WIDTH=34 HEIGHT=25></TD>
<TD>
<IMG SRC="../images/test_53.jpg" WIDTH=102 HEIGHT=25></TD>
<TD>
<IMG SRC="../images/test_54.jpg" WIDTH=32 HEIGHT=25></TD>
</TR>
</TABLE>
</div>
<map name="Map">
<area shape="rect" coords="326,10,446,26" href="mailto:asiantcho@hotmail.com">
</map>
</BODY>
</HTML>
Message édité par babylonia le 07-11-2002 à 03:03:06