#*********************************************************************************************
#                                 Fait par JGP SOLDAT
#                               Maintenu par Kana-chan
#                             Pour l'Alliance Francophone
#                             Version 5.00, le 30 mai 2007 
#                           Première version 27 janvier 2001 
#
#                     (Programme de création de la page Alliance.html)
#                 (et des pages de mini-teams et de la page miniteam.html)
#
#*********************************************************************************************

use Socket;
use DBI;
use Encode qw(decode encode);
use URI::Escape qw(uri_escape uri_unescape);

$version = "7.10";
$maintenu = "<a href=\"/code/fahCode.7z\" target=\"_blank\">Kana-chan</a> avec l'aimable participation de Dylav de Zebulon.fr";
$destWWW = "/var/www/html";
$homeWWW = "/"; #"https://fah.chezmks.fr";

$test = 0;
$test1 = 0;
$test_uid = 0;
$writeDB = 0;
$testDbg = 0;
$nom_a_trouver = "";
$jour_de_la_semaine = 0;
$use_DK_miniteam = 1;
$use_aff_semaine = 1;

($GMTsec,$GMTmin,$GMTheure) = [0, 0, 0];
($GMTsec0,$GMTmin0,$GMTheure0) = [0, 0, 0];
$place_trace = 0;

sub diff_time {
  if ($testDbg == 0) { return; }
  local ($place_debug) = @_;
  ($GMTsec, $GMTmin, $GMTheure) = (gmtime(time))[0, 1, 2];
  print($place_debug." => ".$GMTheure."h".$GMTmin."m".$GMTsec."s");
  if ($place_trace == 1) {
    my $heure = $GMTheure-$GMTheure0;
    my $minute = $GMTmin-$GMTmin0;
    my $seconde = $GMTsec-$GMTsec0;
    if ($minute > 0 and $seconde < 0) {
      $seconde = 60*$minute+$GMTsec-$GMTsec0;
      $minute -= 1;
    }
    print(" => diff: ".$heure."h".$minute."m".$seconde."s");
    $place_trace = 0;
  } else {
    ($GMTsec0, $GMTmin0, $GMTheure0) = ($GMTsec, $GMTmin, $GMTheure);
    $place_trace = 1;
  }
  print("\n");
}

sub place {
  local ($tot, $val, $record) = @_;
  return (($tot-$val+$record)-1);
}

sub format_number {
  local ($number) = @_;
  my $number_str = "".$number."";
  my $cpt_pl = length($number_str)-1;
  my $cpt_nb = 1;
  while ( $cpt_pl >= 0 ) {
    if ( $cpt_nb == 3 ) {
      if ( $cpt_pl > 0 and substr($number_str, $cpt_pl-1, 1) ne "-" ) {
        substr($number_str, $cpt_pl, 1) = "&#160;".substr($number_str, $cpt_pl, 1);
        $cpt_nb = 0;
      }
    }
    $cpt_nb++;
    $cpt_pl--;
  }
  return $number_str;
}

sub reencode_nom {
  local ($nom_encode) = @_;
  $nom_encode =~ s/%26/%2526/g;
  $nom_encode =~ s/%E7/c/g;
  $nom_encode =~ s/%e7/c/g;
  $nom_encode =~ s/ç/c/g;
  return $nom_encode;
}

sub carac_check {
  local ($nom_check) = @_;
  $nom_check =~ s/</&#60;/g;
  $nom_check =~ s/>/&#62;/g;
  return $nom_check;
}

sub decode_accent {
  local ($nom_decode) = @_;
  $nom_decode =~ s/è/e/g;
  $nom_decode =~ s/ê/e/g;
  $nom_decode =~ s/é/e/g;
  $nom_decode =~ s/ë/e/g;
  return $nom_decode;
}

sub codage_html {
  local ($nom_codage) = @_;
  $nom_codage = encode("cp1252", decode("utf8", $nom_codage));
  return $nom_codage;
}

sub codage_eoc {
  local ($eoc_codage) = @_;
  $eoc_codage =~ s/&#39/\\&#39/g;
  return $eoc_codage;
}

sub decode_html {
  local ($nom_decode) = @_;
  $nom_decode =~ s/&#62;/>/g;
  return $nom_decode;
}

# Parametres de connection a la base de donnees
$bd    = '/tmp/memory/fah.db';
$identifiant = '';      # identifiant
$motdepasse  = '';

# Connection a la base de donnees mysql
print("Connexion a la base de donnees $bd\n");
$db = DBI->connect(
        "DBI:SQLite:dbname=$bd",
        $identifiant, $motdepasse, {RaiseError => 1}
      ) or die "Connection impossible a la base de donnees $bd !\n $! \n $@\n$DBI::errstr";

@mois = ('janvier','f&eacute;vrier','mars','avril','mai','juin','juillet','ao&ucirc;t','septembre','octobre','novembre','d&eacute;cembre');
@mois1 = ('janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre');
@jour = ('dimanche','lundi','mardi','mercredi','jeudi','vendredi','samedi');

($sec,$min,$heure,$jour,$mois,$annee,$jour2) = (localtime(time))[0,1,2,3,4,5,6];
if ($sec < 10) { $sec = "0".$sec; }
if ($min < 10) { $min = "0".$min; }
if ($heure < 10) { $heure = "0".$heure; }
if ($jour < 10) { $jour = "0".$jour; }
$annee += "1900";

($GMsec,$GMmin,$GMheure,$GMjour,$GMmois,$GMannee,$GMjour2) = (gmtime(time))[0,1,2,3,4,5,6];
if ($GMsec < 10) { $GMsec = "0".$GMsec; }
if ($GMmin < 10) { $GMmin = "0".$GMmin; }
if ($GMheure < 10) { $GMheure = "0".$GMheure; }
if ($GMjour < 10) { $GMjour = "0".$GMjour; }
$GMannee += "1900";

$ip5 = "https://foldingathome.org/";
$ip6 = "https://www.alliancefrancophone.org";
$ip7 = "http://fah-web2.stanford.edu/serverstat.html";
$ip8 = "http://fah-web2.stanford.edu/psummary.html";
$url_javascript_classic = "https://statsclassic.foldingathome.org/donor/";
$url_javascript = "https://stats.foldingathome.org/donor/";
$ip_interne = ".";

$mess_auto = "<strong>Message du jour automatis&eacute; du ".$jour." ".$mois[$mois]." ".$annee." &agrave; ".$heure."h".$min."</strong>:<br>";
$mem_total = 0;
$mem_classement = 0;

$pos_retrait = 0;
$pos_ajout = 0;
$pos_membre = 0;
$debut_message = 0;
@memoire_pass = 0;
$depasse = 0;
$dep_membre[0] = "";
$dep_point[0] = 0;
$retour_que = 0;
$retour_quebec[0] = "";
$folding_image = "folding5.gif";

if ($test == 1) { print("MODE TEST\n"); }

&diff_time("DEB");
$team = 1;
while (open(file, "mini$team.team")) {
  $temp = "";
  $line = "vide";
  while ($line ne "\n" and $line ne "") {
    $line = <file>;
    if ($line ne "\n") {
      ($t1, $t2) = split(/=/,$line,2);
      ($t3, $t4) = split(/\n/,$t2,2);
      if ($t1 eq "Espace") {
        $espace[$team] = $t3;
      }
      $equipe{$t1, $team} = $t3;
    }
  }
  $tmp = 0;
  $NR[$team] = 0;
  $line = <file>; #print("LINE=$line\n");
  $pos_ret[$team] = $pos_retrait;
  $tmp = 1;
  while ($line ne "\n") {
    $line = <file>;  #print("LINE=$line\n");
    if ($line ne "\n" and $line ne "[Retrait des membres suivants]\n") {
      ($t1, $t2) = split(/\n/,$line);
      $t1 =~ s/\n//g;
      $pos_retrait++;
      $NR[$team] = $tmp;
      $retrait[$pos_retrait] = $t1;
      $tmp++;
    }
  }

  $tmp = 1;
  $NA[$team] = 0;
  $line = "vide";
  $pos_ajo[$team] = $pos_ajout;
  while ($line ne "\n" and $line ne "") {
    $line = <file>; #print("LINE=$line\n");
    if ($line ne "\n" and $line ne "[Ajout des membres ayant ces mots suivants]\n") {
      ($t1, $t2) = split(/\n/,$line,2);
      $t1 =~ s/\n//g;
      $pos_ajout++;
      $NA[$team] = $tmp;
      $ajout[$pos_ajout] = $t1;
      if ($test == 1) { print($equipe{'Miniteam', $team}." ".$pos_ajout." ".$tmp." ".$ajout[$pos_ajout]."\n"); }
      $tmp++;
    }
  }

  $tmp = 1;
  $NAM[$team] = 0;
  $line = "vide";
  $pos_mem[$team] = $pos_membre;
  while ($line ne "\n" and $line ne "") {
    $line = <file>; #print("LINE=$line\n");
    if ($line ne "\n" and $line ne "[Ajout de ces membres]\n") {
      ($t1, $t2) = split(/\n/,$line,2);
      $t1 =~ s/\n//g;
      $pos_membre++;
      $NAM[$team] = $tmp;
      $ajout_membre[$pos_membre] = $t1;
      $tmp++;
    }
  }
  close(file);
  $team++;
}
&diff_time("FIN");

$max_team = $team-1;
print("Nombre de miniteam= ".$max_team."\n");

if ($test1 == 1) {
  print("MODE TEST1\n"); 
  &diff_time("DEB");
  $team = 1;
  while ($team <= $max_team) {
    print("1 ".$equipe{"Miniteam",$team}."\n");
    print("2 ".$equipe{"Titre",$team}."\n");
    print("3 ".$equipe{"Titre1",$team}."\n");
    print("4 ".$equipe{"URL_miniteam",$team}."\n");
    print("5 ".$equipe{"Image",$team}."\n");
    print("6 ".$equipe{"Espace",$team}."\n");
    print("7 ".$equipe{"Titre2",$team}."\n");
    print("8 ".$equipe{"Titre3",$team}."\n");
    print("\n ".$NR[$team]." ".$NA[$team]." ".$NAM[$team]."\n");
    print("\n");
    $tmp = 1;
    while ($tmp-1+$pos_ret[$team] < $NR[$team]+$pos_ret[$team]) {
      print("$tmp $retrait[$pos_ret[$team]+$tmp]\n");
      $tmp++;
    }
    print("\n");
    $tmp = 1;
    while ($tmp-1+$pos_ajo[$team] < $NA[$team]+$pos_ajo[$team]) {
      print("$tmp $ajout[$pos_ajo[$team]+$tmp]\n");
      $tmp++;
    }
    print("\n");
    $tmp = 1;
    while ($tmp-1+$pos_mem[$team] < $NAM[$team]+$pos_mem[$team]) {
      print("$tmp $ajout_membre[$pos_mem[$team]+$tmp]\n");
      $tmp++;
    }
    print("\n");
    $team++;
  }
  &diff_time("FIN");
  exit;
}
$equipe{"Miniteam", 0} = "Non associes";

open(file, "pos.res"); $b = <file>; close(file);

$message_vide = 1;
open(message, '>:utf8', "message.res");
print message ($mess_auto);

open(message1, "mess_jgp.res");
@mess_jgp = <message1>;
close(message1);

open(message1, ">mess_jgp.res");
print message1 ("");
close(message1);

if (length($mess_jgp[0]) < 2) {
  print("Pas de message venant de mess-jgp--------------------\n");
} else {
  print(@mess_jgp);
  print("\n");
  print message (@mess_jgp);
  $message_vide = 0;
}

open(message2, "message_score.res");
@mess_score = <message2>;
close(message2);

if (length($mess_score[0]) < 2) {
  print("Pas de message venant de score--------------------\n");
} else {
  print(@mess_score);
  print("\n");
  print message (@mess_score);
  $message_vide = 0;
}

open(file, '>:utf8', "$destWWW/Alliance.html");
open(filemini, '>:utf8', "$destWWW/miniteam.html");
if ($use_DK_miniteam == 1) { open(fileminiDK, '>:utf8', "$destWWW/miniteam_DK.txt"); }
open(fileeffectif, '>:utf8', "$destWWW/effectif.html");
open(filegraphs, '>:utf8', "$destWWW/graphs.html");
open(filetopprod, '>:utf8', "$destWWW/topprod.html");
open(filelistmembs, '>:utf8', "$destWWW/listmembs.html");
open(doublon, '>:utf8', "doublon.log");
open(actives_passives, '>:utf8', "actives_passives.res");
open(actives_team51, '>:utf8', "$destWWW/Alliance.txt");
if ($use_aff_semaine == 0) {
  print actives_team51 ("Actifs\tAF\tFolding\tNoms des plieurs actifs\tPoints\tWU\tJ\tJ-1\tJ-2\tJ-3\tJ-4\tJ-5\tJ-6\tSemaine\tJ\tJ-1\tJ-2\tJ-3\tJ\tJ-1\tJ-2\tJ-3\n");
} else {
  print actives_team51 ("Actifs\tAF\tFolding\tNoms des plieurs actifs\tPoints\tWU\tJ\tJ-1\tJ-2\tJ-3\tJ-4\tJ-5\tJ-6\tSemaine\tJour\tSemaine\tJour\tSemaine\n");
}

&diff_time("DEB");
$team = 1;
while ($team <= $max_team) {
  if ($equipe{'Modele_de_page', $team} == 3) { $ff = $equipe{'Miniteam', $team}; $ff1 = "$equipe{'Miniteam', $team}1"; }
  if ($equipe{'Modele_de_page', $team} == 5) { $ff = $equipe{'Miniteam', $team}; $ff1 = "$equipe{'Miniteam', $team}1"; }
  open($ff, '>:utf8', "$destWWW/$ff.html"); open($ff1, '>:utf8', "$destWWW/$ff.txt");
  $first_team[$team] = 1;
  $team++;
}
&diff_time("FIN");

if ($test == 1) { print("Mode passe1\n"); }

if ($jour2 == $jour_de_la_semaine) {
  open(passage, '>:utf8', "passage.res");
  if ($test == 1) { print("On est dimanche\n"); }
}

@compare = (50000, 100000, 500000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000,
            10000000, 11000000, 12000000, 13000000, 14000000, 15000000, 16000000, 17000000, 18000000, 19000000, 20000000,
            30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000,
            100000000, 150000000, 200000000, 250000000, 300000000, 350000000, 400000000, 450000000, 500000000,
            550000000, 600000000, 650000000, 700000000, 750000000, 800000000, 850000000, 900000000, 950000000,
            1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000,
            5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 9500000000,
            10000000000, 11000000000, 12000000000, 13000000000, 14000000000, 15000000000, 16000000000, 17000000000, 18000000000, 19000000000,
            20000000000, 25000000000, 30000000000, 35000000000, 40000000000, 45000000000, 50000000000, 55000000000,
            60000000000, 65000000000, 70000000000, 75000000000, 80000000000, 85000000000, 90000000000, 95000000000,
            100000000000, 150000000000, 200000000000, 250000000000, 300000000000, 350000000000, 400000000000, 450000000000, 500000000000,
            550000000000, 600000000000, 650000000000, 700000000000, 750000000000, 800000000000, 850000000000, 900000000000, 950000000000,
            1000000000000, 1500000000000, 2000000000000, 2500000000000, 3000000000000, 3500000000000, 4000000000000, 4500000000000, 5000000000000,
            5500000000000, 6000000000000, 6500000000000, 7000000000000, 7500000000000, 8000000000000, 8500000000000, 9000000000000, 9500000000000,
            10000000000000);
$compare_point_size = $#compare;
# print $compare_point_size;
# print("\n");
# print $compare[$compare_point_size];
# print("\n");
@comp_team = (5000000, 10000000, 50000000, 100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000, 800000000, 900000000,
              1000000000, 1100000000, 1200000000, 1300000000, 1400000000, 1500000000, 1600000000, 1700000000, 1800000000, 1900000000, 2000000000,
              3000000000, 4000000000, 5000000000, 6000000000, 7000000000, 8000000000, 9000000000,
              10000000000, 20000000000, 30000000000, 40000000000, 50000000000, 60000000000, 70000000000, 80000000000, 90000000000,
              100000000000, 200000000000, 300000000000, 400000000000, 500000000000, 600000000000, 700000000000, 800000000000, 900000000000,
              1000000000000, 2000000000000, 3000000000000, 4000000000000, 5000000000000, 6000000000000, 7000000000000, 8000000000000, 9000000000000,
              10000000000000, 20000000000000, 30000000000000, 40000000000000, 50000000000000, 60000000000000, 70000000000000, 80000000000000, 90000000000000,
              100000000000000);
$compare_point_team_size = $#comp_team;
$compte_compare = 0;

@couleur_fond    = ('#8CD4F6', '#C2B998', '#C1A0B9', '#C4C7C4', '#DAC7C3', '#A2BFE4', '#AADFAA');
@couleur_bordure = ('#6F8380', '#A29978', '#A18099', '#A4A7A4', '#BAA7A3', '#829FC4', '#7C9D7C');

$t0 = 0;
$wu0 = 0;
$t1 = 0;
$t2 = 0;
$t3 = 0;
$t4 = 0;
$t5 = 0;
$t6 = 0;
$t7 = 0;
$cpu0 = 0;

$team = 1;
while ($team < $max_team+3) {
  $pointage[$team] = 0;
  $pointage_wu[$team] = 0;
  $pointageJ1[$team] = 0;
  $pointageJ2[$team] = 0;
  $pointageJ3[$team] = 0;
  $pointageJ4[$team] = 0;
  $pointageJ5[$team] = 0;
  $pointageJ6[$team] = 0;
  $pointageJ7[$team] = 0;
  $point[$team] = 0;
  $cpu[$team] = 0;
  $inactif[$team] = 0;
  $team++;
}

$tmp = 0;
while ($tmp < 32) {
  $meilleur_jour[$tmp] = 0;
  $meilleur_semaine[$tmp] = 0;
  $tmp++;
}
if ($test == 1) { print("Meilleur_jour[30]= $meilleur_jour[30]\n"); }
if ($test == 1) { print("Mode passe2\n"); }

#-------------------------- Entete de la page Alliance ----------------------------------
&Meta_html("file");
print file ("\n<title>Alliance Francophone (Folding At Home)</title>\n");
print file ("</head>\n");
&Body_html("file");
print file ("<div class=\"parag\"><h4>Les membres actifs de l'A.F. <font color=\"#A00000\">(Team 51)</font> chez<br>&nbsp;</h4></div>\n");
print file ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/".$folding_image."\"/></a></div>\n");

print file ("<br><p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
print file ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");

#-------------------------- Entete des mini-team ----------------------------------
&diff_time("DEB - entete mini");
$team = 1;
while ($team <= $max_team) {
  $ff = $equipe{'Miniteam', $team}; &Meta_html("$ff");
  print $ff ("<title>".$equipe{'Titre', $team}."</title>\n");
  if ($equipe{'Modele_de_page', $team} == 5) {
    print $ff ("<script src=\"gfbulle.js\" language =\"javascript\"></script>");
    print $ff ("<script src=\"jgp_css.js\" language =\"javascript\"></script>\n");
  }
  print $ff ("</head>\n");
  &Body_html("$ff");
  print $ff ("<div class=\"parag\"><h4>".$equipe{'Titre1', $team}." de l'<a href=\"".$ip6."\" target=\"_blank\">A.F.</a> chez<br>&nbsp;</h4></div>\n");
  print $ff ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/folding5.gif\"></a></div>\n");

  print $ff ("<br><p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
  print $ff ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");

  $team++;
}
&diff_time("FIN - entete mini");

#-------------------------- Entete de la page mini-team ----------------------------------
&Meta_html("filemini");
print filemini ("\n<meta http-equiv=\"Cache-Control\" content=\"no cache\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"Expires\" content=\"0\">");
print filemini ("<title>Les mini-teams de l'Alliance Francophone (Folding At Home)</title>\n</head>\n");
&Body_html("filemini");
print filemini ("<div class=\"parag\"><h4>Le classement des mini-teams de l'<a href=\"".$ip6."\" target=\"_blank\">A.F.</a> chez<br>&nbsp;</h4></div>\n");
print filemini ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/folding5.gif\"></a></div>\n");

print filemini ("<br><p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
print filemini ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");

print filemini ("<table class=\"corps\">\n");
print filemini ("<tr>\n");
print filemini ("<th rowspan=\"2\" colspan=\"2\">&Eacute;quipe</th>\n");
print filemini ("<th rowspan=\"2\">Points</th>\n");
print filemini ("<th rowspan=\"2\">WU</th>\n");
print filemini ("<th rowspan=\"2\" colspan=\"2\">Actifs</th>\n");
print filemini ("<th rowspan=\"2\">Inactifs</th>\n");
print filemini ("<th colspan=\"10\">Production</th>\n");
print filemini ("</tr>\n");
print filemini ("<tr>\n");
print filemini ("<th colspan=\"2\">&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th><th>J-4</th><th>J-5</th><th>J-6</th><th colspan=\"2\">Semaine</th>\n");
print filemini ("</tr>\n");

if ($use_DK_miniteam == 1) { print fileminiDK ("Rang\tEquipe\tPoints\tWU\tActifs\tInactifs\tJ\tJ-1\tJ-2\tJ-3\tJ-4\tJ-5\tJ-6\tSemaine\n"); }

if ($test == 1) { print ("Mode passe3\n"); }

&diff_time("DEB - entetes txt");
$team = 1;
while ($team <= $max_team) {
  $ff = "$equipe{'Miniteam', $team}1";
  &Entete_txt($ff, $espace[$team], $equipe{'Titre2', $team});
  $team++;
}
&diff_time("FIN - entetes txt");

if ($test == 1) { print("Mode passe4\n"); }

$actuelle1 = 8;
$b1 = $b-$actuelle1;
if ($b1 < 0) {
  $b1 = 0;
}

$tri[0] = "";
$num = 0;
if ($test == 1) { print("rec=".$b1." -> ".$b."\n"); }
$donner = "pos_Alliance, pos_general, nom, score, wu, rec, cpu";
$membre = 0;
$vert = 0;

&diff_time("DEB - liste nom");

%tri_uid = 0;
if ($test_uid == 1) { print("SELECT nom,id FROM uid\n"); }
$do = $db->prepare("SELECT nom,id FROM uid");
$ErrNum = $do->execute() or die $DBI::errstr;
while ($ErrNum >= 0 and my @data = $do->fetchrow_array()) {
  $name = $data[0];
  if ($data[1] ne "-1") {
    $tri_uid{$name} = $data[1];
  }
  if ($test_uid == 1) { print($name." ==> [".$tri_uid{$name}."]\n"); }
}

if ($test == 1) { print("SELECT nom,pos_Alliance FROM Alliance WHERE rec = ".$b."\n"); }
$do = $db->prepare("SELECT nom,pos_Alliance FROM Alliance WHERE rec = ".$b);
$ErrNum = $do->execute() or die $DBI::errstr;
while ($ErrNum >= 0 and my @data = $do->fetchrow_array()) {
  $name = $data[0];
  $name =~ s/[\"\']//g;
  $isNameVide = $name;
  $isNameVide =~ s/[ ]*//g;
  if ($name eq "") {
    $name = "Nom vide";
  }
  if ($isNameVide eq "") {
    $name = "Nom vide";
  }
  $tri[int($data[1])] = $name;
  $membre++;
  if ($test == 1) { print($membre.": ".$data[0]." ==> [".$tri[int($data[1])]."]\n"); }
}

&diff_time("FIN - liste nom");

$max1 = 0;
$mon1 = 0;
$max2 = 0;
$mon2 = 0;
$max3 = 0;
$mon3 = 0;
$num = 0;
$num1 = 0;
$num2[$team] = 0; 
$num2a[$team] = 0;
$num2x[$team] = 0;
$allo = 0;
$nouv = 0;
$perte = 0;
$mal_ecrit = 0;
$non_associer = 0;
$non_associer_pas_actif = 0;
$pas1 = 1;
$first = 1;
print("Nb Membres= ".$membre."\n");

if ($writeDB == 0) {
  print("L'ECRITURE DANS LA BASE DE DONNEES EST DESACTIVEE !!\n");
}

while ($num < $membre) {
  #--------------------------------   Alliance   ---------------------------------------------
  if ($num1 >= 100) {
    $team = 1;
    while ($team <= $max_team) {
      $tmp1 = 1;
      while ($tmp1+$pos_ajo[$team] <= $NA[$team]+$pos_ajo[$team]) {
        $yy = $ajout[$pos_ajo[$team]+$tmp1];
        $lc_yy = lc($yy);
        $uc_yy = uc($yy);
        if ($test == 1) { print($tmp1.": ".$yy."\n"); }
        if ($mem4[0] =~ /$yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$yy."</a>";
          $allo1 =~ s/\\//g;
          $mem4[0] =~ s/$yy/$allo1/g;
        } elsif ($mem4[0] =~ /$lc_yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$lc_yy."</a>";
          $allo1 =~ s/\\//g;
          $mem4[0] =~ s/$lc_yy/$allo1/g;
        } elsif ($mem4[0] =~ /$uc_yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$uc_yy."</a>";
          $allo1 =~ s/\\//g;
          $mem4[0] =~ s/$uc_yy/$allo1/g;
        }
        $tmp1++;
      }
      $team++;
    }
    &Print_page_membre("file", 0);
    #print file ("\n</table></td></tr>");
    $mem0[0] = "";
    $mem1[0] = ""; $mem2[0] = ""; $mem3[0] = ""; $mem4[0] = ""; $mem5[0] = ""; $mem6[0] = "";
    $mem7[0] = ""; $mem8[0] = ""; $mem9[0] = ""; $mem10[0] = ""; $mem11[0] = ""; $mem12[0] = "";
    $mem13[0] = ""; $mem14[0] = ""; $mem15[0] = ""; $mem16[0] = ""; $mem17[0] = ""; $mem18[0] = "";
    $mem19[0] = ""; $mem20[0] = ""; $mem21[0] = ""; $mem22[0] = ""; $mem23[0] = 0; $mem24[0] = 0;
	$mem25[0] = ""; $mem26[0] = "";
    $num1 = 0; $pas1 = 1;
  } else {
    if ($mem23[0] > 4) {
      $team = 1;
      while ($team <= $max_team) {
        $tmp1 = 1;
        while ($tmp1+$pos_ajo[$team] <= $NA[$team]+$pos_ajo[$team]) {
          $yy = $ajout[$pos_ajo[$team]+$tmp1];
          $lc_yy = lc($yy);
          $uc_yy = uc($yy);
          if ($test == 1) { print($tmp1.": ".$yy."\n"); }
          if ($mem4[0] =~ /$yy/) {
            $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$yy."</a>";
            $allo1 =~ s/\\//g;
            $mem4[0] =~ s/$yy/$allo1/g;
          } elsif ($mem4[0] =~ /$lc_yy/) {
            $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$lc_yy."</a>";
            $allo1 =~ s/\\//g;
            $mem4[0] =~ s/$lc_yy/$allo1/g;
          } elsif ($mem4[0] =~ /$uc_yy/) {
            $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$uc_yy."</a>";
            $allo1 =~ s/\\//g;
            $mem4[0] =~ s/$uc_yy/$allo1/g;
          }
          $tmp1++;
        }
        $team++;
      }
      &Print_page_membre("file", 0);
      $mem0[0] = "";
      $mem1[0] = ""; $mem2[0] = ""; $mem3[0] = ""; $mem4[0] = ""; $mem5[0] = ""; $mem6[0] = "";
      $mem7[0] = ""; $mem8[0] = ""; $mem9[0] = ""; $mem10[0] = ""; $mem11[0] = ""; $mem12[0] = "";
      $mem13[0] = ""; $mem14[0] = ""; $mem15[0] = ""; $mem16[0] = ""; $mem17[0] = ""; $mem18[0] = "";
      $mem19[0] = ""; $mem20[0] = ""; $mem21[0] = ""; $mem22[0] = ""; $mem23[0] = 0;
	  $mem25[0] = ""; $mem26[0] = "";
    }
  }
  if ($num1 == 0 and $pas1 == 1) {
    if ($first == 1) {
      print file ("<table class=\"corps\">\n");
      $first = 0;
    }
    print file ("<tr>\n");
    print file ("<th rowspan=\"2\">Actifs</th>\n");
    print file ("<th rowspan=\"2\"><a href=\"./team51.txt\" target=\"_blank\">AF</a></th>\n");
    print file ("<th rowspan=\"2\">Folding</th>\n");
    print file ("<th rowspan=\"2\">Noms des plieurs actifs</th>\n");
    print file ("<th rowspan=\"2\">Points</th>\n");
    print file ("<th rowspan=\"2\"><a href=\"".$ip8."\" target=\"_blank\">WU</a></th>\n");
    print file ("<th colspan=\"8\">Production</th>\n");
    if ($use_aff_semaine == 0) {
      print file ("<th colspan=\"4\">+/- AF</th>\n");
      print file ("<th colspan=\"4\">+/- Folding</th>\n");
	} else {
      print file ("<th colspan=\"2\">+/- AF</th>\n");
      print file ("<th colspan=\"2\">+/- Folding</th>\n");
	}
    print file ("</tr>\n");
    print file ("<tr>\n");
    print file ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th><th>J-4</th><th>J-5</th><th>J-6</th><th>Semaine</th>\n");
    if ($use_aff_semaine == 0) {
      print file ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th>\n");
      print file ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th>\n");
	} else {
      print file ("<th>Jour</th><th>Semaine</th>\n");
      print file ("<th>Jour</th><th>Semaine</th>\n");
	}
    print file ("</tr>\n");
    $pas1 = 0; 
  }
  #--------------------------------   Les Miniteam   ---------------------------------------------
  &diff_time("DEB - while miniteam 1");
  $team = 1;
  while ($team <= $max_team) {
    $ff = $equipe{'Miniteam', $team};
    if ($num2[$team] >= 50) {
      $num2[$team] = 0;
    } else {
      if ($equipe{'Modele_de_page', $team} == 3) {
        if ($mem23[$team] > 4) {
          &Print_page_membre("$ff", $team);
          $mem1[$team] = ""; $mem2[$team] = ""; $mem3[$team] = ""; $mem4[$team] = ""; $mem5[$team] = ""; $mem6[$team] = "";
          $mem7[$team] = ""; $mem8[$team] = ""; $mem9[$team] = ""; $mem10[$team] = ""; $mem11[$team] = ""; $mem12[$team] = "";
          $mem13[$team] = ""; $mem14[$team] = ""; $mem15[$team] = ""; $mem16[$team] = ""; $mem17[$team] = ""; $mem18[$team] = "";
          $mem19[$team] = ""; $mem20[$team] = ""; $mem21[$team] = ""; $mem22[$team] = ""; $mem23[$team] = 0;
		  $mem25[$team] = ""; $mem26[$team] = "";
        }
      }
    }
    if ($num2[$team] == 0 and $num2x[$team] == 0) {
      $num2x[$team] = 1;
      if ($equipe{'Modele_de_page', $team} == 3) {
        &debut_tableau3("$ff", "$ff.txt");
        $mem1[$team] = ""; $mem2[$team] = ""; $mem3[$team] = ""; $mem4[$team] = ""; $mem5[$team] = ""; $mem6[$team] = "";
        $mem7[$team] = ""; $mem8[$team] = ""; $mem9[$team] = ""; $mem10[$team] = ""; $mem11[$team] = ""; $mem12[$team] = "";
        $mem13[$team] = ""; $mem14[$team] = ""; $mem15[$team] = ""; $mem16[$team] = ""; $mem17[$team] = ""; $mem18[$team] = "";
        $mem19[$team] = ""; $mem20[$team] = ""; $mem21[$team] = ""; $mem22[$team] = ""; $mem23[$team] = 0; $mem24[$team] = 0;
		$mem25[$team] = ""; $mem26[$team] = "";
      }
      if ($equipe{'Modele_de_page', $team} == 5 ) { &debut_tableau5("$ff", "$ff.txt", $first_team[$team]); $first_team[$team] = 0; }
    }
    if ($num2[$team] == 1) { $num2x[$team] = 0; }
    $team++;
  }
  &diff_time("FIN - while miniteam 1");


  #-----------------------------------------------------------------------------------------------
  $num++;

  $actuelle = 15;
  $b1 = $b-$actuelle;
  if ($b1 < 0) {
    $b1 = 0;
  }
  
  $cpt = 0;
  while ($cpt < $actuelle+1) {
    $unite[$cpt] = -1;
    $posn[$cpt] = 0;
    $posg[$cpt] = 0;
    $cpt++;
  }

  &diff_time("DEB - info on [".$num."] => [".$tri[$num]."]");
  if ($test == 1 or $nom_a_trouver eq $tri[$num]) { print("SELECT nom,rec,pos_Alliance,pos_general,score,wu,cpu FROM Alliance WHERE nom = '".$tri[$num]."' AND rec BETWEEN ".$b1." AND ".$b."\n"); }
  $do = $db->prepare("SELECT nom,rec,pos_Alliance,pos_general,score,wu,cpu FROM Alliance WHERE nom = '".$tri[$num]."' AND rec BETWEEN ".$b1." AND ".$b);
  $ErrNum = $do->execute() or die $DBI::errstr;
  while ($ErrNum >= 0 and my @data = $do->fetchrow_array()) {
    if ($test == 1 or $nom_a_trouver eq $tri[$num]) { print("Plieur [".$data[0]."]: "); }
    if ($tri[$num] eq $data[0]) {
      $rec = place($actuelle+1, $b, $data[1]);
      if ($test == 1 or $nom_a_trouver eq $tri[$num]) { print("Record [".$rec."] => [".$data[1]."]\n"); }
      $posn[$rec] = $data[2];
      $nom[$rec] = $data[0];
      $nom[$rec] =~ s/&#39;/'/g;
      $isNomVide = $nom[$rec];
      $isNomVide =~ s/[ ]*//g;
      $b_nom[$rec] = $data[0];
      $b_nom[$rec] =~ s/&#39;/'/g;
      if ($nom[$rec] eq "_") { $nom[$rec] = "Nom incorrect"; }
      if ($isNomVide eq "") { $nom[$rec] = "Nom vide"; }
      $posg[$rec] = $data[3];
      $unite[$rec] = int($data[4]);
      $wu[$rec] = int($data[5]);
      $cpu[$rec] = $data[6];
    }
  }
  &diff_time("FIN - info on [".$tri[$num]."]");

  if ($posn[$rec]%100 == 0 and $test == 1) { print("Position N: ".$posn[$rec]."\n"); }
  if ($unite[0] == -1) { $unite[0] =0; $memoire = 0; } else { $memoire = $unite[0]; }
  if ($unite[1] == -1) { $unite[1] = $memoire; } else { $memoire = $unite[0]; }
  if ($unite[2] == -1) { $unite[2] = $memoire; } else { $memoire = $unite[1]; }
  if ($unite[3] == -1) { $unite[3] = $memoire; } else { $memoire = $unite[3]; }
  if ($unite[4] == -1) { $unite[4] = $memoire; } else { $memoire = $unite[4]; }
  if ($unite[5] == -1) { $unite[5] = $memoire; } else { $memoire = $unite[5]; }
  if ($unite[6] == -1) { $unite[6] = $memoire; } else { $memoire = $unite[6]; }
  if ($unite[7] == -1) { $unite[7] = $memoire; } else { $memoire = $unite[7]; }
  if ($unite[8] == -1) { $unite[8] = $memoire; } else { $memoire = $unite[8]; }
  if ($unite[9] == -1) { $unite[9] = $memoire; } else { $memoire = $unite[9]; }
  if ($unite[10] == -1) { $unite[10] = $memoire; } else { $memoire = $unite[10]; }
  if ($unite[11] == -1) { $unite[11] = $memoire; } else { $memoire = $unite[11]; }
  if ($unite[12] == -1) { $unite[12] = $memoire; } else { $memoire = $unite[12]; }
  if ($unite[13] == -1) { $unite[13] = $memoire; } else { $memoire = $unite[13]; }
  if ($unite[14] == -1) { $unite[14] = $memoire; } else { $memoire = $unite[14]; }

  $u1 = $unite[$actuelle]-$unite[$actuelle-1]; $u2 = $unite[$actuelle-1]-$unite[$actuelle-2];
  $u3 = $unite[$actuelle-2]-$unite[$actuelle-3]; $u4 = $unite[$actuelle-3]-$unite[$actuelle-4];
  $u5 = $unite[$actuelle-4]-$unite[$actuelle-5]; $u6 = $unite[$actuelle-5]-$unite[$actuelle-6];
  $u7 = $unite[$actuelle-6]-$unite[$actuelle-7];

  $u8 = $unite[$actuelle-7]-$unite[$actuelle-8]; $u9 = $unite[$actuelle-8]-$unite[$actuelle-9];
  $u10 = $unite[$actuelle-9]-$unite[$actuelle-10]; $u11 = $unite[$actuelle-10]-$unite[$actuelle-11];
  $u12 = $unite[$actuelle-11]-$unite[$actuelle-12]; $u13 = $unite[$actuelle-12]-$unite[$actuelle-13];
  $u14 = $unite[$actuelle-13]-$unite[$actuelle-14];

  $tri1[$num] = $u1;
  if ($u1 > $max1) { $max3 = $max2; $mon3 = $mon2; $max2 = $max1; $mon2 = $mon1; $max1 = $u1; $mon1 = $num; }
  elsif ($u1 > $max2 and $u1 < $max1) { $max3 = $max2; $mon3 = $mon2; $max2 = $u1; $mon2 = $num; }
  elsif ($u1 > $max3 and $u1 < $max2 and $u1 < $max1) { $max3 = $u1; $mon3 = $num; }

  if ($posg[$actuelle-1] > 0) { $p1 = $posn[$actuelle-1]-$posn[$actuelle]; $g1 = $posg[$actuelle-1]-$posg[$actuelle]; }
  else { $p1 = "???"; $g1 = "???"; $posn[$actuelle-1] = $posn[$actuelle]; $posg[$actuelle-1] = $posg[$actuelle]; }

  if ($posg[$actuelle-2] > 0) { $p2 = $posn[$actuelle-2]-$posn[$actuelle-1]; $g2 = $posg[$actuelle-2]-$posg[$actuelle-1]; }
  else { $p2 = "???"; $g2 = "???"; $posn[$actuelle-2] = $posn[$actuelle-1]; $posg[$actuelle-2] = $posg[$actuelle-1]; }

  if ($posg[$actuelle-3] > 0) { $p3 = $posn[$actuelle-3]-$posn[$actuelle-2]; $g3 = $posg[$actuelle-3]-$posg[$actuelle-2]; }
  else { $p3 = "???"; $g3 = "???"; $posn[$actuelle-3] = $posn[$actuelle-2]; $posg[$actuelle-3] = $posg[$actuelle-2]; }

  if ($posg[$actuelle-4] > 0) { $p4 = $posn[$actuelle-4]-$posn[$actuelle-3]; $g4 = $posg[$actuelle-4]-$posg[$actuelle-3]; }
  else { $p4 = "???"; $g4 = "???"; $posn[$actuelle-4] = $posn[$actuelle-3]; $posg[$actuelle-4] = $posg[$actuelle-3]; }

  if ($posg[$actuelle-5] > 0) { $p5 = $posn[$actuelle-5]-$posn[$actuelle-4]; $g5 = $posg[$actuelle-5]-$posg[$actuelle-4]; }
  else { $p5 = "???"; $g5 = "???"; $posn[$actuelle-5] = $posn[$actuelle-4]; $posg[$actuelle-5] = $posg[$actuelle-4]; }

  if ($posg[$actuelle-6] > 0) { $p6 = $posn[$actuelle-6]-$posn[$actuelle-5]; $g6 = $posg[$actuelle-6]-$posg[$actuelle-5]; }
  else { $p6 = "???"; $g6 = "???"; $posn[$actuelle-6] = $posn[$actuelle-5]; $posg[$actuelle-6] = $posg[$actuelle-5]; }

  if ($posg[$actuelle-7] > 0) { $p7 = $posn[$actuelle-7]-$posn[$actuelle-6]; $g7 = $posg[$actuelle-7]-$posg[$actuelle-6]; }
  else { $p7 = "???"; $g7 = "???"; $posn[$actuelle-7] = $posn[$actuelle-6]; $posg[$actuelle-7] = $posg[$actuelle-6]; }

  if ($posg[$actuelle-8] > 0) { $p8 = $posn[$actuelle-8]-$posn[$actuelle-7]; $g8 = $posg[$actuelle-8]-$posg[$actuelle-7]; }
  else { $p8 = "???"; $g8 = "???"; $posn[$actuelle-8] = $posn[$actuelle-7]; $posg[$actuelle-8] = $posg[$actuelle-7]; }

  if ($posg[$actuelle-9] > 0) { $p9 = $posn[$actuelle-9]-$posn[$actuelle-8]; $g9 = $posg[$actuelle-9]-$posg[$actuelle-8]; }
  else { $p9 = "???"; $g9 = "???"; $posn[$actuelle-9] = $posn[$actuelle-8]; $posg[$actuelle-9] = $posg[$actuelle-8]; }

  if ($posg[$actuelle-10] > 0) { $p10 = $posn[$actuelle-10]-$posn[$actuelle-9]; $g10 = $posg[$actuelle-10]-$posg[$actuelle-9]; }
  else { $p10 = "???"; $g10 = "???"; $posn[$actuelle-10] = $posn[$actuelle-9]; $posg[$actuelle-10] = $posg[$actuelle-9]; }

  if ($posg[$actuelle-11] > 0) { $p11 = $posn[$actuelle-11]-$posn[$actuelle-10]; $g11 = $posg[$actuelle-11]-$posg[$actuelle-10]; }
  else { $p11 = "???"; $g11 = "???"; $posn[$actuelle-11] = $posn[$actuelle-10]; $posg[$actuelle-11] = $posg[$actuelle-10]; }

  if ($posg[$actuelle-12] > 0) { $p12 = $posn[$actuelle-12]-$posn[$actuelle-11]; $g12 = $posg[$actuelle-12]-$posg[$actuelle-11]; }
  else { $p12 = "???"; $g12 = "???"; $posn[$actuelle-12] = $posn[$actuelle-11]; $posg[$actuelle-12] = $posg[$actuelle-11]; }

  if ($posg[$actuelle-13] > 0) { $p13 = $posn[$actuelle-13]-$posn[$actuelle-12]; $g13 = $posg[$actuelle-13]-$posg[$actuelle-12]; }
  else { $p13 = "???"; $g13 = "???"; $posn[$actuelle-13] = $posn[$actuelle-12]; $posg[$actuelle-13] = $posg[$actuelle-12]; }

  if ($posg[$actuelle-14] > 0) { $p14 = $posn[$actuelle-14]-$posn[$actuelle-13]; $g14 = $posg[$actuelle-14]-$posg[$actuelle-13]; }
  else { $p14 = "???"; $g14 = "???"; }

  #-------------------------------------------------------------------------------------------------------------
  #-------------------------------------------------- message --------------------------------------------------
  #-------------------------------------- Changement de place au classement ------------------------------------
  #-------------------------------------------------------------------------------------------------------------
  if ($num < 11) {
    if ($p1 > 0) {
      print message ("Changement de position parmi nos 10 meilleurs producteurs. ");
      print message ("<font color=\"green\"><strong>".$nom[$actuelle]."</strong></font> a grimp&eacute; &agrave; la ");
      if ($num == 1) { print message ("<strong>".$num."</strong><sup>&egrave;re</sup>"); } elsif ($num == 2) { print message ("<strong>".$num."</strong><sup>nde</sup>"); } else { print message ("<strong>".$num."</strong><sup>&egrave;me</sup>"); }
      print message (" position de notre classement interne,");
      print message (" une hausse ");
      if ($p1 > 1) { print message ("de ".$p1." positions.<br>\n"); } else { print message ("d'une position.<br>\n"); }
      $message_vide = 0;
    }
  }
  if ($num > 10 and $num < 30) {
    if ($p1 > 0) {
      print message ("<font color=\"green\"><strong>".$nom[$actuelle]."</strong></font>"); 
      if ($memoire_pass[2] > 1) { print message (", un autre parmi les 30 meilleurs producteurs de notre &eacute;quipe,"); }
      if ($memoire_pass[2] == 0) { print message (", l'un des 30 meilleurs producteurs de notre &eacute;quipe,"); }
      if ($memoire_pass[2] == 0 or $memoire_pass[2] > 1) {
        print message (" a grimp&eacute; &agrave; la <strong>".$num."</strong><sup>");
        if ($num == 1) {
          print message ("&egrave;re");
        } elsif ($num == 2) {
          print message ("nde");
        } else {
          print message ("&egrave;me");
        }
        print message ("</sup> position du classement de l'Alliance Francophone, une hausse ");
      }
      if ($memoire_pass[2] == 1) { print message (" a aussi grimp&eacute; "); }
      if ($p1 > 1) { print message ("de ".$p1." positions");} else {print message ("d'une position"); }
      if ($memoire_pass[2] == 1) {
        print message (" en passant au <strong>".$num."</strong><sup>");
        if ($num ==1) {
          print message ("er");
        }elsif ($num == 2) {
          print message ("nd");
        } else {
          print message ("&egrave;me");
        }
        print message ("</sup> rang de nos meilleurs producteurs");
      }
      print message (".<br>\n");
      $memoire_pass[2]++;
      $message_vide = 0;
    }
  }
  if ($num == 30) {
    if ($p1 > 0) {
      print message ("Avec une hausse ");
      if ($p1 > 1) { print message ("de ".$p1." positions"); } else { print message ("d'une position"); }
      print message (", <font color=\"green\"><strong>".$nom[$actuelle]."</strong></font> fait maintenant partie des 30 meilleurs producteurs de notre");
      print message (" &eacute;quipe en atteignant la position <strong>".$num."</strong> de notre classement.<br>\n");
      $message_vide = 0;
    }
  }
  if ($posg[$actuelle] < 100) {
    if ($g1 > 0) {
      $memoire_pass[0]++;
      print message ("<font color=\"green\"><strong>".$nom[$actuelle]."</strong></font> a ");
      if ($memoire_pass[0] == 2) { print message ("aussi "); }
      if ($memoire_pass[0] > 2) { print message ("&eacute;galement "); }
      print message ("<u>gagn&eacute;</u> ");
      if ($g1 > 1) { print message ($g1." positions"); } else { print message ("une position"); }
      print message (" au classement des 100 meilleurs mondiaux. <strong>:)</strong>  ");
      print message ("Selon Stanford, il est maintenant rendu &agrave; la <strong>".$posg[$actuelle]."</strong><sup>&egrave;me</sup> position.<br>\n");
      $message_vide = 0;
    }
    if ($g1 < 0) {
      $memoire_pass[1]++;
      print message ("<font color=\"green\"><strong>".$nom[$actuelle]."</strong></font> a ");
      if ($memoire_pass[1] == 2) { print message ("aussi "); }
      if ($memoire_pass[1] > 2) { print message ("&eacute;galement "); }
      print message ("<u>perdu</u> ");
      $g1x = $g1*-1;
      if ($g1 == -1) { print message ("une position"); } else { print message ($g1x." positions"); }
      print message (" au classement des 100 meilleurs mondiaux. <strong>:(</strong>  ");
      print message ("Selon Stanford, il est maintenant rendu &agrave; la <strong>".$posg[$actuelle]."</strong><sup>&egrave;me</sup> position.<br>\n");
      $message_vide = 0;
    }
  }

  #-------------------------------------------  Fichier TXT  -----------------------------------------------------
  if ($b_nom[$actuelle] eq "Cyg") { $b_nom[$actuelle] = "Cyg\@ce"; $nom[$actuelle] = "Cyg\@ce"; }
  $team = 1;
  &diff_time("DEB - write txt for [".$b_nom[$actuelle]."]");
  $found = 0;
  while ($team <= $max_team and $found == 0) {
    $ff1 = "$equipe{'Miniteam', $team}1";
    $lec = &TEST($b_nom[$actuelle], $team, "TXT");
    if ($lec == 1) { 
      if ($test == 1 or $nom_a_trouver eq $tri[$num]) { print("Test OK pour [".$b_nom[$actuelle]."] a position [".$posg[$actuelle]."]\n"); }
      &Print_txt($ff1, $point[$team], $posn[$actuelle], $posg[$actuelle], $b_nom[$actuelle], $unite[$actuelle], $wu[$actuelle], 0);
      $found = 1;
    }
    $team++;
  }
  &diff_time("FIN - write txt for [".$b_nom[$actuelle]."]");
  if ( $u1+$u2+$u3+$u4+$u5+$u6+$u7 <= 0 ) {
    #-----------------------------------Addition des membres non actif---------------------------------------------- 
    &diff_time("DEB - check for non actif [".$b_nom[$actuelle]."]");
    $mem_non_associer = 0;
    $team = 1;
    $found = 0;
    while ($team <= $max_team and $found == 0) {
      $lec = &TEST($b_nom[$actuelle], $team, "Non Actif");
      if ($lec == 1) { $pointage[$team] += $unite[$actuelle]; $pointage_wu[$team] += $wu[$actuelle]; $point[$team]++; $mem_non_associer++; $inactif[$team]++; $found = 1; }
      $team++;
    }
    &diff_time("FIN - check for non actif [".$b_nom[$actuelle]."]");
    $team++;
    if ($mem_non_associer > 1) { print doublon ("DOUBLE NON ACTIF avec ".$b_nom[$actuelle]." = ".$mem_non_associer."\n"); }
    if ($mem_non_associer == 0) { $non_associer_pas_actif++; $pointage[$team] += $unite[$actuelle]; $pointage_wu[$team] += $wu[$actuelle]; $pointageJ1[$team] += $u1; $pointageJ2[$team] += $u2; $pointageJ3[$team] += $u3; $pointageJ4[$team] += $u4; $pointageJ5[$team] += $u5; $pointageJ6[$team] += $u6; $pointageJ7[$team] += $u7; $cpu[$team] += $cpu[$actuelle]; }
  }
  else
  {
    $ut = $u1+$u2+$u3+$u4+$u5+$u6+$u7;
    #---------------------------------------------  Alliance  --------------------------------------------------------        
    ($xyz, $tx1) = split(/"/, $b_nom[$actuelle], 2);
    $xyz =~ s/&#39;/'/g;
    # if ($xyz eq "Cyg") {$xyz="Cyg\@ce";}
    #---------------------------------------------   FILTRE   --------------------------------------------------------        

    $xyz =~ s/!/%21/g;
    $xyz =~ s/\"/%22/g;
    $xyz =~ s/#/%23/g;
    $xyz =~ s/&/%26/g;
    $xyz =~ s/\'/%27/g;
    $xyz =~ s/\(/%28/g;
    $xyz =~ s/\)/%29/g;
    $xyz =~ s/\*/%2A/g;
    $xyz =~ s/,/%2C/g;
    $xyz =~ s/-/%2D/g;
    $xyz =~ s/\./%2E/g;
    $xyz =~ s/\//%2F/g;
    $xyz =~ s/:/%3A/g;
    $xyz =~ s/;/%3B/g;
    $xyz =~ s/</%3C/g;
    $xyz =~ s/=/%3D/g;
    $xyz =~ s/>/%3E/g;
    $xyz =~ s/\?/%3F/g;
    $xyz =~ s/\[/%5B/g;
    # $xyz =~ s/\\/%5C/g;
    $xyz =~ s/\]/%5D/g;
    $xyz =~ s/_/%5F/g;
    $xyz =~ s/{/%7B/g;
    $xyz =~ s/}/%7D/g;

    #-------------------------------------------------------------------------------------------------------------------
    $vert++;
    $nom_affiche = carac_check($b_nom[$actuelle]);
    $nom[$actuelle] = &change_nom($nom_affiche);
    &tableau3("file", $posn[$actuelle], $vert, $posg[$actuelle], $nom_affiche);
    $num1++;
    if ($jour2 == $jour_de_la_semaine) {
      &diff_time("DEB - info day for [".$b_nom[$actuelle]."]");
      $tmp = $compare_point_size;
      while ($tmp >= 0) {
        if ($unite[$actuelle] >= $compare[$tmp] and $compare[$tmp] > $unite[$actuelle-7]) {
          $compte_compare++;
          $liste_com[$compte_compare] = "<tr><td>".$nom[$actuelle]."</td><td> a d&eacute;pass&eacute; les <u>".format_number($compare[$tmp])."</u> points</td></tr>\n";
          $tmp = -1;
        }
        $tmp--;
      }
      &diff_time("FIN - info day for [".$b_nom[$actuelle]."]");
    }
    #---------------------------------------------------------------------------------------------------------------------
    #--------------------------------------------------- autre message ---------------------------------------------------
    #--------------------------------------------- Points dépassés par ???? ---------------------------------------------- 
    #---------------------------------------------------------------------------------------------------------------------
    $tmp = $compare_point_size;
    &diff_time("DEB - depasse [".$b_nom[$actuelle]."]");
    while ($tmp >= 0) {
      if ($unite[$actuelle] >= $compare[$tmp] and $compare[$tmp] > $unite[$actuelle-1]) {
        $depasse++;
        $dep_membre[$depasse] = $nom[$actuelle]; 
        $dep_point[$depasse] = $compare[$tmp];
        $tmp = 0;
      }
      $tmp--;
      if ($compare[$tmp] < 50000) { $tmp = -1; } 
    }
    &diff_time("FIN - depasse [".$b_nom[$actuelle]."]");

    if ($ut > $meilleur_semaine[30]) {
      &diff_time("DEB - meilleur [".$b_nom[$actuelle]."]");
      $tmp = 30;
      while ($tmp >= 0) {
        if ($ut > $meilleur_semaine[$tmp] and $tmp > 0) { 
          $meilleur_semaine[$tmp+1] = $meilleur_semaine[$tmp];
          $xyz_semaine[$tmp+1] = $xyz_semaine[$tmp];
          $b_nom_semaine[$tmp+1] = $b_nom_semaine[$tmp];
          $nom_semaine[$tmp+1] = $nom_semaine[$tmp];
          $wu_semaine[$tmp+1] = $wu_semaine[$tmp];
          $posn_semaine[$tmp+1] = $posn_semaine[$tmp];
          $posg_semaine[$tmp+1] = $posg_semaine[$tmp];
          $num_semaine[$tmp+1] = $num_semaine[$tmp];
          $unite_semaine[$tmp+1] = $unite_semaine[$tmp];
          $u1_semaine[$tmp+1] = $u1_semaine[$tmp]; $u2_semaine[$tmp+1] = $u2_semaine[$tmp];
          $u3_semaine[$tmp+1] = $u3_semaine[$tmp]; $u4_semaine[$tmp+1] = $u4_semaine[$tmp];
          $u5_semaine[$tmp+1] = $u5_semaine[$tmp]; $u6_semaine[$tmp+1] = $u6_semaine[$tmp];
          $u7_semaine[$tmp+1] = $u7_semaine[$tmp]; $ut_semaine[$tmp+1] = $ut_semaine[$tmp];
          $g1_semaine[$tmp+1] = $g1_semaine[$tmp]; $g2_semaine[$tmp+1] = $g2_semaine[$tmp];
          $g3_semaine[$tmp+1] = $g3_semaine[$tmp]; $g4_semaine[$tmp+1] = $g4_semaine[$tmp];
          $g5_semaine[$tmp+1] = $g5_semaine[$tmp]; $g6_semaine[$tmp+1] = $g6_semaine[$tmp];
          $g7_semaine[$tmp+1] = $g7_semaine[$tmp];
          $p1_semaine[$tmp+1] = $p1_semaine[$tmp]; $p2_semaine[$tmp+1] = $p2_semaine[$tmp];
          $p3_semaine[$tmp+1] = $p3_semaine[$tmp]; $p4_semaine[$tmp+1] = $p4_semaine[$tmp];
          $p5_semaine[$tmp+1] = $p5_semaine[$tmp]; $p6_semaine[$tmp+1] = $p6_semaine[$tmp];
          $p7_semaine[$tmp+1] = $p7_semaine[$tmp];
          $tmp--;
        } else {
          $meilleur_semaine[$tmp+1] = $ut;
          $xyz_semaine[$tmp+1] = $xyz;
          $b_nom_semaine[$tmp+1] = $b_nom[$actuelle];
          $nom_semaine[$tmp+1] = $nom[$actuelle];
          $wu_semaine[$tmp+1] = $wu[$actuelle];
          $posn_semaine[$tmp+1] = $posn[$actuelle];
          $posg_semaine[$tmp+1] = $posg[$actuelle];
          $num_semaine[$tmp+1] = $num;  
          $unite_semaine[$tmp+1] = $unite[$actuelle];
          $u1_semaine[$tmp+1] = $u1; $u2_semaine[$tmp+1] = $u2; $u3_semaine[$tmp+1] = $u3; $u4_semaine[$tmp+1] = $u4;
          $u5_semaine[$tmp+1] = $u5; $u6_semaine[$tmp+1] = $u6; $u7_semaine[$tmp+1] = $u7; $ut_semaine[$tmp+1] = $ut;
          $g1_semaine[$tmp+1] = $g1; $g2_semaine[$tmp+1] = $g2; $g3_semaine[$tmp+1] = $g3; $g4_semaine[$tmp+1] = $g4;
          $g5_semaine[$tmp+1] = $g5; $g6_semaine[$tmp+1] = $g6; $g7_semaine[$tmp+1] = $g7;
          $p1_semaine[$tmp+1] = $p1; $p2_semaine[$tmp+1] = $p2; $p3_semaine[$tmp+1] = $p3; $p4_semaine[$tmp+1] = $p4;
          $p5_semaine[$tmp+1] = $p5; $p6_semaine[$tmp+1] = $p6; $p7_semaine[$tmp+1] = $p7;
          $tmp = -1;
        }        
      }
      &diff_time("FIN - meilleur [".$b_nom[$actuelle]."]");
    }
    if ($u1 > $meilleur_jour[30]) {
      &diff_time("DEB - meilleur jour [".$b_nom[$actuelle]."]");
      $tmp = 30;
      while ($tmp >= 0) {
        if ($u1 > $meilleur_jour[$tmp] and $tmp > 0) {
          $meilleur_jour[$tmp+1] = $meilleur_jour[$tmp];
          $xyz_jour[$tmp+1] = $xyz_jour[$tmp];
          $b_nom_jour[$tmp+1] = $b_nom_jour[$tmp];
          $nom_jour[$tmp+1] = $nom_jour[$tmp];
          $wu_jour[$tmp+1] = $wu_jour[$tmp];
          $posn_jour[$tmp+1] = $posn_jour[$tmp];
          $posg_jour[$tmp+1] = $posg_jour[$tmp];
          $num_jour[$tmp+1] = $num_jour[$tmp];
          $unite_jour[$tmp+1] = $unite_jour[$tmp];
          $u1_jour[$tmp+1] = $u1_jour[$tmp]; $u2_jour[$tmp+1] = $u2_jour[$tmp]; $u3_jour[$tmp+1] = $u3_jour[$tmp]; 
          $u4_jour[$tmp+1] = $u4_jour[$tmp]; $u5_jour[$tmp+1] = $u5_jour[$tmp]; $u6_jour[$tmp+1] = $u6_jour[$tmp];
          $u7_jour[$tmp+1] = $u7_jour[$tmp]; $ut_jour[$tmp+1] = $ut_jour[$tmp]; $g1_jour[$tmp+1] = $g1_jour[$tmp]; 
          $g2_jour[$tmp+1] = $g2_jour[$tmp]; $g3_jour[$tmp+1] = $g3_jour[$tmp]; $g4_jour[$tmp+1] = $g4_jour[$tmp];
          $g5_jour[$tmp+1] = $g5_jour[$tmp]; $g6_jour[$tmp+1] = $g6_jour[$tmp]; $g7_jour[$tmp+1] = $g7_jour[$tmp];
          $p1_jour[$tmp+1] = $p1_jour[$tmp]; $p2_jour[$tmp+1] = $p2_jour[$tmp]; $p3_jour[$tmp+1] = $p3_jour[$tmp];
		  $p4_jour[$tmp+1] = $p4_jour[$tmp]; $p5_jour[$tmp+1] = $p5_jour[$tmp]; $p6_jour[$tmp+1] = $p6_jour[$tmp];
		  $p7_jour[$tmp+1] = $p7_jour[$tmp];
          $tmp--;
        } else {
          $meilleur_jour[$tmp+1] = $u1;
          $xyz_jour[$tmp+1] = $xyz;
          $b_nom_jour[$tmp+1] = $b_nom[$actuelle];
          $nom_jour[$tmp+1] = $nom[$actuelle];
          $wu_jour[$tmp+1] = $wu[$actuelle];
          $posn_jour[$tmp+1] = $posn[$actuelle];
          $posg_jour[$tmp+1] = $posg[$actuelle];
          $num_jour[$tmp+1] = $num;
          $unite_jour[$tmp+1] = $unite[$actuelle];
          $u1_jour[$tmp+1] = $u1; $u2_jour[$tmp+1] = $u2; $u3_jour[$tmp+1] = $u3; $u4_jour[$tmp+1] = $u4;
          $u5_jour[$tmp+1] = $u5; $u6_jour[$tmp+1] = $u6; $u7_jour[$tmp+1] = $u7; $ut_jour[$tmp+1] = $ut;
          $g1_jour[$tmp+1] = $g1; $g2_jour[$tmp+1] = $g2; $g3_jour[$tmp+1] = $g3; $g4_jour[$tmp+1] = $g4;
          $g5_jour[$tmp+1] = $g5; $g6_jour[$tmp+1] = $g6; $g7_jour[$tmp+1] = $g7;
          $p1_jour[$tmp+1] = $p1; $p2_jour[$tmp+1] = $p2; $p3_jour[$tmp+1] = $p3; $p4_jour[$tmp+1] = $p4;
          $p5_jour[$tmp+1] = $p5; $p6_jour[$tmp+1] = $p6; $p7_jour[$tmp+1] = $p7;
          $tmp = -1;
        }        
      }
      &diff_time("FIN - meilleur jour [".$b_nom[$actuelle]."]");
    }

    #---------------------------------------------------------------------------------------------------------------------
    #---------------------------------------------  Les Miniteam  --------------------------------------------------------        
    #---------------------------------------------------------------------------------------------------------------------
    &diff_time("DEB - ajout dans miniteam pour [".$b_nom[$actuelle]."]");
    $mem_non_associer = 0;
    $team = 1;
    while ($team <= $max_team) {
      $ff = $equipe{'Miniteam', $team};
      $lec = &TEST($b_nom[$actuelle], $team, "Miniteam");   
      if ($lec == 1) {
        $num2[$team]++; $num2a[$team]++;
        if ($equipe{'Modele_de_page', $team} == 3) { &tableau3($team, $num2a[$team], $point[$team]+1, $posn[$actuelle], $nom[$actuelle]); }
        if ($equipe{'Modele_de_page', $team} == 5) { &tableau5("$ff", $num2a[$team], $point[$team]+1, $posn[$actuelle]); }
        $point[$team]++; $pointage[$team] += $unite[$actuelle]; $pointage_wu[$team] += $wu[$actuelle];
        $pointageJ1[$team] += $u1; $pointageJ2[$team] += $u2;
        $pointageJ3[$team] += $u3; $pointageJ4[$team] += $u4;
        $pointageJ5[$team] += $u5; $pointageJ6[$team] += $u6;
        $pointageJ7[$team] += $u7; $cpu[$team] += $cpu[$actuelle];
        $mem_non_associer++;
      }
      $team++;
    }
    if ($mem_non_associer > 1) { print doublon ("DOUBLE TEAM avec $b_nom[$actuelle] = $mem_non_associer\n"); }
    if ($mem_non_associer == 0) { $non_associer++; $pointage[$team] += $unite[$actuelle]; $pointage_wu[$team] += $wu[$actuelle]; $pointageJ1[$team] += $u1; $pointageJ2[$team] += $u2; $pointageJ3[$team] += $u3; $pointageJ4[$team] += $u4; $pointageJ5[$team] += $u5; $pointageJ6[$team] += $u6; $pointageJ7[$team] += $u7; $cpu[$team] += $cpu[$actuelle]; }
    &diff_time("FIN - ajout dans miniteam pour [".$b_nom[$actuelle]."]");
    #-----------------------
  }
  $t0 += $unite[$actuelle]; $wu0 += $wu[$actuelle]; $t1 += $u1; $t2 += $u2; $t3 += $u3; $t4 += $u4; $t5 += $u5; $t6 += $u6; $t7 += $u7; $cpu0 += $cpu[$actuelle];
}

close(doublon);

#----------------------- Fermeture des tableaux -------------------------------------
$t8 = $t1+$t2+$t3+$t4+$t5+$t6+$t7;
$team = 1;
while ($team < $max_team+3) {
  $pointageTOTAL[$team] = $pointageJ1[$team]+$pointageJ2[$team]+$pointageJ3[$team]+$pointageJ4[$team]+$pointageJ5[$team]+$pointageJ6[$team]+$pointageJ7[$team];
  $team++;
}

if ($mem23[0] > 0) {
  $team = 1;
  while ($team <= $max_team) {
    $tmp1 = 1;
    while ($tmp1+$pos_ajo[$team] <= $NA[$team]+$pos_ajo[$team]) {
      $yy = $ajout[$pos_ajo[$team]+$tmp1];
      $lc_yy = lc($yy);
      $uc_yy = uc($yy);
      if ($test == 1) { print($tmp1.": ".$yy."\n"); }
      if ($mem4[0] =~ /$yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$yy."</a>";
        $allo1 =~ s/\\//g;
        $mem4[0] =~ s/$yy/$allo1/g;
      } elsif ($mem4[0] =~ /$lc_yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$lc_yy."</a>";
        $allo1 =~ s/\\//g;
        $mem4[0] =~ s/$lc_yy/$allo1/g;
      } elsif ($mem4[0] =~ /$uc_yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$uc_yy."</a>";
        $allo1 =~ s/\\//g;
        $mem4[0] =~ s/$uc_yy/$allo1/g;
      }
      $tmp1++;
    }
    $team++;
  }
  &Print_page_membre("file", 0);
}

my $format_t0 = format_number($t0);
my $format_wu0 = format_number($wu0);
my $format_t1 = format_number($t1);
my $format_t2 = format_number($t2);
my $format_t3 = format_number($t3);
my $format_t4 = format_number($t4);
my $format_t5 = format_number($t5);
my $format_t6 = format_number($t6);
my $format_t7 = format_number($t7);
my $format_t8 = format_number($t8);

print file "<td colspan=\"4\" align=\"left\">TOTAUX: (Membres actifs et non actifs)</td>\n";
print file "<td>".$format_t0."</td><td>".$format_wu0."</td><td>".$format_t1."</td>\n";
print file "<td>".$format_t2."</td><td>".$format_t3."</td>";
print file "<td>".$format_t4."</td><td>".$format_t5."</td>";
print file "<td>".$format_t6."</td><td>".$format_t7."</td>";
print file "<td>".$format_t8."</td>";
print file "<td colspan=\"8\">&#160;</td></tr>\n";

&diff_time("DEB - while de fin");
$team = 1;
while ($team <= $max_team) {
  $equ[$team] = $pointage[$team];
  $equJ[$team] = $pointageJ1[$team];
  $equS[$team] = $pointageTOTAL[$team];
  $team++;
}
$tmp = 1;
while ($tmp <= $max_team) {
  if ($equ[$tmp] < $equ[$tmp+1]) {
    $temp = $equ[$tmp]; $equ[$tmp] = $equ[$tmp+1]; $equ[$tmp+1] = $temp; $tmp = 0;
  }
  $tmp++;
}
$tmp = 1;
while ($tmp <= $max_team) {
  if ($equJ[$tmp] < $equJ[$tmp+1]) {
    $temp = $equJ[$tmp]; $equJ[$tmp] = $equJ[$tmp+1]; $equJ[$tmp+1] = $temp; $tmp = 0;
  }
  $tmp++;
}
$tmp = 1;
while ($tmp <= $max_team) {
  if ($equS[$tmp] < $equS[$tmp+1]) {
    $temp = $equS[$tmp]; $equS[$tmp] = $equS[$tmp+1]; $equS[$tmp+1] = $temp; $tmp = 0;
  }
  $tmp++;
}
if ($test == 1) {
  $tmp = 1;
  while ($tmp <= $max_team) { print ("equ$tmp= $equ[$tmp] => $equJ[$tmp] => $equS[$tmp]\n"); $tmp++; } # Essai tris
}
&diff_time("FIN - while de fin");
if ($test == 1) { print("Passe1\n"); }
#--------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------    MESSAGES    --------------------------------------------------
#-------------------------------------------------- Dépasse points ----------------------------------------------
#--------------------------------------------------------------------------------------------------------------------
$tmp = 0;
$tmp3 = 0;
if ($depasse > 0) {
  while ($depasse > $tmp) {
    if ($tmp3 > 0) {
      if ($depasse-$tmp == 1 and $tmp3 > 2) { print message ("Et pour terminer, il y a "); } else { print message ("Il y a "); }
      if ($tmp3 == 1) { print message ("aussi "); }
      if ($tmp3 == 2) { print message ("&eacute;galement "); }
      if ($tmp3 == 3) { print message ("de plus "); }
      if ($tmp3 == 4) { print message ("aussi "); }
      if ($tmp3 == 5) { print message ("&eacute;galement "); }
      if ($tmp3 > 5) { print message ("aussi "); }
    }
    $tmp++;
    if ($dep_point[$tmp] == $dep_point[$tmp+1]) {
      while ($dep_point[$tmp] == $dep_point[$tmp+2]) {
        print message ("<font color=\"green\"><strong>".$dep_membre[$tmp]."</strong></font>, ");
        $tmp++;
      }
      print message ("<font color=\"green\"><strong>".$dep_membre[$tmp]."</strong></font> et <font color=\"green\"><strong>".$dep_membre[$tmp+1]."</strong></font>");
      $tmp++;
      if ($tmp3 > 0) { print message (" qui"); }
      print message (" ont d&eacute;pass&eacute; les <u><strong>".format_number($dep_point[$tmp])."</strong></u> points.<br>\n");
    } else {
      print message ("<font color=\"green\"><strong>".$dep_membre[$tmp]."</strong></font>");
      if ($tmp3 > 0) { print message (" qui"); }
      print message (" a d&eacute;pass&eacute; les <u><strong>".format_number($dep_point[$tmp])."</strong></u> points.<br>\n");
    }
    $tmp3++;
    $message_vide = 0;
  }
}
#--------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------    MESSAGES    --------------------------------------------------
#-------------------------------------------- Imprime retour membre Quebec ------------------------------------------
#--------------------------------------------------------------------------------------------------------------------
$tmp = 0;
$retour_que = 0;  # Blocage de la fonction.
if ($retour_que > 0) {
  print message ("Retour");
  while ($retour_que > $tmp) {
    $tmp++;
    print message (" de <font color=\"green\"><strong>".$retour_quebec[$tmp]."</strong></font>");
    if ($retour_que-$tmp > 1) { print message (", "); }
    if ($retour_que-$tmp == 1) { print message (" et "); }
  }
  print message (" parmi les membres actifs de la mini-team <strong>(Quebec)</strong>.<br>");
}
#--------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------    MESSAGES    --------------------------------------------------
#---------------------------------------------- Points de notre équipe ----------------------------------------------
#--------------------------------------------------------------------------------------------------------------------
$tmp = $compare_point_team_size;
while ($tmp >= 0) {
  if ($t0 >= $comp_team[$tmp] and $comp_team[$tmp] > $t0-$t1) {
    $format_comp_team = format_number($comp_team[$tmp]);
    print message ("L'&eacute;quipe a maintenant d&eacute;pass&eacute; les <u><strong>".$format_comp_team."</strong></u> points.<br>");
    $tmp = 0;
  }
  $tmp--;
}
if ($test == 1) { print("Passe2\n"); }
#--------------------------------------------------------------------------------------------------------------------
$tmp = 1;
$tp1 = 0; $tp2 = 0; $tp3 = 0; $tp4 = 0; $tp5 = 0; $tp6 = 0; $tp7 = 0; $tp8 = 0; $tp9 = 0; $tp10 = 0; $tp11 = 0; $tp12 = 0;

$max_p1 = 0; $mon_p1 = 0; $max_p2 = 0; $mon_p2 = 0; $max_p3 = 0; $mon_p3 = 0;

&diff_time("DEB - while points");
while ($tmp <= $max_team) {
  $team = 1;
  while ($team <= $max_team) {
    if ($pointage[$team] == $equ[$tmp]) {
      my $format_tmp = format_number($tmp);
      my $format_pointage_team = format_number($pointage[$team]);
      my $format_wu_team = format_number($pointage_wu[$team]);
      my $format_pointageJ1_team = format_number($pointageJ1[$team]);
	  $teamPositionJ1 = 1; while ($equJ[$teamPositionJ1] != $pointageJ1[$team]) { $teamPositionJ1++; }
	  my $format_positionJ1_team = format_number($teamPositionJ1);
      my $format_pointageJ2_team = format_number($pointageJ2[$team]);
      my $format_pointageJ3_team = format_number($pointageJ3[$team]);
      my $format_pointageJ4_team = format_number($pointageJ4[$team]);
      my $format_pointageJ5_team = format_number($pointageJ5[$team]);
      my $format_pointageJ6_team = format_number($pointageJ6[$team]);
      my $format_pointageJ7_team = format_number($pointageJ7[$team]);
      my $format_pointageTOTAL_team = format_number($pointageTOTAL[$team]);
	  $teamPositionTOTAL = 1; while ($equS[$teamPositionTOTAL] != $pointageTOTAL[$team]) { $teamPositionTOTAL++; }
	  my $format_positionTOTAL_team = format_number($teamPositionTOTAL);
      if ($num2a[$team] eq "") { $num2a[$team] = 0; }
      if ($inactif[$team] eq "") { $inactif[$team] = 0; }
      if ($writeDB == 1) { &Put_membre($equipe{'Miniteam', $team}, $num2a[$team], $b, $pointage[$team], $pointageJ1[$team], $inactif[$team], $tmp); }
      if ($b-1 > 0) { ($tmp3, $clas1) = &Get_membre($equipe{'Miniteam', $team}, $b-1); } else { $tmp3 = 0; $clas1 = 0; }
      ($tmp2, $clas) = &Get_membre($equipe{'Miniteam', $team}, $b);
      $tmp1 = $num2a[$team]-$tmp3;

      #--------------------------------------------------------------------------------------------------------------------
      #--------------------------------------------------    MESSAGES    --------------------------------------------------
      #----------------------------- Changement de position dans le classement des mini-team ------------------------------
      #--------------------------------------------------------------------------------------------------------------------
      if ($clas<$clas1) {
        if ($mem_classement==0) { print message ("<u>Changement dans le classement interne des mini-teams</u>, "); }
        else                    { print message ("Il y aussi "); }
        print message ("la mini-team <a href=\"".$ip_interne."/".$equipe{'Miniteam',$team}.".html\"><strong>".$equipe{'Nom',$team}."</strong></a> ");
        if ($mem_classement>0)  { print message ("qui "); }
        print message ("passe au ");
        my $format_tmp = format_number($tmp);
        if ($tmp==1)  { print message ("1<sup>er</sup> rang.<br>\n");} elsif ($tmp==2) {print message ("2<sup>nd</sup> rang.<br>\n");} else {print message ($format_tmp."<sup>&egrave;me</sup> rang.<br>\n"); }
        $mem_classement++;
      }
      my $format_clas = format_number($clas);
      my $format_clas1 = format_number($clas1);
      print ($equipe{'Miniteam',$team}.",  classement aujourd'hui= ".$format_clas.",  classement hier= ".$format_clas1."\n");

      my $nom_equipe = $equipe{'Nom',$team};
      $nom_equipe =~ s/é/&eacute;/g;

      $tri2[$team] = $pointageJ1[$team];
      $nom2[$team] = $nom_equipe;
      if ($pointageJ1[$team] > $max_p1) { $max_p3 = $max_p2; $mon_p3 = $mon_p2; $max_p2 = $max_p1; $mon_p2 = $mon_p1; $max_p1 = $pointageJ1[$team]; $mon_p1 = $team; }
      elsif ($pointageJ1[$team] > $max_p2 and $pointageJ1[$team] < $max_p1) { $max_p3 = $max_p2; $mon_p3 = $mon_p2; $max_p2 = $pointageJ1[$team]; $mon_p2 = $team; }
      elsif ($pointageJ1[$team] > $max_p3 and $pointageJ1[$team] < $max_p2 and $pointageJ1[$team] < $max_p1) { $max_p3 = $pointageJ1[$team]; $mon_p3 = $team; }

      my $format_num2a_team = format_number($num2a[$team]);
      print filemini ("<tr>\n<td class=\"right\">".$format_tmp."</td><td><a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$nom_equipe."</a></td>\n");
      print filemini ("<td class=\"right\">".$format_pointage_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_wu_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_num2a_team."</td>\n");
      print filemini ("<td class=\"right\">");
      my $format_tmp1 = format_number($tmp1);
      if ($tmp1>0) { print filemini ("<font color=\"blue\">+".$format_tmp1."</font>"); }
      elsif ($tmp1<0) { print filemini ("<font color=\"red\">".$format_tmp1."</font>"); }
      else { print filemini ("&#160;"); }
      my $format_inactif = format_number($inactif[$team]);
      print filemini ("</td>\n<td class=\"right\">".$format_inactif."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageJ1_team."</td>\n");
	  if ($pointageJ1[$team] == 0) {
        print filemini ("<td class=\"right\">&#160;</td>\n");
	  } else {
        print filemini ("<td class=\"right\"><font color=\"green\">".$format_positionJ1_team."</font></td>\n");
	  }
      print filemini ("<td class=\"right\">".$format_pointageJ2_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageJ3_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageJ4_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageJ5_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageJ6_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageJ7_team."</td>\n");
      print filemini ("<td class=\"right\">".$format_pointageTOTAL_team."</td>\n");
	  if ($pointageTOTAL[$team] == 0) {
        print filemini ("<td class=\"right\">&#160;</td>\n");
	  } else {
        print filemini ("<td class=\"right\"><font color=\"green\">".$format_positionTOTAL_team."</font></td>\n");
	  }
	  print filemini ("</tr>\n");
	  
	  if ($use_DK_miniteam == 1) { print fileminiDK ("$tmp\t$nom_equipe\t$pointage[$team]\t$pointage_wu[$team]\t$num2a[$team]\t$inactif[$team]\t$pointageJ1[$team]\t$pointageJ2[$team]\t$pointageJ3[$team]\t$pointageJ4[$team]\t$pointageJ5[$team]\t$pointageJ6[$team]\t$pointageJ7[$team]\t$pointageTOTAL[$team]\n"); }
	  
      $tp1 += $pointage[$team];
      $tp2 += $num2a[$team];
      $tp3 += $inactif[$team];
      $tp4 += $pointageJ1[$team];
      $tp5 += $pointageJ2[$team];
      $tp6 += $pointageJ3[$team];
      $tp7 += $pointageJ4[$team];
      $tp8 += $pointageJ5[$team];
      $tp9 += $pointageJ6[$team];
      $tp10 += $pointageJ7[$team];
      $tp11 += $pointageTOTAL[$team];
      $tp12 += $pointage_wu[$team];
      $tmp4 += $tmp1;
    }
    $team++;
  }
  $tmp++;
}
&diff_time("FIN - while points");

$PTotal = $pointage[$team]+$pointage[$team+1];
if ($writeDB == 1) { &Put_membre("Non associes", $non_associer, $b, $PTotal, $pointageJ1[$team], $non_associer_pas_actif, $tmp); }

$tp1 += $pointage[$team]; $tp2 += $non_associer; $tp4 += $pointageJ1[$team]; $tp5 += $pointageJ2[$team]; $tp6 += $pointageJ3[$team];
$tp7 += $pointageJ4[$team]; $tp8 += $pointageJ5[$team]; $tp9 += $pointageJ6[$team]; $tp10 += $pointageJ7[$team]; $tp11 += $pointageTOTAL[$team];
$tp12 += $pointage_wu[$team];

($tmp2, $clas) = &Get_membre("Non associes", $b-1);
$tmp1 = $non_associer-$tmp2;
$tmp4 += $tmp1;

my $format_pointage_team = format_number($pointage[$team]);
my $format_wu_team = format_number($pointage_wu[$team]);
my $format_pointageJ1_team = format_number($pointageJ1[$team]);
my $format_pointageJ2_team = format_number($pointageJ2[$team]);
my $format_pointageJ3_team = format_number($pointageJ3[$team]);
my $format_pointageJ4_team = format_number($pointageJ4[$team]);
my $format_pointageJ5_team = format_number($pointageJ5[$team]);
my $format_pointageJ6_team = format_number($pointageJ6[$team]);
my $format_pointageJ7_team = format_number($pointageJ7[$team]);
my $format_pointageTOTAL_team = format_number($pointageTOTAL[$team]);

print filemini ("<tr>\n<td colspan=\"2\">Totaux non associ&eacute;s actifs</td>\n<td class=\"right\">".$format_pointage_team."</td>\n");
print filemini ("<td class=\"right\">".$format_wu_team."</td>\n");
my $format_non_associer = format_number($non_associer);
print filemini ("<td class=\"right\">".$format_non_associer."</td>\n");
print filemini ("<td class=\"right\">");
my $format_tmp1 = format_number($tmp1);
if ($tmp1 > 0) { print filemini ("<font color=\"blue\">+".$format_tmp1."</font>"); }
elsif ($tmp1 < 0) { print filemini ("<font color=\"red\">".$format_tmp1."</font>"); }
else { print filemini ("&#160;"); }
print filemini ("</td>\n");
print filemini ("<td class=\"center\">&#160;</td>\n");
print filemini ("<td class=\"right\" colspan=\"2\">".$format_pointageJ1_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ2_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ3_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ4_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ5_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ6_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ7_team."</td>\n");
print filemini ("<td class=\"right\" colspan=\"2\">".$format_pointageTOTAL_team."</td>\n</tr>\n");
$team++;

$format_pointage_team = format_number($pointage[$team]);
$format_wu_team = format_number($pointage_wu[$team]);
$format_pointageJ1_team = format_number($pointageJ1[$team]);
$format_pointageJ2_team = format_number($pointageJ2[$team]);
$format_pointageJ3_team = format_number($pointageJ3[$team]);
$format_pointageJ4_team = format_number($pointageJ4[$team]);
$format_pointageJ5_team = format_number($pointageJ5[$team]);
$format_pointageJ6_team = format_number($pointageJ6[$team]);
$format_pointageJ7_team = format_number($pointageJ7[$team]);
$format_pointageTOTAL_team = format_number($pointageTOTAL[$team]);
$tp1 += $pointage[$team]; $tp12 += $pointage_wu[$team]; $tp3 += $non_associer_pas_actif;

my $format_tp1 = format_number($tp1);
my $format_tp2 = format_number($tp2);
my $format_tp12 = format_number($tp12);
my $format_tp3 = format_number($tp3);
my $format_tp4 = format_number($tp4);
my $format_tp5 = format_number($tp5);
my $format_tp6 = format_number($tp6);
my $format_tp7 = format_number($tp7);
my $format_tp8 = format_number($tp8);
my $format_tp9 = format_number($tp9);
my $format_tp10 = format_number($tp10);
my $format_tp11 = format_number($tp11);
my $format_non_associer_pas_actif = format_number($non_associer_pas_actif);

print filemini ("<tr><td colspan=\"2\">Totaux non associ&eacute;s inactifs</td>\n");
print filemini ("<td class=\"right\">".$format_pointage_team."</td>\n");
print filemini ("<td class=\"right\">".$format_wu_team."</td>\n");
print filemini ("<td class=\"center\">&#160;</td>\n");
print filemini ("<td>&#160;</td>\n");
print filemini ("<td class=\"right\">".$format_non_associer_pas_actif."</td>\n");
print filemini ("<td class=\"right\" colspan=\"2\">".$format_pointageJ1_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ2_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ3_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ4_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ5_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ6_team."</td>\n");
print filemini ("<td class=\"right\">".$format_pointageJ7_team."</td>\n");
print filemini ("<td class=\"right\" colspan=\"2\">".$format_pointageTOTAL_team."</td>\n</tr>\n");

print filemini ("<tr>\n<td colspan=\"2\">TOTAUX (*)</td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp1."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp12."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp2."</font></td>\n");
print filemini ("<td class=\"right\">");
my $format_tmp4 = format_number($tmp4);
if ($tmp4 > 0) { print filemini ("<font color=\"blue\">+".$format_tmp4."</font>"); }
elsif ($tmp4 < 0) { print filemini ("<font color=\"red\">".$format_tmp4."</font>"); }
else { print filemini ("&#160;"); }
print filemini ("</td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp3."</font></td>\n");
print filemini ("<td class=\"right\" colspan=\"2\"><font color=\"black\">".$format_tp4."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp5."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp6."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp7."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp8."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp9."</font></td>\n");
print filemini ("<td class=\"right\"><font color=\"black\">".$format_tp10."</font></td>\n");
print filemini ("<td class=\"right\" colspan=\"2\"><font color=\"black\">".$format_tp11."</font></td>\n</tr>\n");
$tmp = $membre-$vert;

my $format_t0 = format_number($t0);
my $format_wu0 = format_number($wu0);
my $format_t1 = format_number($t1);
my $format_t2 = format_number($t2);
my $format_t3 = format_number($t3);
my $format_t4 = format_number($t4);
my $format_t5 = format_number($t5);
my $format_t6 = format_number($t6);
my $format_t7 = format_number($t7);
my $format_t8 = format_number($t8);
my $format_vert = format_number($vert);
my $format_tmp = format_number($tmp);
my $format_tmp5 = format_number($tmp5);

print filemini ("<tr>\n<td colspan=\"2\">TOTAUX</td>\n");
print filemini ("<td class=\"right\">".$format_t0."</td>\n");
print filemini ("<td class=\"right\">".$format_wu0."</td>\n");
print filemini ("<td class=\"right\">".$format_vert."</td>\n");
print filemini ("<td class=\"right\">");
my $format_tmp4 = format_number($tmp4);
if ($tmp4 > 0) { print filemini ("<font color=\"blue\">+".$format_tmp4."</font>"); }
elsif ($tmp4 < 0) { print filemini ("<font color=\"red\">".$format_tmp4."</font>"); }
else { print filemini ("&#160;"); }
print filemini ("</td>\n");
print filemini ("<td class=\"right\">".$format_tmp."</td>\n");
print filemini ("<td class=\"right\" colspan=\"2\">".$format_t1."</td>\n");
print filemini ("<td class=\"right\">".$format_t2."</td>\n");
print filemini ("<td class=\"right\">".$format_t3."</td>\n");
print filemini ("<td class=\"right\">".$format_t4."</td>\n");
print filemini ("<td class=\"right\">".$format_t5."</td>\n");
print filemini ("<td class=\"right\">".$format_t6."</td>\n");
print filemini ("<td class=\"right\">".$format_t7."</td>\n");
print filemini ("<td class=\"right\" colspan=\"2\">".$format_t8."</td>\n</tr>\n");

print filemini ("</table>\n");
print filemini ("&nbsp;&nbsp;&nbsp;<i> (*) si diff&eacute;rent, des membres se retrouvent dans plus d'une mini-team)</i>\n");
print file ("</table>\n");

if ($use_DK_miniteam == 1) { print fileminiDK (" \tTOTAUX\t$t0\t$wu0\t$vert\t$tmp\t$t1\t$t2\t$t3\t$t4\t$t5\t$t6\t$t7\t$t8\n"); }

#-------------------------- Entete des Effectifs ----------------------------------
&Meta_html("fileeffectif");
print fileeffectif ("\n<meta http-equiv=\"Cache-Control\" content=\"no cache\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"Expires\" content=\"0\">");
print fileeffectif ("<title>L'effectif de l'Alliance Francophone (Folding At Home)</title>\n</head>\n");
&Body_html("fileeffectif");
print fileeffectif ("<div class=\"parag\"><h4>L'effectif de l'<a href=\"".$ip6."\" target=\"_blank\">A.F.</a> chez<br>&nbsp;</h4></div>\n");
print fileeffectif ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/folding5.gif\"></a></div>\n");

print fileeffectif ("<br><p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
print fileeffectif ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");

&diff_time("DEB - while totaux");
$team = 1;
while ($team <= $max_team) {
  if ($equipe{'Modele_de_page', $team} == 3) {
    $ff = $equipe{'Miniteam', $team};
    if ($mem23[$team] > 0) { &Print_page_membre("$ff", $team); }
    &Print_totaux3("$ff", $pointage[$team], $pointageJ1[$team], $pointageJ2[$team], $pointageJ3[$team], $pointageJ4[$team], $pointageJ5[$team], $pointageJ6[$team], $pointageJ7[$team], $pointageTOTAL[$team]);
  }
  if ($equipe{'Modele_de_page', $team} == 5) {
    $ff = $equipe{'Miniteam', $team};
    &Print_totaux5("$ff", $pointage[$team], $pointageJ1[$team], $pointageJ2[$team], $pointageJ3[$team], $pointageJ4[$team], $pointageJ5[$team], $pointageJ6[$team], $pointageJ7[$team], $pointageTOTAL[$team]);
  }
  $team++;
}
&diff_time("FIN - while totaux");

# --- podium du jour -------------------------------------------------------------

print filemini ("<table class=\"podium\"><tr>\n");
print filemini ("<td></td><td><em><u>Le podium du jour</u></em></td>\n");
print filemini ("</tr>\n");

if ($tri2[$mon_p1] != 0) {
  $f_tri2_num = format_number($tri2[$mon_p1]);
  print filemini ("<tr><td><img src=\"images/premier.gif\"></td><td><strong>".$nom2[$mon_p1]."</strong></td><td>".$f_tri2_num." points</td></tr>\n");
}

if ($tri2[$mon_p2] != 0) {
  $f_tri2_num = format_number($tri2[$mon_p2]);
  print filemini ("<tr><td><img src=\"images/deuxieme.gif\"></td><td><strong>".$nom2[$mon_p2]."</strong></td><td>".$f_tri2_num." points</td></tr>\n");
}

if ($tri2[$mon_p3] != 0) {
  $f_tri2_num = format_number($tri2[$mon_p3]);
  print filemini ("<tr><td><img src=\"images/trois.gif\"></td><td><strong>".$nom2[$mon_p3]."</strong></td><td>".$f_tri2_num." points</td></tr>\n");
}
print filemini ("</table>\n");

print filemini ("<br>\n");
&Tail_html("filemini");

if ($use_DK_miniteam == 1) { close(fileminiDK); }
close(filemini);

#----------------------- Impression des informations -------------------------------------
my $format_membre = format_number($membre);
my $format_nouv = format_number($nouv);
my $format_perte = format_number($perte);
my $format_allo = format_number($allo);

$pourcentage = ($vert/$membre)*100.0;
$pourcent_str = sprintf("%.2f", $pourcentage);
print file ("<br><table class=\"podium\">\n");
print file ("<tr><td><em><u>Statistiques</u></em></td></tr>\n");
print file ("<tr><td>$format_vert membres actifs sur $format_membre membres</td></tr>\n");
print file ("<tr><td>".$pourcent_str."% des membres inscrits sont actifs</td></tr>\n</table>\n");

&Tail_html("file");
    
close(file);
close(actives_team51);

print fileeffectif ("<h1>&nbsp;&nbsp;L'&eacute;tat de l'A.F. pour aujourd'hui :</h1>\n");
print fileeffectif ("<table class=\"podium\">\n");
print fileeffectif ("<tr><td>Membres inscrits : ".$format_membre."</td></tr>\n");
print fileeffectif ("<tr><td><img src=\"images/jgp_allo.gif\" border=\"0\"> De retour : ".$format_nouv."</td></tr>\n");
print fileeffectif ("<tr><td><img src=\"images/jgp_bye.gif\" border=\"0\"> Sur le d&eacute;part : ".$format_perte."</td></tr>\n");
print fileeffectif ("<tr><td><img src=\"images/jgp_new.gif\" border=\"0\"> Nouveaux : ".$format_allo."</td></tr>\n");
print fileeffectif ("<tr><td>Membres actifs : ".$format_vert."</td></tr>\n");
print fileeffectif ("<tr><td>".$pourcent_str."% des membres inscrits sont actifs.</td></tr>\n</table>\n<br>\n");

&diff_time("DEB - Liste nouveaux");
if ($allo > 0) {
  print fileeffectif ("<h1>&nbsp;&nbsp;");
  if ($allo == 1) {
    print fileeffectif ("Un seul nouveau membre");
  } else {
    print fileeffectif ("La liste des nouveaux membres");
  }
  print fileeffectif (" aujourd'hui :");
  print fileeffectif ("</h1>\n<table class=\"podium\">\n");
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  $tmp = 1;
  while ($tmp < $allo+1) {
    $team = 1;
    while ($team <= $max_team) {
      $tmp1 = 1;
      $passe = 0;
      while ($tmp1+$pos_ajo[$team] <= $NA[$team]+$pos_ajo[$team] and $passe == 0) {
        $yy = $ajout[$pos_ajo[$team]+$tmp1];
        $lc_yy = lc($yy);
        $uc_yy = uc($yy);
        if ($test == 1) { print($tmp1.": ".$yy."\n"); }
        if ($mem_nom[$tmp] =~ /$yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam', $team}.".html\" target=\"_blank\">".$yy."</a>";
          $allo1 =~ s/\\//g;
          $mem_nom[$tmp] =~ s/$yy/$allo1/g;
          $passe = 1;
        } elsif ($mem_nom[$tmp] =~ /$lc_yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$lc_yy."</a>";
          $allo1 =~ s/\\//g;
          $mem_nom[$tmp] =~ s/$lc_yy/$allo1/g;
          $passe = 1;
        } elsif ($mem_nom[$tmp] =~ /$uc_yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$uc_yy."</a>";
          $allo1 =~ s/\\//g;
          $mem_nom[$tmp] =~ s/$uc_yy/$allo1/g;
          $passe = 1;
        }
        $tmp1++;
      }
      $team++;
    }
    print fileeffectif ("<tr><td>".$mem_nom[$tmp]."</td></tr>\n");
    $tmp++;
  }

  if ($allo == 1) {
    print fileeffectif ("<tr><td><em><font color=\"black\">Il vient");
  } else {
    print fileeffectif ("<tr><td><em><font color=\"black\">Ils viennent");
  }
  print fileeffectif (" nous aider avec un apport de <font color=\"red\"><strong>$mem_total</strong></font> points &agrave; l'&eacute;quipe.</font></em></td></tr>\n</table>\n<br>\n");
} else {
  print fileeffectif ("<h1>&nbsp;&nbsp;Pas de nouveau membre aujourd'hui.</h1><br>\n");
}
&diff_time("FIN - Liste nouveaux");

#-------------------------- Entete des GRAPHS ----------------------------------
&diff_time("DEB - Fin du fichier");
&Meta_html("filegraphs");
print filegraphs ("\n<meta http-equiv=\"Cache-Control\" content=\"no cache\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"Expires\" content=\"0\">");
print filegraphs ("<title>Les graphiques de l'Alliance Francophone (Folding At Home)</title>\n</head>\n");
&Body_html("filegraphs");
print filegraphs ("<div class=\"parag\"><h4>Les graphiques de l'<a href=\"".$ip6."\" target=\"_blank\">A.F.</a> chez<br>&nbsp;</h4></div>\n");
print filegraphs ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/folding5.gif\"></a></div>\n");

print filegraphs ("<br><p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
print filegraphs ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");

print filegraphs ("&nbsp;&nbsp;<img src=\"graphique1.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique1a.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique1b.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique4.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique4a.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique4b.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique2.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique2a.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique2b.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique3.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique3a.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique3b.png\" border=\"10\"/><br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique3c.png\" border=\"10\"/><br>\n");
print filegraphs ("<br>\n");
print filegraphs ("&nbsp;&nbsp;<img src=\"graphique5.png\" border=\"0\"/><br>\n");

&Tail_html("filegraphs");

close(filegraphs);

#-------------------------- Entete des meilleurs plieurs ----------------------------------
&Meta_html("filetopprod");
print filetopprod ("\n<meta http-equiv=\"Cache-Control\" content=\"no cache\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"Expires\" content=\"0\">");
print filetopprod ("<title>Les 30 meilleurs producteurs de l'Alliance Francophone (Folding At Home)</title>\n</head>\n");
&Body_html("filetopprod");
print filetopprod ("<div class=\"parag\"><h4>Les 30 meilleurs plieurs de l'<a href=\"".$ip6."\" target=\"_blank\">A.F.</a> chez<br>&nbsp;</h4></div>\n");
print filetopprod ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/folding5.gif\"></a></div>\n");

print filetopprod ("<br><p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
print filetopprod ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");

print filetopprod ("<h1>&nbsp;&nbsp;De la journ&eacute;e</h1>\n");
&debut_tableau("filetopprod", "non");
$tmp = 1;
$nb_teams = 29+1;
while ($tmp < $nb_teams+1) {
  my $format_tmp = format_number($tmp);
  my $format_posn_jour = format_number($posn_jour[$tmp]);
  my $format_posg_jour = format_number($posg_jour[$tmp]);
  my $xyz_chr = decode_accent($xyz_jour[$tmp]);
  my $xyz_chr_uri = uri_unescape($xyz_chr);
  my $xyz_chr_eoc_fah = codage_eoc($xyz_chr_uri);
  
  #print("$xyz_jour[$tmp] ==> $xyz_chr ==> $xyz_chr_uri\n");
  print filetopprod ("<tr><td class=\"right\">".$format_tmp."</td>");
  print filetopprod ("<td class=\"right\"><a href=\"javascript:seoc('".$xyz_chr_eoc_fah."')\">".$format_posn_jour."</a></td>");
  if ($tri_uid{$xyz_chr_uri} ne "" and $tri_uid{$xyz_chr_uri} ne "-1") {
    print filetopprod ("<td class=\"right\"><a href=\"javascript:fah('".$xyz_chr_eoc_fah."',".$tri_uid{$xyz_chr_uri}.")\">".$format_posg_jour."</a></td>");
  } else {
    print filetopprod ("<td class=\"right\">".$format_posg_jour."</td>");
  }
  print filetopprod ("<td>");
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  $team = 1;
  $passe = 0;
  while ($team <= $max_team and $passe == 0) {
    $tmp1 = 1;
    $passe = 0;
    while ($tmp1+$pos_ajo[$team] <= $NA[$team]+$pos_ajo[$team] and $passe == 0) {
      $yy = $ajout[$pos_ajo[$team]+$tmp1];
      $lc_yy = lc($yy);
      $uc_yy = uc($yy);
      if ($test == 1) { print($tmp1.": ".$yy."\n"); }
      if ($nom_jour[$tmp] =~ /$yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$yy."</a>";
        $allo1 =~ s/\\//g;
        $nom_jour[$tmp] =~ s/$yy/$allo1/g;
        $passe = 1;
      } elsif ($nom_jour[$tmp] =~ /$lc_yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$lc_yy."</a>";
        $allo1 =~ s/\\//g;
        $nom_jour[$tmp] =~ s/$lc_yy/$allo1/g;
        $passe = 1;
      } elsif ($nom_jour[$tmp] =~ /$uc_yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$uc_yy."</a>";
        $allo1 =~ s/\\//g;
        $nom_jour[$tmp] =~ s/$uc_yy/$allo1/g;
        $passe = 1;
      }
      $tmp1++;
    }
    $team++;
  }
  my $pT_Semaine_jour = $p1_jour[$tmp]+$p2_jour[$tmp]+$p3_jour[$tmp]+$p4_jour[$tmp]+$p5_jour[$tmp]+$p6_jour[$tmp]+$p7_jour[$tmp];
  my $gT_Semaine_jour = $g1_jour[$tmp]+$g2_jour[$tmp]+$g3_jour[$tmp]+$g4_jour[$tmp]+$g5_jour[$tmp]+$g6_jour[$tmp]+$g7_jour[$tmp];
  my $format_unite_j = format_number($unite_jour[$tmp]);
  my $format_wu_j = format_number($wu_jour[$tmp]);
  my $format_u1_j = format_number($u1_jour[$tmp]);
  my $format_u2_j = format_number($u2_jour[$tmp]);
  my $format_u3_j = format_number($u3_jour[$tmp]);
  my $format_u4_j = format_number($u4_jour[$tmp]);
  my $format_u5_j = format_number($u5_jour[$tmp]);
  my $format_u6_j = format_number($u6_jour[$tmp]);
  my $format_u7_j = format_number($u7_jour[$tmp]);
  my $format_ut_j = format_number($ut_jour[$tmp]);
  my $format_p1_j = format_number($p1_jour[$tmp]);
  my $format_p2_j = format_number($p2_jour[$tmp]);
  my $format_p3_j = format_number($p3_jour[$tmp]);
  my $format_p4_j = format_number($p4_jour[$tmp]);
  my $format_pT_S_j = format_number($pT_Semaine_jour);
  my $format_g1_j = format_number($g1_jour[$tmp]);
  my $format_g2_j = format_number($g2_jour[$tmp]);
  my $format_g3_j = format_number($g3_jour[$tmp]);
  my $format_g4_j = format_number($g4_jour[$tmp]);
  my $format_gT_S_j = format_number($gT_Semaine_jour);
  print filetopprod ($nom_jour[$tmp]);
  if ( $u1_jour[$tmp] > 0 and $u2_jour[$tmp] == 0 and $u3_jour[$tmp] == 0 and $u4_jour[$tmp] == 0 and $u5_jour[$tmp] == 0 and $u6_jour[$tmp] == 0 and $u7_jour[$tmp] == 0) {
    print filetopprod ("&nbsp;<img src=\"images/jgp_allo.gif\" border=\"0\">");
  } elsif ( $u1_jour[$tmp] == 0 and $u2_jour[$tmp] == 0 and $u3_jour[$tmp] == 0 and $u4_jour[$tmp] == 0 and $u5_jour[$tmp] == 0 and $u6_jour[$tmp] == 0 and $u7_jour[$tmp] > 0) {
    print filetopprod ("&nbsp;<img src=\"images/jgp_bye.gif\" border=\"0\">");
  } else {}
  print filetopprod ("</td><td class=\"right\">");
  print filetopprod ($format_unite_j);
  print filetopprod ("</td><td class=\"right\">");
  print filetopprod ($format_wu_j);
  print filetopprod ("</td><td class=\"right\">".$format_u1_j."</td><td class=\"right\">".$format_u2_j);
  print filetopprod ("</td><td class=\"right\">".$format_u3_j."</td><td class=\"right\">".$format_u4_j);
  print filetopprod ("</td><td class=\"right\">".$format_u5_j."</td><td class=\"right\">".$format_u6_j);
  print filetopprod ("</td><td class=\"right\">".$format_u7_j."</td><td class=\"right\">".$format_ut_j."</td>");
  print filetopprod ("<td class=\"right\">".$format_p1_j."</td>");
  if ($use_aff_semaine == 0) {
    print filetopprod ("<td class=\"right\">".$format_p2_j."</td><td class=\"right\">".$format_p3_j."</td><td class=\"right\">".$format_p4_j."</td>");
  } else {
    print filetopprod ("<td class=\"right\">".$format_pT_S_j."</td>");
  }
  print filetopprod ("<td class=\"right\">".$format_g1_j."</td>");
  if ($use_aff_semaine == 0) {  
    print filetopprod ("<td class=\"right\">".$format_g2_j."</td><td class=\"right\">".$format_g3_j."</td><td class=\"right\">".$format_g4_j."</td>");
  } else {
    print filetopprod ("<td class=\"right\">".$format_gT_S_j."</td>");
  }
  print filetopprod ("</tr>");
  $tmp++;
}
print filetopprod ("</table>\n");

#----------------------- Impression des 3 meilleurs -------------------------------------
print filetopprod ("<br>\n");
print filetopprod ("<table class=\"podium\"><tr>\n");
print filetopprod ("<td></td><td><em><u>Le podium du jour</u></em></td>\n");
print filetopprod ("</tr><tr>\n");

if ($tri1[$mon1] != 0) {
  my $format_tri1 = format_number($tri1[$mon1]);
  print filetopprod ("<td><img src=\"./images/premier.gif\"></td>\n");
  print filetopprod ("<td><strong>".$tri[$mon1]."</strong></td>\n");
  print filetopprod ("<td class=\"right\">".$format_tri1." points</td>\n");
  print filetopprod ("</tr>\n<tr>\n");

}

if ($tri1[$mon2] != 0) {
  my $format_tri1 = format_number($tri1[$mon2]);
  print filetopprod ("<td><img src=\"./images/deuxieme.gif\"></td>\n");
  print filetopprod ("<td><strong>".$tri[$mon2]."</strong></td>\n");
  print filetopprod ("<td class=\"right\">".$format_tri1." points</td>\n");
  print filetopprod ("</tr>\n<tr>\n");
}

if ($tri1[$mon3] != 0) {
  my $format_tri1 = format_number($tri1[$mon3]);
  print filetopprod ("<td><img src=\"./images/trois.gif\"></td>\n");
  print filetopprod ("<td><strong>".$tri[$mon3]."</strong></td>\n");
  print filetopprod ("<td class=\"right\">".$format_tri1." points</td>\n");
  print filetopprod ("</tr>\n");
}

print filetopprod ("</table>\n");

print filetopprod ("<br>\n");
if ($jour2 == $jour_de_la_semaine) {
  print passage ("<p class=\"MAJ\">Mis &agrave; jour le ".$jour[$jour2]." ".$jour." ".$mois[$mois]." ".$annee." &agrave; ");
  print passage ("$heure:$min, heure de Paris ($GMheure:$GMmin GMT)</p>\n");
  print passage ("<table class=\"podium\"><tr><td colspan=\"2\"><font size=+1>$compte_compare de nos membres ont franchi une &eacute;tape dans leur production durant la derni&egrave;re semaine.</font></td></tr>\n");
  $tmp = 1;
  while ($tmp <= $compte_compare) {
    $team2 = 1;
    $passe5 = 0;
    while ($team2 <= $max_team and $passe5 == 0) {
      $tmp2 = 1;
      $passe5 = 0;
      while ($tmp2+$pos_ajo[$team2] <= $NA[$team2]+$pos_ajo[$team2] and $passe5 == 0) {
        $yy = $ajout[$pos_ajo[$team2]+$tmp2];
        $lc_yy = lc($yy);
        $uc_yy = uc($yy);
        if ($test == 1) { print($tmp2.": ".$yy."\n"); }
        if ($liste_com[$tmp] =~ /$yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team2}.".html\" target=\"_blank\">".$yy."</a>";
          $allo1 =~ s/\\//g;
          $liste_com[$tmp] =~ s/$yy/$allo1/g;
          $passe5 = 1;
        } elsif ($liste_com[$tmp] =~ /$lc_yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team2}.".html\" target=\"_blank\">".$lc_yy."</a>";
          $allo1 =~ s/\\//g;
          $liste_com[$tmp] =~ s/$lc_yy/$allo1/g;
          $passe5 = 1;
        } elsif ($liste_com[$tmp] =~ /$uc_yy/) {
          $allo1 = "<a href=\"".$equipe{'Miniteam',$team2}.".html\" target=\"_blank\">".$uc_yy."</a>";
          $allo1 =~ s/\\//g;
          $liste_com[$tmp] =~ s/$uc_yy/$allo1/g;
          $passe5 = 1;
        }
        $tmp2++;
      }
      $team2++;
    }
    print passage ($liste_com[$tmp]);
    $tmp++;
  } 
  print passage ("</table>\n"); close(passage);
}

print filetopprod ("<h1>&nbsp;&nbsp;De la semaine</h1>\n");
&debut_tableau("filetopprod", "non");
$tmp = 1;
while ($tmp < $nb_teams+1) {
  my $format_tmp = format_number($tmp);
  my $format_posn_semaine = format_number($posn_semaine[$tmp]);
  my $format_posg_semaine = format_number($posg_semaine[$tmp]);
  my $xyz_chr = decode_accent($xyz_semaine[$tmp]);
  my $xyz_chr_uri = uri_unescape($xyz_chr);
  my $xyz_chr_eoc_fah = codage_eoc($xyz_chr_uri);

  #print("$xyz_jour[$tmp] ==> $xyz_chr ==> $xyz_chr_uri\n");
  print filetopprod ("<tr><td class=\"right\">".$format_tmp."</td>");
  print filetopprod ("<td class=\"right\"><a href=\"javascript:seoc('".$xyz_chr_eoc_fah."')\">".$format_posn_semaine."</a></td>");
  if ($tri_uid{$xyz_chr_uri} ne "" and $tri_uid{$xyz_chr_uri} ne "-1") {
    print filetopprod ("<td class=\"right\"><a href=\"javascript:fah('".$xyz_chr_eoc_fah."',".$tri_uid{$xyz_chr_uri}.")\">".$format_posg_semaine."</a></td>");
  } else {
    print filetopprod ("<td class=\"right\">".$format_posg_semaine."</td>");
  }
  print filetopprod ("<td>");
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  ##########################################################################################################
  $team = 1;
  $passe = 0;
  while ($team <= $max_team and $passe == 0) {
    $tmp1 = 1;
    $passe = 0;
    while ($tmp1+$pos_ajo[$team] <= $NA[$team]+$pos_ajo[$team] and $passe == 0) {
      $yy = $ajout[$pos_ajo[$team]+$tmp1];
      $lc_yy = lc($yy);
      $uc_yy = uc($yy);
      if ($test == 1) { print($tmp1.": ".$yy."\n"); }
      if ($nom_semaine[$tmp] =~ /$yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$yy."</a>";
        $allo1 =~ s/\\//g;
        $nom_semaine[$tmp] =~ s/$yy/$allo1/g;
        $passe = 1;
      } elsif ($nom_semaine[$tmp] =~ /$lc_yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$lc_yy."</a>";
        $allo1 =~ s/\\//g;
        $nom_semaine[$tmp] =~ s/$lc_yy/$allo1/g;
        $passe = 1;
      } elsif ($nom_semaine[$tmp] =~ /$uc_yy/) {
        $allo1 = "<a href=\"".$equipe{'Miniteam',$team}.".html\" target=\"_blank\">".$uc_yy."</a>";
        $allo1 =~ s/\\//g;
        $nom_semaine[$tmp] =~ s/$uc_yy/$allo1/g;
        $passe = 1;
      }
      $tmp1++;
    }
    $team++;
  }
  my $pT_Semaine_semaine = $p1_semaine[$tmp]+$p2_semaine[$tmp]+$p3_semaine[$tmp]+$p4_semaine[$tmp]+$p5_semaine[$tmp]+$p6_semaine[$tmp]+$p7_semaine[$tmp];
  my $gT_Semaine_semaine = $g1_semaine[$tmp]+$g2_semaine[$tmp]+$g3_semaine[$tmp]+$g4_semaine[$tmp]+$g5_semaine[$tmp]+$g6_semaine[$tmp]+$g7_semaine[$tmp];  
  my $format_unite_s = format_number($unite_semaine[$tmp]);
  my $format_wu_s = format_number($wu_semaine[$tmp]);
  my $format_u1_s = format_number($u1_semaine[$tmp]);
  my $format_u2_s = format_number($u2_semaine[$tmp]);
  my $format_u3_s = format_number($u3_semaine[$tmp]);
  my $format_u4_s = format_number($u4_semaine[$tmp]);
  my $format_u5_s = format_number($u5_semaine[$tmp]);
  my $format_u6_s = format_number($u6_semaine[$tmp]);
  my $format_u7_s = format_number($u7_semaine[$tmp]);
  my $format_ut_s = format_number($ut_semaine[$tmp]);
  my $format_p1_s = format_number($p1_semaine[$tmp]);
  my $format_p2_s = format_number($p2_semaine[$tmp]);
  my $format_p3_s = format_number($p3_semaine[$tmp]);
  my $format_p4_s = format_number($p4_semaine[$tmp]);
  my $format_pT_S_s = format_number($pT_Semaine_semaine);
  my $format_g1_s = format_number($g1_semaine[$tmp]);
  my $format_g2_s = format_number($g2_semaine[$tmp]);
  my $format_g3_s = format_number($g3_semaine[$tmp]);
  my $format_g4_s = format_number($g4_semaine[$tmp]);
  my $format_gT_S_s = format_number($gT_Semaine_semaine);
  print filetopprod ($nom_semaine[$tmp]);
  if ( $u1_semaine[$tmp] > 0 and $u2_semaine[$tmp] == 0 and $u3_semaine[$tmp] == 0 and $u4_semaine[$tmp] == 0 and $u5_semaine[$tmp] == 0 and $u6_semaine[$tmp] == 0 and $u7_semaine[$tmp] == 0) {
    print filetopprod ("&nbsp;<img src=\"images/jgp_allo.gif\" border=\"0\">");
  } elsif ( $u1_semaine[$tmp] == 0 and $u2_semaine[$tmp] == 0 and $u3_semaine[$tmp] == 0 and $u4_semaine[$tmp] == 0 and $u5_semaine[$tmp] == 0 and $u6_semaine[$tmp] == 0 and $u7_semaine[$tmp] > 0) {
    print filetopprod ("&nbsp;<img src=\"images/jgp_bye.gif\" border=\"0\">");
  } else {}
  print filetopprod ("</td><td class=\"right\">");
  print filetopprod ($format_unite_s);
  print filetopprod ("</td><td class=\"right\">");
  print filetopprod ($format_wu_s);
  print filetopprod ("</td><td class=\"right\">".$format_u1_s."</td><td class=\"right\">".$format_u2_s);
  print filetopprod ("</td><td class=\"right\">".$format_u3_s."</td><td class=\"right\">".$format_u4_s);
  print filetopprod ("</td><td class=\"right\">".$format_u5_s."</td><td class=\"right\">".$format_u6_s);
  print filetopprod ("</td><td class=\"right\">".$format_u7_s."</td><td class=\"right\">".$format_ut_s."</td>");
  print filetopprod ("<td class=\"right\">".$format_p1_s."</td>");
  if ($use_aff_semaine == 0) {
    print filetopprod ("<td class=\"right\">".$format_p2_s."</td><td class=\"right\">".$format_p3_s."</td><td class=\"right\">".$format_p4_s."</td>");
  } else {
    print filetopprod ("<td class=\"right\">".$format_pT_S_s."</td>");
  }
  print filetopprod ("<td class=\"right\">".$format_g1_s."</td>");
  if ($use_aff_semaine == 0) {
    print filetopprod ("<td class=\"right\">".$format_g2_s."</td><td class=\"right\">".$format_g3_s."</td><td class=\"right\">".$format_g4_s."</td>");
  } else {
    print filetopprod ("<td class=\"right\">".$format_gT_S_s."</td>");
  }
  print filetopprod ("</tr>");
  $tmp++;
}
print filetopprod ("</table>\n");

&Tail_html("filetopprod");

close(filetopprod);

#-------------------------- Entete de liste plieurs dimanche ----------------------------------
&Meta_html("filelistmembs");
print filelistmembs ("\n<meta http-equiv=\"Cache-Control\" content=\"no cache\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"Expires\" content=\"0\">");
print filelistmembs ("<title>La liste du dimanche de l'Alliance Francophone (Folding At Home)</title>\n</head>\n");
&Body_html("filelistmembs");
print filelistmembs ("<div class=\"parag\"><h4>La liste du dimanche de l'<a href=\"".$ip6."\" target=\"_blank\">A.F.</a> chez<br>&nbsp;</h4></div>\n");
print filelistmembs ("<div class=\"parag\"><a href=\"".$ip5."\" target=\"_blank\"><img src=\"./images/folding5.gif\"></a></div>\n<br>\n");

open(passage, '<:utf8', "passage.res");
@line = <passage>;
print filelistmembs (@line);
close(passage);

&Tail_html("filelistmembs");

close(filelistmembs);

$team = 1;
while ($team <= $max_team) {
  # print($equipe{'Nom', $team}.": num2[$team]=[".$num2[$team]."] ==> num2a[$team]=[".$num2a[$team]."]\n");
  if ($num2a[$team] == 0) { $num2b[$team] = "0"; } else { $num2b[$team] = sprintf("%.2f", ($num2a[$team]/$point[$team])*100.0); }
  $team++;
}

$team = 1;
while ($team <= $max_team) {
  $ff = $equipe{'Miniteam', $team};
  if ($equipe{'Modele_de_page', $team} == 3 or $equipe{'Modele_de_page', $team} == 5) {
    print $ff ("<table class=\"podium\">\n");
    print $ff ("<tr><td><em><u>Statistiques</u></em></td></tr>\n");
    print $ff ("<tr><td>".$num2a[$team]." membres actifs sur ".$point[$team]." membres</td></tr>");
    print $ff ("<tr><td>".$num2b[$team]."% des membres ".$equipe{'Titre3', $team}." sont actifs.</td></tr>\n</table>\n");
    print $ff ("</div>\n</div>\n<div id =\"footer\">\n");
    print $ff ("<div class=\"row_latest\">\n<div class=\"latest\">\n<div class=\"latest_text\">");
    print $ff ("<p><a href=\"http://folding.fleucorp.net/installation.htm\" target=\"_blank\">Élaboré par JGP SOLDAT</a>&nbsp;-&nbsp;Maintenu par <a href=\"/code/fahCode.7z\" target=\"_blank\">Kana-chan</a> avec l'aimable participation de Dylav de Zebulon.fr&nbsp;-&nbsp;Version 7.10<a href=\"".$homeWWW."\" class=\"top_button\">HOME</a><a href=\"#top\" class=\"top_button\">HAUT</a></p>\n");
    print $ff ("</div>\n</div>\n</div>\n</div>\n</div>\n");
    print $ff ("</body>\n");
    print $ff ("</html>\n");
    print actives_passives ($equipe{'Miniteam', $team}."\t".$num2a[$team]."\n");
  }
  $team++;
}
close(actives_passives);

print ("max1=$max1, max2=$max2, max3=$max3\n");
#---------Message est vide----------
if ($message_vide == 1) {
  print message ("Aucun changement n'a &eacute;t&eacute; enregistr&eacute; aujourd'hui !<br/>");
}

#--------------------------------------------------------------------------------------------------------------------
#--------------------------------------------------    MESSAGES    --------------------------------------------------
#------------------------------------------------ A chaque Dimanche -------------------------------------------------
#--------------------------------------------------------------------------------------------------------------------
if ($jour2 == $jour_de_la_semaine) {
  print message ("<br>Nous sommes maintenant dimanche et une nouvelle liste des membres ayant franchis une &eacute;tape dans leurs productions est maintenant disponible "); 
  print message ("<a href=\"listmembs.html\">ICI</a>.");
} else {
  print message ("<br><a href=\"".$ip6."\">".$ip6."</a>");
}

close(message);

# 
# --- Tableau des effectifs ----------------------------------------------
#

open(posFile, "pos.res"); $b1 = <posFile>; close(posFile);

$donner = "pos_Alliance, pos_general, nom, score, wu, rec, cpu";

$semaine = 0;
$b1 = $b1+7;
print("\n");
while ($semaine < 16) {
  $membre = 0;
  $b1 = $b1-7;
  $ErrNum = 0;
  if ($test == 1) { print("SELECT count(rec) FROM Alliance WHERE rec = ".$b1."\n"); }
  $membre = $db->selectrow_array("SELECT count(rec) FROM Alliance WHERE rec = ".$b1);
  if ($membre > 0) {
    if ($test == 1) { print("Membre semaine[".$semaine."]= ".$membre."\n"); }
    $mm[$semaine] = $membre;
  }
  $semaine++;
}

print fileeffectif ("<h1>&nbsp;&nbsp;L'effectif de l'A.F. :</h1>\n");
print fileeffectif ("<table class=\"effectif_corps\">\n");
print fileeffectif ("<tr>\n");
print fileeffectif ("<th rowspan=\"3\"><a href=\"".$ip6."\" target=\"_blank\"><IMG src=\"images/foldinghome2.jpg\"></A></th>\n");
print fileeffectif ("<th>Semaine</th><th>S-1</th><th>S-2</th><th>S-3</th>\n");
print fileeffectif ("<th>S-4</th><th>S-5</th><th>S-6</th><th>S-7</th>\n");
print fileeffectif ("<th>S-8</th><th>S-9</th><th>S-10</th><th>S-11</th>\n");
#print fileeffectif ("<th>S-12</th><th>S-13</th><th>S-14</th>\n");
print fileeffectif ("</tr>\n");
print fileeffectif ("<tr>\n");

@f_mm = 0;
$cpt = 0;
$nb_effectif_tab = 12; #15
while ($cpt < $nb_effectif_tab) {
  $f_mm[$cpt] = format_number($mm[$cpt]);
  print fileeffectif ("<td class=\"center\">".$f_mm[$cpt]."</td>");
  $cpt++;
}
print fileeffectif ("\n</tr>\n");
print fileeffectif ("<tr>\n");

$aa = 0;
while ($aa < $nb_effectif_tab) {
  $temp = $mm[$aa]-$mm[$aa+1];
  if ($temp == 0) {
    print fileeffectif ("<td class=\"center\">=</td>");
  } else {
    $f_temp = format_number($temp);
    print fileeffectif ("<td class=\"center\">+".$f_temp."</td>");
  }
  $aa++;
}
print fileeffectif ("\n</tr>\n</table>\n");

&Tail_html("fileeffectif");

close(fileeffectif);


$team = 1;
while ($team <= $max_team) {
  $ff = $equipe{'Miniteam', $team};
  $ff1 = "$equipe{'Miniteam', $team}1";
  print $ff1 ("\n    Mise à jour: le ".$jour[$jour2].", ".$jour." ".$mois1[$mois]." ".$annee.", à ");
  if ($heure == 0) {
    print $ff1 ("minuit, ".$min." minutes.");
  } else {
    print $ff1 ($heure.":".$min.".");
  }
  close($ff);
  close($ff1);
  $team++;
}

print ("Nombre de membres actifs=".$vert);
print ("\nNombre de nouveaux membres=".$allo);
print ("\nNombre de membres de nouveaux actifs=".$nouv);
print ("\nNombre de membres qui nous quittent=".$perte."\n");

if ($test == 1) { exit; }

open(file, "$destWWW/Alliance.html");
@copy = <file>;
close(file);

open(file, ">vieux/Alliance-$b.html");
print file (@copy);
close(file);

open(fileMINI, "$destWWW/miniteam.html");
@copy = <fileMINI>;
close(fileMINI);

open(fileMINI, ">vieux/miniteam-$b.html");
print fileMINI (@copy);
close(fileMINI);

open(fileTOPPROD, "$destWWW/effectif.html");
@copy = <fileTOPPROD>;
close(fileTOPPROD);

open(fileTOPPROD, ">vieux/effectif-$b.html");
print fileTOPPROD (@copy);
close(fileTOPPROD);

open(fileGRAPHS, "$destWWW/graphs.html");
@copy = <fileGRAPHS>;
close(fileGRAPHS);

open(fileGRAPHS, ">vieux/graphs-$b.html");
print fileGRAPHS (@copy);
close(fileGRAPHS);

open(filePLIEURSJS, "$destWWW/topprod.html");
@copy = <filePLIEURSJS>;
close(filePLIEURSJS);

open(filePLIEURSJS, ">vieux/topprod-$b.html");
print filePLIEURSJS (@copy);
close(filePLIEURSJS);

open(fileLISTMEMBS, "$destWWW/listmembs.html");
@copy = <fileLISTMEMBS>;
close(fileLISTMEMBS);

open(fileLISTMEMBS, ">vieux/listmembs-$b.html");
print fileLISTMEMBS (@copy);
close(fileLISTMEMBS);

open(fileMESS, "message.res");
@copy = <fileMESS>;
close(fileMESS);

open(fileMESS, ">message/message-$b.txt");
print fileMESS (@copy);
close(fileMESS);

$team=1;
while ($team<=$max_team) {
  open(fileCOPY, $destWWW."/".$equipe{'Miniteam',$team}.".html"); @copy=<fileCOPY>; close (fileCOPY);
  open(fileCOPY, ">vieux/".$equipe{'Miniteam',$team}."-".$b.".html"); print fileCOPY (@copy); close (fileCOPY);
  $team++;
}
&diff_time("FIN - Fin du fichier");
exit(0);

sub debut_tableau {
  local ($f1, $f2) = @_;
  print $f1 ("<table class=\"corps\">\n");
  print $f1 ("<tr>\n");
  print $f1 ("<th rowspan=\"2\">");
  if ($f2 eq "non") { print $f1 ("Pos"); } else { print $f1 ("Actifs"); }
  print $f1 ("</th>\n");
  print $f1 ("<th rowspan=\"2\"><a href=\"./team51.txt\" target=\"_blank\">AF</a></th>\n");
  print $f1 ("<th rowspan=\"2\">Folding</th>\n");
  print $f1 ("<th rowspan=\"2\">Noms des membres actifs</th>\n");
  print $f1 ("<th rowspan=\"2\">Points</th>\n");
  print $f1 ("<th rowspan=\"2\"><a href=\"".$ip8."\" target=\"_blank\">WU</a></th>\n");
  print $f1 ("<th colspan=\"8\">Production</th>\n");
  if ($use_aff_semaine == 0) {
    print $f1 ("<th colspan=\"4\">+/- AF</th>\n");
    print $f1 ("<th colspan=\"4\">+/- Folding</th>\n");
  } else {
    print $f1 ("<th colspan=\"2\">+/- AF</th>\n");
    print $f1 ("<th colspan=\"2\">+/- Folding</th>\n");
  }
  print $f1 ("</tr>\n");
  print $f1 ("<tr>\n");
  print $f1 ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th><th>J-4</th><th>J-5</th><th>J-6</th><th>Semaine</th>\n");
  if ($use_aff_semaine == 0) {
    print $f1 ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th>\n");
    print $f1 ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th>\n");
  } else {
    print $f1 ("<th>Jour</th><th>Semaine</th>\n");
    print $f1 ("<th>Jour</th><th>Semaine</th>\n");
  }
  print $f1 ("</tr>\n");
}

sub debut_tableau3 {
  local ($f1, $f2) = @_;
  print $f1 ("<TABLE WIDTH=\"100%\" border=\"1\"><TR BGCOLOR=\"".$couleur_fond[$jour2]."\"><TD ROWSPAN=\"2\" ALIGN=\"center\">");
  if ($f2 eq "non") { print $f1 ("<FONT SIZE=\"-1\">Pos</font>"); } else { print $f1 ("<FONT SIZE=\"-2\">Actifs</font>"); }
  print $f1 ("</td><TD ROWSPAN=\"2\" ALIGN=\"center\"><FONT SIZE=\"-2\"><a href=\"./team51.txt\" target=\"_blank\">AF</a></font></td><TD ROWSPAN=\"2\" ALIGN=\"center\"><FONT SIZE=\"-2\">Folding</font></td>");
  print $f1 ("<TD ROWSPAN=\"2\" ALIGN=\"center\"><font color=\"#006400\" SIZE=\"-1\">Noms des membres actifs</font>\n");
  print $f1 ("</td><TD ROWSPAN=\"2\" ALIGN=\"center\"><a href=\"".$ip5."results.html\" target=\"_blank\"><FONT SIZE=\"-1\">Points</font></a></td><td colspan=8 ALIGN=\"center\"><FONT SIZE=\"-1\">Production</font></td><td colspan=4 ALIGN=\"center\">");
  print $f1 ("<FONT SIZE=\"-1\">+/- AF</font></td><td colspan=4 ALIGN=\"center\"><FONT SIZE=\"-1\">+/- Folding</font></td><TD ROWSPAN=\"2\" ALIGN=\"center\"><a href=\"".$ip8."\" target=\"_blank\"><FONT SIZE=\"-2\">WU</font></a></td></tr>");
  print $f1 ("<TR BGCOLOR=".$couleur_fond[$jour2]."><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-1</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-2</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-3</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-4</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-5</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-6</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">Semaine</font></td>");
  print $f1 ("<TD ALIGN=\"center\"><FONT SIZE=\"-3\">J</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-1</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-2</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-3</font></td>");
  print $f1 ("<TD ALIGN=\"center\"><FONT SIZE=\"-3\">J</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-1</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-2</font></td><TD ALIGN=\"center\"><FONT SIZE=\"-3\">J-3</font></td></tr>");
}

sub debut_tableau5 {
  local ($f1, $f2, $f3) = @_;
  if ($f3 == 1) {
    print $f1 ("<table class=\"corps\">\n");
  }
  print $f1 ("<tr>\n");
  print $f1 ("<th rowspan=\"2\">");
  if ($f2 eq "non") { print $f1 ("Pos"); } else { print $f1 ("Actifs"); }
  print $f1 ("</th>\n");
  print $f1 ("<th rowspan=\"2\"><a href=\"$f2\" target=\"_blank\">MT</a></th>\n");
  print $f1 ("<th rowspan=\"2\"><a href=\"./team51.txt\" target=\"_blank\">AF</a></th>\n");
  print $f1 ("<th rowspan=\"2\">Folding</th>\n");
  print $f1 ("<th rowspan=\"2\">Noms des membres actifs</th>\n");
  print $f1 ("<th rowspan=\"2\">Points</th>\n");
  print $f1 ("<th colspan=\"8\">Production</th>\n");
  print $f1 ("</tr>\n");
  print $f1 ("<tr>\n");
  print $f1 ("<th>&nbsp;J&nbsp;</th><th>J-1</th><th>J-2</th><th>J-3</th><th>J-4</th><th>J-5</th><th>J-6</th><th>Semaine</th>\n");
  print $f1 ("</tr>\n");
}

sub tableau3 {
  local ($f2, $f3, $f5, $f4, $nom_utile) = @_;
  my $pT_Semaine = $p1+$p2+$p3+$p4+$p5+$p6+$p7;
  my $gT_Semaine = $g1+$g2+$g3+$g4+$g5+$g6+$g7;
  my $format_posg = format_number($posg[$actuelle]);
  my $format_unite = format_number($unite[$actuelle]);
  my $format_wu = format_number($wu[$actuelle]);
  my $format_f3 = format_number($f3);
  my $format_f4 = format_number($f4);
  my $format_f5 = format_number($f5);
  my $format_u1 = format_number($u1);
  my $format_u2 = format_number($u2);
  my $format_u3 = format_number($u3);
  my $format_u4 = format_number($u4);
  my $format_u5 = format_number($u5);
  my $format_u6 = format_number($u6);
  my $format_u7 = format_number($u7);
  my $format_ut = format_number($ut);
  my $format_p1 = format_number($p1);
  my $format_p2 = format_number($p2);
  my $format_p3 = format_number($p3);
  my $format_p4 = format_number($p4);
  my $format_pT_Semaine = format_number($pT_Semaine);
  my $format_g1 = format_number($g1);
  my $format_g2 = format_number($g2);
  my $format_g3 = format_number($g3);
  my $format_g4 = format_number($g4);
  my $format_gT_Semaine = format_number($gT_Semaine);
  $xyz_chr = decode_accent($xyz);
  my $xyz_chr_uri = uri_unescape($xyz_chr);
  my $xyz_chr_aff = codage_html($xyz_chr_uri);
  my $xyz_chr_fah_eoc = codage_eoc($xyz_chr_aff);
  
  #print("$xyz ==> $xyz_chr ==> $xyz_chr_uri\n");
  $mem0[$f2] .= $format_f5."<br>";
  $mem1[$f2] .= "<a href=\"javascript:seoc('".$xyz_chr_fah_eoc."')\">".$format_f3."</a><br>";
  if ($tri_uid{$xyz_chr_uri} ne "" and $tri_uid{$xyz_chr_uri} ne "-1") {
    $mem2[$f2] .= "<a href=\"javascript:fah('".$xyz_chr_fah_eoc."',".$tri_uid{$xyz_chr_uri}.")\">".$format_f4."</a><br>";
  } else {
    $mem2[$f2] .= $format_f4."<br>";
  }
  $mem3[$f2] .= $format_posg."<br>";
  $allo_ok = 0;
  if ($unite[$actuelle-1] == 0 or $posn[$actuelle-1] == 0 or $posg[$actuelle-1] == 0) { $mem4[$f2] .= "<font color=\"blue\">".$xyz_chr_aff."</font><br>"; if ($f2 eq "file") { $allo++; $mem_nom[$allo] = $nom[$actuelle]; $mem_total += $u1; $allo_ok = 1; } } else { $mem4[$f2] .= $xyz_chr_aff."<br>"; }
  $mem5[$f2] .= $format_unite."<br>";
  if ($u1 > 0 and $u2 == 0 and $u3 == 0 and $u4 == 0 and $u5 == 0 and $u6 == 0 and $u7 == 0) { if ($f2 eq "file" and not $allo_ok) { $nouv++; } $mem6[$f2] .= "<font color=\"blue\">".$format_u1."</font><br>"; } else { $mem6[$f2] .= $format_u1."<br>"; }
  $mem7[$f2] .= $format_u2."<br>";
  $mem8[$f2] .= $format_u3."<br>";
  $mem9[$f2] .= $format_u4."<br>";
  $mem10[$f2] .= $format_u5."<br>";
  $mem11[$f2] .= $format_u6."<br>";
  if ($u1 == 0 and $u2 == 0 and $u3 == 0 and $u4 == 0 and $u5 == 0 and $u6 == 0 and $u7 > 0) {
    if ($f2 eq "file") {
      $perte++;
      if ($f3 < 31) {
        $nom_affichable = &change_nom($nom_utile);
        print message ("<font color=\"green\"><strong>".$nom_affichable."</strong></font> qui est parmi nos 30 meilleurs ne produit plus depuis une semaine. <strong>:(</strong>  J'esp&eacute;re qu'il reviendra produire avec nous.<br>\n");
      }
    } $mem12[$f2] .= "<font color=\"red\">".$format_u7."</font><br>";
  } else { $mem12[$f2] .= $format_u7."<br>"; }
  $mem13[$f2] .= $format_ut."<br>";
  $mem14[$f2] .= $format_p1."<br>";
  $mem15[$f2] .= $format_p2."<br>";
  $mem16[$f2] .= $format_p3."<br>";
  $mem17[$f2] .= $format_p4."<br>";
  $mem18[$f2] .= $format_g1."<br>";
  $mem19[$f2] .= $format_g2."<br>";
  $mem20[$f2] .= $format_g3."<br>";
  $mem21[$f2] .= $format_g4."<br>";
  $mem22[$f2] .= $format_wu."<br>";
  $mem23[$f2]++;
  $mem24[$f2]++;
  $mem25[$f2] .= $format_pT_Semaine."<br>";
  $mem26[$f2] .= $format_gT_Semaine."<br>";
  print actives_team51 ($f5."\t".$f3."\t".$f4."\t".decode_html($nom_utile)."\t".$unite[$actuelle]."\t".$wu[$actuelle]."\t");
  print actives_team51 ($u1."\t".$u2."\t".$u3."\t".$u4."\t".$u5."\t".$u6."\t".$u7."\t");
  if ($use_aff_semaine == 0) {
    print actives_team51 ($ut."\t".$p1."\t".$p2."\t".$p3."\t".$p4."\t");
	print actives_team51 ($g1."\t".$g2."\t".$g3."\t".$g4."\n");
  } else {
    print actives_team51 ($ut."\t".$p1."\t".$pT_Semaine."\t");
	print actives_team51 ($g1."\t".$gT_Semaine."\n");
  }
}

sub tableau5 {
  local ($f2, $f3, $f5, $f4) = @_;
  my $pT_Semaine = $p1+$p2+$p3+$p4+$p5+$p6+$p7;
  my $gT_Semaine = $g1+$g2+$g3+$g4+$g5+$g6+$g7;
  my $format_posg = format_number($posg[$actuelle]);
  my $format_unite = format_number($unite[$actuelle]);
  my $format_wu = format_number($wu[$actuelle]);
  my $format_f3 = format_number($f3);
  my $format_f5 = format_number($f5);
  my $format_f4 = format_number($f4);
  my $format_u1 = format_number($u1);
  my $format_u2 = format_number($u2);
  my $format_u3 = format_number($u3);
  my $format_u4 = format_number($u4);
  my $format_u5 = format_number($u5);
  my $format_u6 = format_number($u6);
  my $format_u7 = format_number($u7);
  my $format_ut = format_number($ut);
  my $format_p1 = format_number($p1);
  my $format_p2 = format_number($p2);
  my $format_p3 = format_number($p3);
  my $format_p4 = format_number($p4);
  my $format_p5 = format_number($p5);
  my $format_p6 = format_number($p6);
  my $format_p7 = format_number($p7);
  my $format_pT_Semaine = format_number($pT_Semaine);
  my $format_g1 = format_number($g1);
  my $format_g2 = format_number($g2);
  my $format_g3 = format_number($g3);
  my $format_g4 = format_number($g4);
  my $format_g5 = format_number($g5);
  my $format_g6 = format_number($g6);
  my $format_g7 = format_number($g7);
  my $format_gT_Semaine = format_number($gT_Semaine);
  $xyz_chr = decode_accent($xyz);
  my $xyz_chr_uri = uri_unescape($xyz_chr);
  my $xyz_chr_aff = codage_html($xyz_chr_uri);
  my $xyz_chr_fah_eoc = codage_eoc($xyz_chr_uri);

  #print("$xyz ==> $xyz_chr ==> $xyz_chr_uri\n");
  print $f2 ("<tr><td class=\"right\">".$format_f3."</td><td class=\"right\">".$format_f5."</td><td class=\"right\"><a href=\"javascript:seoc('".$xyz_chr_fah_eoc."')\">".$format_f4."</a></td>");
  if ($tri_uid{$xyz_chr_uri} ne "" and $tri_uid{$xyz_chr_uri} ne "-1") {
    print $f2 ("<td class=\"right\"><a href=\"javascript:fah('".$xyz_chr_fah_eoc."',".$tri_uid{$xyz_chr_uri}.")\">".$format_posg."</a></td><td>".$xyz_chr_aff);
  } else {
    print $f2 ("<td class=\"right\">".$format_posg."</td><td>".$xyz_chr_aff);
  }
  if ($unite[$actuelle-1] == 0 or $posn[$actuelle-1] == 0 or $posg[$actuelle-1] == 0) { print $f2 ("&nbsp;<img src=\"images/jgp_new.gif\" border=\"0\">"); }
  elsif ($u1 > 0 and $u2 == 0 and $u3 == 0 and $u4 == 0 and $u5 == 0 and $u6 == 0 and $u7 == 0) { print $f2 ("&nbsp;<img src=\"images/jgp_allo.gif\" border=\"0\">"); }
  elsif ($u1 == 0 and $u2 == 0 and $u3 == 0 and $u4 == 0 and $u5 == 0 and $u6 == 0 and $u7 > 0) { print $f2 ("&nbsp;<img src=\"images/jgp_bye.gif\" border=\"0\">"); }
  else {}
  print $f2 ("</td><td class=\"right\">");
  if ($use_aff_semaine == 0) {
    print $f2 ("<a href=\"#\" onmouseover=\"return(BX('".$format_p1."','".$format_p2."','".$format_p3."','".$format_p4."','".$format_p5."','".$format_p6."','".$format_p7."','".$format_g1."','".$format_g2."','".$format_g3."','".$format_g4."','".$format_g5."','".$format_g6."','".$format_g7."','".$format_wu."'));\" onmouseout=\"return(BulleHide ());\">".$format_unite."</a>");
  } else {
    print $f2 ("<a href=\"#\" onmouseover=\"return(BXwS('".$format_p1."','".$format_pT_Semaine."','".$format_g1."','".$format_gT_Semaine."','".$format_wu."'));\" onmouseout=\"return(BulleHide ());\">".$format_unite."</a>");
  }
  print $f2 ("</td><td class=\"right\">".$format_u1."</td><td class=\"right\">".$format_u2."</td><td class=\"right\">".$format_u3."</td><td class=\"right\">".$format_u4."</td><td class=\"right\">".$format_u5."</td><td class=\"right\">".$format_u6."</td><td class=\"right\">".$format_u7."</td>");
  print $f2 ("<td class=\"right\">".$format_ut."</td></tr>\n");
}

sub Entete_txt {
  local ($f1, $f2, $f3) = @_;
  if ($f2 == "0") { $long = ""; }
  if ($f2 == "1") { $long = " "; }
  if ($f2 == "2") { $long = "  "; }
  if ($f2 == "3") { $long = "   "; }
  if ($f2 == "4") { $long = "    "; }
  if ($f2 == "5") { $long = "     "; }
  if ($f2 == "6") { $long = "      "; }
  if ($f2 == "7") { $long = "       "; }
  if ($f2 == "8") { $long = "        "; }
  if ($f2 == "9") { $long = "         "; }
  print $f1 <<EOT;
             $long FOLDING\@HOME
          LISTE DES MEMBRES $f3
        $long L'ALLIANCE FRANCOPHONE

EOT
  &Print_txt($f1, "Pos", "Team", "Folding", "Nom du membre", "Points", "WU", 1);
  print $f1 ("--------------------------------------------------------------------------------------------------------------------------------\n");
}

sub Print_txt {
  local ($f1, $f2, $f8, $f3, $f4, $f5, $f6, $f7) = @_;
  if ($f7 == 0) { print $f1 ($f2+1); } else { print $f1 ($f2); }
  print $f1 ("\t$f8\t\t");
  print $f1 ("\t$f3\t\t");
  if (length($f4) < 8) { print $f1 ("$f4\t\t\t\t\t\t\t"); }
  elsif (length($f4) < 16) { print $f1 ("$f4\t\t\t\t\t\t"); }
  elsif (length($f4) < 24) { print $f1 ("$f4\t\t\t\t\t"); }
  elsif (length($f4) < 32) { print $f1 ("$f4\t\t\t\t"); }
  elsif (length($f4) < 40) { print $f1 ("$f4\t\t\t"); }
  elsif (length($f4) < 48) { print $f1 ("$f4\t\t"); }
  else { print $f1 ("$f4\t"); }
  if (length($f5) < 8) { print $f1 ("$f5\t\t"); }
  else { print $f1 ("$f5\t"); }
  print $f1 ("$f6\n");
}

sub Meta_html {
  local ($f1) = @_;
  if ($f1 eq "file" or $f1 eq "filemini" or $f1 eq "fileeffectif" or $f1 eq "filegraphs" or $f1 eq "filetopprod" or $f1 eq "filelistmembs") {
    print $f1 ("<!DOCTYPE html>\n");
  }
  print $f1 ("<html>\n");
  print $f1 ("<head>\n");
  print $f1 ("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF8\">\n");
  print $f1 ("<meta name=\"Author\" lang=\"fr, en-us\" content=\"JGP SOLDAT\">\n");
  print $f1 ("<meta name=\"Description\" content=\"Statistiques des performances de l'Alliance Francophone chez Folding\@home\">\n");
  print $f1 ("<meta name=\"Keywords\" LANG=\"fr\" content=\"JGP SOLDAT, calcul distribué, Folding\@home, Foldingathome, Stanford, Forum, Alliance Francophone, Québec, Quebec, France, français, francais, Folding at Home\">\n");
  print $f1 ("<meta name=\"Identifier-URL\" content=\"".$ip_interne."\">\n");
  print $f1 ("<meta name=\"Publisher\" content=\"JGP SOLDAT\">\n");
  print $f1 ("<link rel=\"stylesheet\" href=\"./site/StatStyle.css\" type=\"text/css\">\n");
  print $f1 ("<style>\n");
  print $f1 (".corps th {background-color:".$couleur_fond[$jour2]."}\n");
  print $f1 (".center    {text-align:center}\n");
  if ($f1 eq "fileeffectif") {
    print $f1 (".effectif_corps th {background-color:".$couleur_fond[$jour2]."}\n");
  }
  print $f1 ("</style>\n");
  if ($f1 ne "filemini" and $f1 ne "fileeffectif" and $f1 ne "filegraphs" and $f1 ne "filelistmembs") {
    print $f1 ("<script type=\"text/javascript\" src=\"https://code.jquery.com/jquery-3.5.0.js\"></script>\n");
    print $f1 ("<script language=\"javascript\"><!--\n");
    print $f1 ("function seoc(nom) {\n");
    print $f1 ("nom=nom.replace(\"&\", \"%26\")\n");
    print $f1 ("\$.get('https://folding.extremeoverclocking.com/xml/user_summary.php?un='+nom+'&t=51', function(responseXml) {\n");
    print $f1 ("var xml = \$(responseXml);\n");
    print $f1 ("var userid = \$('UserID', xml).text();\n");
    print $f1 ("var url = 'https://folding.extremeoverclocking.com/user_summary.php?u='+userid;\n");
    print $f1 ("var args = '';\n");
    print $f1 ("window.open(url, nom+' chez EOC', args);\n");
    # print $f1 ("if (typeof(EOCWin) != \"object\"){ EOCWin = window.open(url, '_blank', args);\n");
    # print $f1 ("} else {\n");
    # print $f1 ("if (!EOCWin.closed){ EOCWin.location.href = url; } else { EOCWin = window.open(url, nom, args); }\n");
    # print $f1 ("}\n");
    # print $f1 ("EOCWin.focus();\n");
    print $f1 ("});\n");
    print $f1 ("}\n");
  } else {
    print $f1 ("<script language=\"javascript\"><!--\n");
  }
  print $f1 ("function fah(nom, userid) {\n");
  print $f1 ("var url = '$url_javascript';\n");
  print $f1 ("url = url + userid;\n");
  print $f1 ("var args = '';\n");
  print $f1 ("window.open(url, nom+' chez Folding', args);\n");
  # print $f1 ("if (typeof(FAHWin) != \"object\"){ FAHWin = window.open(url, '_blank', args);\n");
  # print $f1 ("} else {\n");
  # print $f1 ("if (!FAHWin.closed){ FAHWin.location.href = url; } else { FAHWin = window.open(url, nom, args); }\n");
  # print $f1 ("}\n");
  # print $f1 ("FAHWin.focus();\n");
  print $f1 ("}\n");
  print $f1 ("function f(nom) {\n");
  print $f1 ("var url = '$url_javascript_classic';\n");
  print $f1 ("url = url + nom;\n");
  print $f1 ("var args = '';\n");
  print $f1 ("window.open(url, nom+' chez Folding', args);\n");
  # print $f1 ("if (typeof(FoldingWin) != \"object\"){ FoldingWin = window.open(url, '_blank', args);\n");
  # print $f1 ("} else {\n");
  # print $f1 ("if (!FoldingWin.closed){ FoldingWin.location.href = url; } else { FoldingWin = window.open(url, nom, args); }\n");
  # print $f1 ("}\n");
  # print $f1 ("FoldingWin.focus();\n");
  print $f1 ("}\n");
  print $f1 ("// --></script>\n");
}

sub Body_html {
  local ($f1) = @_;
  print $f1 ("<body>\n");
  print $f1 ("<div id=\"container\">\n");
  print $f1 ("<div id=\"header\">\n");
  print $f1 ("<div id=\"logo\">\n");
  print $f1 ("<div class=\"wrapper\">\n");
  print $f1 ("<a href=\"".$ip6."\"><img style=\"width:1050px\" src=\"./site/images_site/logo_1050.png\" title=\"Statistiques de l'Alliance Francophone - Folding\@home\"></a>\n");
  print $f1 ("</div>\n");
  print $f1 ("</div>\n");
  print $f1 ("</div>\n");
  print $f1 ("<div id=\"main\">\n");
  print $f1 ("<div id=\"navbar\">\n");
  print $f1 ("<ul class=\"nav\">\n");
  print $f1 ("<!--li><a href=\"https://www.alliancefrancophone.org/\">Accueil de l'Alliance</a></li-->\n");
  print $f1 ("<li><a href=\"../index.html\">Accueil des stats</a></li>\n");
  if ($f1 eq "file") {
    print $f1 ("<li id=\"active\"><a href=\"../Alliance.html\">Classement membres de l'AF</a></li>\n");
  } else {
    print $f1 ("<li><a href=\"../Alliance.html\">Classement membres de l'AF</a></li>\n");
  }
  if ($f1 eq "filemini") {
    print $f1 ("<li id=\"active\"><a href=\"../miniteam.html\">Classement mini-teams</a></li>\n");
  } else {
    print $f1 ("<li><a href=\"../miniteam.html\">Classement mini-teams</a></li>\n");
  }
  print $f1 ("<li><a href=\"./site/TeamsStats.html\">Statistiques</a></li>\n");
  print $f1 ("<li><a href=\"./site/TeamsPays.html\">Mini-teams pays</a></li>\n");
  print $f1 ("<li><a href=\"./site/TeamsActives.html\">Mini-teams actives</a></li>\n");
  print $f1 ("<li><a href=\"./site/TeamsSommeil.html\">Mini-teams en sommeil</a></li>\n");
  print $f1 ("<li><a href=\"https://forum.alliancefrancophone.org/\">Forum de l'Alliance</a></li>\n");
  print $f1 ("</ul>\n");
  print $f1 ("</div>\n");
  print $f1 ("<div id=\"content\">\n");
  print $f1 ("<a id=\"top\" name=\"top\"></a>\n");
}

sub Tail_html {
  local ($f1) = @_;
  print $f1 ("</div>\n</div>\n<div id =\"footer\">\n");
  print $f1 ("<div class=\"row_latest\">\n<div class=\"latest\">\n<div class=\"latest_text\">");
  print $f1 ("<p><a href=\"http://folding.fleucorp.net/installation.htm\" target=\"_blank\">Élaboré par JGP SOLDAT</a>&nbsp;-&nbsp;Maintenu par <a href=\"/code/fahCode.7z\" target=\"_blank\">Kana-chan</a> avec l'aimable participation de Dylav de Zebulon.fr&nbsp;-&nbsp;Version 7.10<a href=\"".$homeWWW."\" class=\"top_button\">HOME</a><a href=\"#top\" class=\"top_button\">HAUT</a></p>\n");
  print $f1 ("</div>\n</div>\n</div>\n</div>\n</div>\n");

  print $f1 ("</body>\n");
  print $f1 ("</html>\n");
}

sub Print_totaux3 {
  local ($f1, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9, $f10) = @_;
  my $format_f2 = format_number($f2);
  my $format_f3 = format_number($f3);
  my $format_f4 = format_number($f4);
  my $format_f5 = format_number($f5);
  my $format_f6 = format_number($f6);
  my $format_f7 = format_number($f7);
  my $format_f8 = format_number($f8);
  my $format_f9 = format_number($f9);
  my $format_f10 = format_number($f10);
  print $f1 ("<tr><td colspan=4>TOTAUX: (Membres actifs et non actifs)</td><td class=\"right\">".$format_f2."</td><td class=\"right\">".$format_f3."</td><td class=\"right\">".$format_f4."</td><td class=\"right\">".$format_f5."</td><td class=\"right\">".$format_f6."</td><td class=\"right\">".$format_f7."</td><td class=\"right\">".$format_f8."</td><td class=\"right\">".$format_f9."</td><td class=\"right\">".$format_f10."</td><td colspan=9>&#160;</td></tr></table>\n");
}

sub Print_totaux5 {
  local ($f1, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9, $f10) = @_;
  my $format_f2 = format_number($f2);
  my $format_f3 = format_number($f3);
  my $format_f4 = format_number($f4);
  my $format_f5 = format_number($f5);
  my $format_f6 = format_number($f6);
  my $format_f7 = format_number($f7);
  my $format_f8 = format_number($f8);
  my $format_f9 = format_number($f9);
  my $format_f10 = format_number($f10);
  print $f1 ("<tr><td colspan=5>TOTAUX: (Membres actifs et non actifs)</td><td class=\"right\">".$format_f2."</td><td class=\"right\">".$format_f3."</td><td class=\"right\">".$format_f4."</td><td class=\"right\">".$format_f5."</td><td class=\"right\">".$format_f6."</td><td class=\"right\">".$format_f7."</td><td class=\"right\">".$format_f8."</td><td class=\"right\">".$format_f9."</td><td class=\"right\">".$format_f10."</td></tr></table>\n");
}

sub Print_page_membre {
  local ($f1, $f2) = @_;
  print $f1 ("<tr align=\"right\"><td>".$mem0[$f2]."</td><td>".$mem1[$f2]."</td>\n");
  print $f1 ("<td>".$mem2[$f2]."</td>\n");
  if ($f1 ne "file") { print $f1 ("<td>".$mem3[$f2]."</td>\n"); }
  print $f1 ("<td align=\"left\">".$mem4[$f2]."</td>\n");
  print $f1 ("<td>".$mem5[$f2]."</td>\n");
  print $f1 ("<td>".$mem22[$f2]."</td>\n");
  print $f1 ("<td>".$mem6[$f2]."</td>\n");
  print $f1 ("<td>".$mem7[$f2]."</td>\n");
  print $f1 ("<td>".$mem8[$f2]."</td>\n");
  print $f1 ("<td>".$mem9[$f2]."</td>\n");
  print $f1 ("<td>".$mem10[$f2]."</td>\n");
  print $f1 ("<td>".$mem11[$f2]."</td>\n");
  print $f1 ("<td>".$mem12[$f2]."</td>\n");
  print $f1 ("<td>".$mem13[$f2]."</td>\n");
  print $f1 ("<td>".$mem14[$f2]."</td>\n"); # Jour
  if ($use_aff_semaine == 0) {
    print $f1 ("<td>".$mem15[$f2]."</td>\n");
    print $f1 ("<td>".$mem16[$f2]."</td>\n");
    print $f1 ("<td>".$mem17[$f2]."</td>\n");
  } else {
    print $f1 ("<td>".$mem25[$f2]."</td>\n"); # Total semaine
  }
  print $f1 ("<td>".$mem18[$f2]."</td>\n"); # Jour
  if ($use_aff_semaine == 0) {
    print $f1 ("<td>".$mem19[$f2]."</td>\n");
    print $f1 ("<td>".$mem20[$f2]."</td>\n");
    print $f1 ("<td>".$mem21[$f2]."</td>\n");
  } else {
    print $f1 ("<td>".$mem26[$f2]."</td>\n"); # Total semaine
  }
  print $f1 ("</tr>\n");
}

sub TEST {
  local ($nom1, $team1, $texteDbg) = @_;
  if ($nom1 eq "") { print("Dans ".$texteDbg." recherche de nom vide!\n"); return 0; }
  $drapeau = 0;
  $tmp = 1;
  if ($test == 1 or $nom_a_trouver eq $nom1) { print("\n***** Test le nom $nom1 dans la team $team1 *****\n"); }
  if ($NR[$team1] > 0) {
    while ($tmp-1+$pos_ret[$team1] < $NR[$team1]+$pos_ret[$team1]) {
      $ttt = "$retrait[$pos_ret[$team1]+$tmp]";
      if ($test == 1 or $nom_a_trouver eq $nom1) { print("RETRAIT: [".$retrait[$pos_ret[$team1]+$tmp]."]\n"); }
      if (lc($nom1) eq lc($ttt)) { return($drapeau); }
      $tmp++;
    }
  }
  $drapeau = 0;
  $tmp = 1;
  if ($NA[$team1] > 0) {
    while ($tmp-1+$pos_ajo[$team1] < $NA[$team1]+$pos_ajo[$team1]) {
      $ttt = "$ajout[$pos_ajo[$team1]+$tmp]";
      $lcttt = lc($ttt);
      if ($test == 1 or $nom_a_trouver eq $nom1) { print("AJOUT: [".$ajout[$pos_ajo[$team1]+$tmp]."]\n"); }
      if ($nom1 =~ /$ttt/ or lc($nom1) =~ /$lcttt/) { $drapeau = 1; }
      $tmp++;
    }
  }
  $tmp = 1;
  if ($NAM[$team1] > 0) {
    while ($tmp-1+$pos_mem[$team1] < $NAM[$team1]+$pos_mem[$team1]) {
      $ttt = "$ajout_membre[$pos_mem[$team1]+$tmp]";
      if ($test == 1 or $nom_a_trouver eq $nom1) { print("AJOUT MEMBRE: [".$ajout_membre[$pos_mem[$team1]+$tmp]."]\n"); }
      if (lc($nom1) eq lc($ttt)) { $drapeau = 1; }
      $tmp++;
    }
  }
  return($drapeau);
}

sub Get_membre {
  local ($miniteam1, $pos) = @_;
  my $miniteam_nom = encode("cp1252", decode("utf8", $miniteam1));
  $donner = "miniteam, membre1, pos, point, p_jour, n_actif, classement";
  if ($test == 1) { print("SELECT miniteam,membre1,classement FROM membre WHERE pos = ".$pos."\n"); }
  $do = $db->prepare("SELECT miniteam,membre1,classement FROM membre WHERE pos = ".$pos);
  $ErrNum = $do->execute() or die $DBI::errstr;
  while ($ErrNum >= 0 and my @data = $do->fetchrow_array()) {
    #print("Team extraite [".$data[0]."] ==> team argument [".$miniteam_nom."]\n");
    if ($data[0] eq $miniteam_nom) { return($data[1], $data[2]); }
  }
  print message ("Une nouvelle mini-team a maintenant sa propre page de statistique: ");
  print message ("<a href=\"".$ip_interne."/".$miniteam1.".html\">".$miniteam1."</a>   ");
  print("***** Retourne = $miniteam1 n'est pas dans la liste *****\n");
  return(0);
}

sub Put_membre {
  local ($miniteam1, $membre_t, $pos, $point_team, $point_J1, $team_non_actif, $classement) = @_;
  $miniteam1 = decode("cp1252", $miniteam1);
  my $value = $db->selectrow_array("SELECT count(*) FROM membre WHERE miniteam = '".$miniteam1."' AND pos = ".$pos);
  if ($value == 0) {
    $donner = "miniteam, membre1, pos, point, p_jour, n_actif, classement";
    $valeur = "'".$miniteam1."', '".$membre_t."', '".$pos."', '".$point_team."', '".$point_J1."', '".$team_non_actif."', '".$classement."'";
    # print("INSERT INTO membre (".$donner.") VALUES (".$valeur.")\n");
    $do = $db->prepare("INSERT INTO membre (".$donner.") VALUES (".$valeur.")");
    $ErrNum = $do->execute() or die $DBI::errstr;
    if ($ErrNum < 0) {
      print("\n***** Erreur dans l'ecriture des membres *****\n");
      print("miniteam= $miniteam1 membre= $membre_t position=$pos\n");
      print($ErrNum."  ".$$DBI::errstr."\n");
    }
  }
}

sub change_nom {
  local ($check_nom) = @_;
  $retour = $check_nom;
  if ($check_nom =~ /Quebec_\(Quebec\)/) { $allo1 = "<a href=\"http:\/\/www.excavamini.c.la\/\" target=\"_blank\">www.excavamini.c.la</a>"; $check_nom =~ s/Quebec_\(Quebec\)/$allo1/; $retour = $check_nom; }
  # elsif ($check_nom =~ /Maskainfo\.qc\.ca/) { $retour = "<a href=\"JavaScript:window.open_maskainfo\('Maskainfo.html'\)\" onclick=\"javascript:window.open_maskainfo\('Maskainfo.html'\)\">".$nom[$actuelle]."</a>"; }
  elsif ($check_nom =~ /epsi_paris/) { $allo1 = "<a href=\"http:\/\/www.epsi.fr\/\" target=\"_blank\">epsi paris</a>"; $check_nom =~ s/epsi_paris/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /www\.choisnet\.ath\.cx/) { $retour = "<a href=\"http://www.choisnet.ath.cx/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }
  elsif ($check_nom =~ /www\.divx2001\.fr\.fm/) { $retour = "<a href=\"http://www.divx2001.fr.fm/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }   
  elsif ($check_nom =~ /www\.association-rivages\.org/) { $retour = "<a href=\"http://www.association-rivages.org/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }
  elsif ($check_nom =~ /http:\/\/rich\.2y\.net/) { $retour = "<a href=\"http://rich.2y.net/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }
  elsif ($check_nom =~ /Freesec\.net/) { $retour = "<a href=\"http://Freesec.net/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }
  elsif ($check_nom =~ /Barbones\.com/) { $allo1 = "<a href=\"http:\/\/barbones.com\/\" target=\"_blank\">Barbones.com</a>"; $check_nom =~ s/Barbones.com/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /www\.co-voiturage\.fr/) { $allo1 = "<a href=\"http:\/\/www.co-voiturage.fr\/\" target=\"_blank\">www.co-voiturage.fr</a>"; $check_nom =~ s/www.co-voiturage.fr/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /www\.lesfondecrans\.net/) { $allo1 = "<a href=\"http:\/\/www.lesfondecrans.net\/\" target=\"_blank\">www.lesfondecrans.net</a>"; $check_nom =~ s/www.lesfondecrans.net/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /www\.boutiquezen\.com/) { $allo1 = "<a href=\"http:\/\/www.boutiquezen.com\/\" target=\"_blank\">www.boutiquezen.com</a>"; $check_nom =~ s/www.boutiquezen.com/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /Lycee_Jean-Mermoz_Montpellier/) { $allo1 = "<a href=\"http:\/\/www.lycee-mermoz.net\/\" target=\"_blank\">Lycee Jean-Mermoz Montpellier</a>"; $check_nom =~ s/Lycee_Jean-Mermoz_Montpellier/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /Lycee_Guy_Chauvet_Loudun/) { $allo1 = "<a href=\"http:\/\/hebergement.ac-poitiers.fr\/l-gc-loudun\/\" target=\"_blank\">Lycee Guy Chauvet Loudun</a>"; $check_nom =~ s/Lycee_Guy_Chauvet_Loudun/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /Gnux_\[gnux\.dyndns\.org\]/) { $allo1 = "<a href=\"http:\/\/gnux.dyndns.org\/\" target=\"_blank\">gnux.dyndns.org</a>"; $check_nom =~ s/gnux.dyndns.org/$allo1/; $retour = $check_nom; }
  # elsif ($check_nom =~ /Forum\.Hardware\.FR/) { $allo1 = "<a href=\"http:\/\/Forum.Hardware.FR\/\" target=\"_blank\">Forum.Hardware.FR</a>"; $check_nom =~ s/Forum.Hardware.FR/$allo1/; $retour = $check_nom; }
  # elsif ($check_nom =~ /\[HFR\]/) { $allo1 = "<a href=\"http:\/\/Forum.Hardware.FR\/\" target=\"_blank\">HFR</a>"; $check_nom =~ s/HFR/$allo1/; $retour = $check_nom; }
  # elsif ($check_nom =~ /\[hfr\]/) { $allo1 = "<a href=\"http:\/\/Forum.Hardware.FR\/\" target=\"_blank\">hfr</a>"; $check_nom =~ s/hfr/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /\[Info-G\]/) { $allo1 = "<a href=\"http:\/\/www.info-g.com\/\" target=\"_blank\">Info-G</a>"; $check_nom =~ s/Info-G/$allo1/g; $retour = $check_nom; }
  elsif ($check_nom =~ /donkeyfr\.org/) { $allo1 = "<a href=\"http:\/\/donkeyfr.org\/\" target=\"_blank\">donkeyfr.org</a>"; $check_nom =~ s/donkeyfr.org/$allo1/; $retour = $check_nom; }
  elsif ($check_nom =~ /http:\/\/autoKtone\.net/) { $retour = "<a href=\"http://autoKtone.net/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }
  elsif ($check_nom =~ /OverClocking-Masters\.com/) { $retour = "<a href=\"http://OverClocking-Masters.com/\" target=\"_blank\">".$nom[$actuelle]."</a>"; }
  else { $allo1 = "<a href=\"http:\/\/hardware.fr\/\" target=\"_blank\">hardware.fr</a>"; $check_nom =~ s/hardware.fr/$allo1/; $retour = $check_nom; }
  return($retour);
}
1;
