include"confcms2.php";
$db = mysql_connect("$dbchemin","$dbuser","$dbpass") or mysql_die("Connexion impossible");
$err = mysql_error();
if ($err) {
echo "Uh oh! There's an error! news Here it is: ";
echo "$err";
}
mysql_select_db("$dbname");
$err = mysql_error();
if ($err) {
echo "Uh oh! There's an error! basenews Here it is: ";
echo "$err";
}
$authors = mysql_query("SELECT id, Name FROM authors");
$cats = mysql_query("SELECT id, Name FROM categories");
$ans = mysql_query("SELECT id, Name FROM an");
$ans1 = mysql_query("SELECT id, Name FROM an");
$ans2 = mysql_query("SELECT id, Name FROM an");
$moi = mysql_query("SELECT id, Name FROM mois");
$mooi1 = mysql_query("SELECT id, Name FROM mois");
$mooi2 = mysql_query("SELECT id, Name FROM mois");
$mooi3 = mysql_query("SELECT id, Name FROM mois");
$mooi4 = mysql_query("SELECT id, Name FROM mois");
$mot = mysql_query("SELECT id, Name FROM motcle3");
if (isset($_GET['action']))
{
$action =$_GET['action'];
} else{
$action ="";
}
if (isset($_GET['FRecherche']))
{
$FRecherche =$_GET['FRecherche'];
} else{
$FRecherche ="";
}
if (isset($_GET['moid3']))
{
$moid3 =$_GET['moid3'];
} else{
$moid3 ="";
}
if (isset($_GET['anid1']))
{
$anid1 =$_GET['anid1'];
} else{
$anid1 ="";
}
if (isset($_GET['moid4']))
{
$moid4 =$_GET['moid4'];
} else{
$moid4 ="";
}
if (isset($_GET['anid2']))
{
$anid2 =$_GET['anid2'];
} else{
$anid2 ="";
}
if (isset($_GET['motid']))
{
$motid =$_GET['motid'];
} else{
$motid ="";
}
if (isset($_GET['page']))
{
$page =$_GET['page'];
} else{
$page ="";
}
if (isset($_GET['id']))
{
$id =$_GET['id'];
} else{
$id ="";
}
if (isset($_GET['cid']))
{
$cid =$_GET['cid'];
} else{
$cid ="";
}
if (isset($_GET['moid1']))
{
$moid1 =$_GET['moid1'];
} else{
$moid1 ="";
}
if (isset($_GET['moid2']))
{
$moid2 =$_GET['moid2'];
} else{
$moid2 ="";
}
$result="";
if($action != "recherche")
{
$action="recherche";
$arr=date("Y-m");
$year1=substr($arr,0,4);
$year2=substr($arr,2,4);
$month1=substr($arr,5,6);
$poi="voit22.php?id=";
$arr11=date("m");
//$arr11=$month1;
$arr12=$arr11-1;
$arr13=$arr11-2;
$arr14=$arr11-3;
$arr15=$arr11-4;
$arr20=$arr11+1;
//$year1=substr($arr,0,4);
$today = getdate();
$day = $today["mday"];
if ($day < 10) {
$day = "0$day";
}
$month = $today["mon"];
if ($month < 10) {
$month = "0$month";
}
$year = $today["year"];
$hour = $today["hours"];
$min = $today["minutes"];
$sec = "00";
$SQL = "SELECT id FROM an where trim(Name)='$year1'";
$result = mysql_query($SQL);
if ($result) {
$nb_news = mysql_num_rows($result);
}
//$nb_news = mysql_num_rows($result);
$row = mysql_fetch_array($result);
$idd = trim($row["id"]);
$anid = "$idd";
$moid = "$arr11";
//$moid = "$arr12";
}
if($action == "recherche")
{
$arr=date("Y-m");
$year1=substr($arr,0,4);
$arr11=date("m");
//$arr11=$month1;
$arr12=$arr11-1;
$arr13=$arr11-2;
$arr14=$arr11-3;
$arr15=$arr11-4;
$SQL = "SELECT id FROM an where trim(Name)='$year1'";
$result = mysql_query($SQL);
$nb_news = mysql_num_rows($result);
$row = mysql_fetch_array($result);
$idd = trim($row["id"]);
$Nb_msg_page = "10";
// Traitement de la chaine
$FRecherche = trim($FRecherche);
$affi_page = "$Nb_msg_page";
// Gestionnaire de pages
if ($page == "" or $page == "1")
{
$page = "1";
$debut = "0";
}
else
{
$debut = ($page - 1) * $affi_page;
}
// The basic SELECT statement
$select = "SELECT * ";
$from = " FROM artbrnew";
$where = " WHERE ID > 0";
if ($motid != "") { // Un Mot clef is selected
$where .= " AND motid=$motid";
}
/*
if ($anid != "") { // Une Année is selected
$where .= " AND anid=$anid";
}
*/
if ($moid3 < 10) {
$moid3 = "0$moid3";
}
if ($moid4 < 10) {
$moid4 = "0$moid4";
}
//echo "$moid3 $moid4";
if ($anid1 == "3") { // Une Année is selected
$ann="2001";}
if ($anid1 == "4") { // Une Année is selected
$ann="2002";}
if ($anid1 == "5") { // Une Année is selected
$ann="2003";}
if ($anid1 == "6") { // Une Année is selected
$ann="2004";}
if ($anid1 == "7") { // Une Année is selected
$ann="2005";}
if ($anid1 == "8") { // Une Année is selected
$ann="2006";}
if ($anid1 == "9") { // Une Année is selected
$ann="2007";}
if ($anid1 == "10") { // Une Année is selected
$ann="2008";}
if ($anid1 != "") { // Une Année is selected
$compose1= "$ann"."$moid3"."01"."000000";
$where .=" AND date > $compose1";
//$where .= " AND anid > $anid1";
}
if ($anid2 == "3") { // Une Année is selected
$ann2="2001";}
if ($anid2 == "4") { // Une Année is selected
$ann2="2002";}
if ($anid2 == "5") { // Une Année is selected
$ann2="2003";}
if ($anid2 == "6") { // Une Année is selected
$ann2="2004";}
if ($anid2 == "7") { // Une Année is selected
$ann2="2005";}
if ($anid2 == "8") { // Une Année is selected
$ann2="2006";}
if ($anid2 == "9") { // Une Année is selected
$ann2="2007";}
if ($anid2 == "10") { // Une Année is selected
$ann2="2008";}
if ($anid2 != "") { // Une Année is selected
$compose2= "$ann2"."$moid4"."31"."000000";
//echo "$compose2";
$where .=" AND date <= $compose2";
}
/*
if ($moid != "") { // Un Mois is selected
$where .= " AND moid=$moid";
}
if ($moid1 != "") { // Plusieurs Mois sont selected
$where .= " AND moid >= $moid1";
}
if ($moid2 != "") { // Plusieurs Mois sont selected
$where .= " AND moid<=$moid2";
}
*/
if ($cid != "") { // A category is selected
$from .= ", jokelookfich";
$where .= " AND ID=JID AND CID=$cid";
}
if ($FRecherche != "") { // Some search text was specified
$where .= " AND texte_long LIKE '%$FRecherche%' ";
}
$where .= " ORDER BY date DESC ";
$mysql_result = mysql_query($select . $from . $where);
// Nb total d'articles trouvés
if ($mysql_result) {
$nb_t = mysql_num_rows($mysql_result);
}
//$nb_t = mysql_num_rows($mysql_result);
//echo "nbre $nb_t cid $cid an $anid id $idd moi $arr11";
if ($cid ==""){
if ($nb_t < 8) {
$anid = "$idd";
$moid = "$arr12";
if ($arr11 == 1) {
$arr11 = 12;
$year1=$year1-1;
$anid = "$idd"-1;
$moid = "$arr11";
}
$requete="select max(ID) from artbrnew";
$result1 = mysql_query($requete);
if ($result1){
//echo "$result1";
$idmax=mysql_result($result1,0,"max(ID)");
//echo " Maxi $idmax";
$idnew="$idmax" -8;
}
$requete2="select * from artbrnew where ID > '$idnew' ORDER BY date DESC";
$jokes = mysql_query($requete2);
while ($joke = mysql_fetch_array($jokes)) {
echo(" \n");
$id = $joke["ID"];
$tite = $joke["tit"];
$titre = $joke["titre"];
$titre = ereg_replace("é","é",$titre);
$titre = ereg_replace("à","à",$titre);
$titre = ereg_replace("ê","ê",$titre);
$titre = ereg_replace("î","î",$titre);
$titre = ereg_replace("Ï","ï",$titre);
$titre = ereg_replace("è","è",$titre);
$titre = ereg_replace("ç","ç",$titre);
$titre = ereg_replace("û","û",$titre);
$titre = ereg_replace("ù","ù",$titre);
$titre = ereg_replace("ô","ô",$titre);
$titre = ereg_replace("â","â",$titre);
$joketext = $joke["petit"];
$joketext = ereg_replace("é","é",$joketext);
$joketext = ereg_replace("à","à",$joketext);
$joketext = ereg_replace("ê","ê",$joketext);
$joketext = ereg_replace("î","î",$joketext);
$joketext = ereg_replace("Ï","ï",$joketext);
$joketext = ereg_replace("è","è",$joketext);
$joketext = ereg_replace("ç","ç",$joketext);
$joketext = ereg_replace("û","û",$joketext);
$joketext = ereg_replace("ù","ù",$joketext);
$joketext = ereg_replace("ô","ô",$joketext);
$joketext = ereg_replace("â","â",$joketext);
$comm2 = $joke["comment"];
$ref2= $joke["reference"];
$text2= $joke["texte_court"];
//$joketext = $joke["texte_long"];
//$jokedt=$joke["date"];
$idte = $joke["ID"];
$dte = $joke["date"];
$year1=substr($dte,0,4);
$mois1=substr($dte,5,2);
$jour1=substr($dte,8,2);
$jokedt = "$jour1-$mois1-$year1";
//$year1=substr($dte,0,4);
if ($idte < 567) {
$tite1 = $joke["tit"];
$fichir= "http://www.medicms.be/dt3/";
$tit3=".htm";
}else {
$tite1 = $joke["tit"];
$fichir= "http://www.medicms.be/dt4/";
$tit3=".htm";}
if($idte<425){
$tite1 = $joke["tit"];
$fichir= "http://www.medicms.be/dt1/";
$tit3=".htm";
}
$fichir .=$tite ."2" .".htm";
// Bold and italics
$joketext = eregi_replace("\[b]","",$joketext);
$joketext = eregi_replace("\[eb]"," ",$joketext);
$joketext = eregi_replace("\[i]","",$joketext);
$joketext = eregi_replace("\[ei]"," ",$joketext);
/*
$joketext = ereg_replace("é","é",$joketext);
$joketext = ereg_replace("à","à",$joketext);
$titre = ereg_replace("é","é",$titre);
$titre = ereg_replace("à","à",$titre);
*/
// Paragraphs and line breaks
$joketext = ereg_replace("\r","",$joketext);
$joketext = ereg_replace("\n\n"," ",$joketext);
$joketext = ereg_replace("\n"," ",$joketext);
// Hyperlinks
$joketext = ereg_replace(
"\[L]([-_./a-zA-Z0-9!&%#?,'=:~]+)\[EL]",
"\\1 ", $joketext);
$joketext = ereg_replace(
"\[L=([-_./a-zA-Z0-9!&%#?,'=:~]+)]".
"([-_./a-zA-Z0-9 !&%#?,'=:~]+)\[EL]",
"\\2 ", $joketext);
echo(" ");
echo("$jokedt
$titre
$joketext
\n");
echo(" \n");
echo("\n");
echo(" \n");
echo("");
echo (" Article entier Zoom ");
echo ("Version pour Impression ");
}
/* echo "Erreur
";
echo "document.write(\"\"\n";
*/
}else{
// echo " Les Articles :
";
} }
$test = $page * $affi_page;
if ($test > $nb_t)
{
$page_c = $page - 1;
$affi_page = $nb_t - ($affi_page * $page_c);
}
$select = "SELECT * ";
$from = " FROM artbrnew";
$where = " WHERE ID > 0";
$Selecti = " WHERE ID > 0";
if ($motid != "") { // Un Mot clef is selected
$where .= " AND motid=$motid";
$Selecti .= "&motid=$motid";
}
/*
if ($anid != "") { // Une Année is selected
$where .= " AND anid=$anid";
$Selecti .= "&anid=$anid";
}
if ($moid1 != "") { // Plusieurs Mois sont selected
$where .= " AND moid >= $moid1";
$Selecti .= "&moid=$moid1";
}
if ($moid2 != "") { // Plusieurs Mois sont selected
$where .= " AND moid<=$moid2";
$Selecti .= "&moid=$moid2";
}
*/
if ($anid1 == "3") { // Une Année is selected
$ann="2001";}
if ($anid1 == "4") { // Une Année is selected
$ann="2002";}
if ($anid1 == "5") { // Une Année is selected
$ann="2003";}
if ($anid1 == "6") { // Une Année is selected
$ann="2004";}
if ($anid1 == "7") { // Une Année is selected
$ann="2005";}
if ($anid1 == "8") { // Une Année is selected
$ann="2006";}
if ($anid1 == "9") { // Une Année is selected
$ann="2007";}
if ($anid1 == "10") { // Une Année is selected
$ann="2008";}
if ($anid1 != "") { // Une Année is selected
$compose1= "$ann"."$moid3"."01"."000000";
$where .=" AND date > $compose1";
$Selecti .= "&anid1=$anid1";
}
if ($anid2 == "3") { // Une Année is selected
$ann2="2001";}
if ($anid2 == "4") { // Une Année is selected
$ann2="2002";}
if ($anid2 == "5") { // Une Année is selected
$ann2="2003";}
if ($anid2 == "6") { // Une Année is selected
$ann2="2004";}
if ($anid2 == "7") { // Une Année is selected
$ann2="2005";}
if ($anid2 == "8") { // Une Année is selected
$ann2="2006";}
if ($anid2 == "9") { // Une Année is selected
$ann2="2007";}
if ($anid2 == "10") { // Une Année is selected
$ann2="2008";}
if ($anid2 != "") { // Une Année is selected
$compose2= "$ann2"."$moid4"."31"."000000";
$where .=" AND date <= $compose2";
$Selecti .= "&anid2=$anid2";
}
$moid3i = "$moid3" *100;
$moid3= "$moid3i"/100;
$moid4i = "$moid4" *100;
$moid4= "$moid4i"/100;
if($cid ==""){
/*
if($moid3 > 0){
echo "Résultats pour la catégorie recherchée du $moid3/$ann au $moid4/$ann2
";
//echo "$ann $ann2 $moid3 $moid4 ann $compose1 ann2 $compose2";
}
*/
}
if ($moid3 != "") { // Plusieurs Mois sont selected
//$where .= " AND moid = $moid3";
$Selecti .= "&moid3=$moid3";
}
if ($moid4 != "") { // Plusieurs Mois sont selected
//$where .= " AND moid<=$moid4";
$Selecti .= "&moid4=$moid4";
}
/*
if ($moid != "") { // Un Mois is selected
$where .= " AND moid=$moid";
$Selecti .= "&moid=$moid";
}
*/
if ($cid != "") { // A category is selected
$from .= ", jokelookfich";
$where .= " AND JID=ID AND CID=$cid";
$Selecti .= "&cid=$cid";
}
if ($FRecherche != "") { // Some search text was specified
$where .=" AND texte_long LIKE '%$FRecherche%' ";
$Selecti .= "&FRecherche=$FRecherche";
}
$where .= " ORDER BY date DESC LIMIT $debut,$affi_page";
//if (!empty($jokes))
$jokes = mysql_query($select . $from . $where);
if (!$jokes) {
echo("Error retrieving jokes from database! ".
"Error: " . mysql_error());
exit();
}
while ($joke = mysql_fetch_array($jokes)) {
echo("
");
$id = $joke["ID"];
$tite = $joke["tit"];
$titre = $joke["titre"];
$titre = ereg_replace("é","é",$titre);
$titre = ereg_replace("à","à",$titre);
$titre = ereg_replace("ê","ê",$titre);
$titre = ereg_replace("î","î",$titre);
$titre = ereg_replace("Ï","ï",$titre);
$titre = ereg_replace("è","è",$titre);
$titre = ereg_replace("ç","ç",$titre);
$titre = ereg_replace("û","û",$titre);
$titre = ereg_replace("ù","ù",$titre);
$titre = ereg_replace("ô","ô",$titre);
$titre = ereg_replace("â","â",$titre);
$joketext = $joke["petit"];
$joketext = ereg_replace("é","é",$joketext);
$joketext = ereg_replace("à","à",$joketext);
$joketext = ereg_replace("ê","ê",$joketext);
$joketext = ereg_replace("î","î",$joketext);
$joketext = ereg_replace("Ï","ï",$joketext);
$joketext = ereg_replace("è","è",$joketext);
$joketext = ereg_replace("ç","ç",$joketext);
$joketext = ereg_replace("û","û",$joketext);
$joketext = ereg_replace("ù","ù",$joketext);
$joketext = ereg_replace("ô","ô",$joketext);
$joketext = ereg_replace("â","â",$joketext);
$comm2 = $joke["comment"];
$ref2= $joke["reference"];
$text2= $joke["texte_court"];
//$joketext = $joke["texte_long"];
//$jokedt=$joke["date"];
$idte = $joke["ID"];
$dte = $joke["date"];
$year1=substr($dte,0,4);
$mois1=substr($dte,5,2);
$jour1=substr($dte,8,2);
$jokedt = "$jour1-$mois1-$year1";
//$year1=substr($dte,0,4);
if ($idte < 567) {
$tite1 = $joke["tit"];
$fichir= "http://www.medicms.be/dt3/";
$tit3=".htm";
}else {
$tite1 = $joke["tit"];
$fichir= "http://www.medicms.be/dt4/";
$tit3=".htm";}
if($idte<425){
$tite1 = $joke["tit"];
$fichir= "http://www.medicms.be/dt1/";
$tit3=".htm";
}
$fichir .=$tite ."2" .".htm";
// Bold and italics
$joketext = eregi_replace("\[b]","",$joketext);
$joketext = eregi_replace("\[eb]"," ",$joketext);
$joketext = eregi_replace("\[i]","",$joketext);
$joketext = eregi_replace("\[ei]"," ",$joketext);
/*
$joketext = ereg_replace("é","é",$joketext);
$joketext = ereg_replace("à","à",$joketext);
$titre = ereg_replace("é","é",$titre);
$titre = ereg_replace("à","à",$titre);
*/
// Paragraphs and line breaks
$joketext = ereg_replace("\r","",$joketext);
$joketext = ereg_replace("\n\n"," ",$joketext);
$joketext = ereg_replace("\n"," ",$joketext);
// Hyperlinks
$joketext = ereg_replace(
"\[L]([-_./a-zA-Z0-9!&%#?,'=:~]+)\[EL]",
"\\1 ", $joketext);
$joketext = ereg_replace(
"\[L=([-_./a-zA-Z0-9!&%#?,'=:~]+)]".
"([-_./a-zA-Z0-9 !&%#?,'=:~]+)\[EL]",
"\\2 ", $joketext);
echo(" ");
echo("$jokedt
$titre
$joketext
\n");
echo(" \n");
echo("\n");
echo(" \n");
echo("");
echo (" Article entier Zoom ");
echo ("Version pour Impression ");
/*
echo (" ");
if ($tite == "" )
{
echo ("Version pour Impression ");
}
else
{
if ($id<306)
{ echo ("Version pour Impression ");
}else{
echo ("Version pour Impression ");
}
}
echo("Commentaires ( $comm2 ) ");
echo (" Voir ");
echo(" Ajouter un Commentaire ");
*/
echo(" \n");
echo(" \n");
}
if($page != 1)
{
$n_page = $page - 1;
echo(" page précédente ");
}
if($test < $nb_t)
{
$n_page = $page + 1;
echo( "
page suivante ");
}
}
?>
if($action == "recherche")
{
if($page != 1)
{
$n_page = $page - 1;
echo(" page précédente ");
}
if($test < $nb_t)
{
$n_page = $page + 1;
echo( " page suivante ");
} }
/*
if($nb_t<5){
echo(" ");
}
*/
echo" ";
$resultat = mysql_query("select * from feed");
$nombre2 = mysql_num_rows($resultat);
$succ = mysql_data_seek($resultat,$nombre2-1);
$idnew2 ="$nombre2" -18;
$requete2 = "SELECT * FROM feed LIMIT $idnew2 , 18";
//$requete2="select * from articles where ID >='$idnew2' ";
$jokes = mysql_query($requete2);
/*
$requete="select max(ID) from feed";
$result1 = mysql_query($requete);
if ($result1){
//echo "$result1";
$idmax=mysql_result($result1,0,"max(ID)");
//echo " Maxi $idmax";
$idnew="$idmax" -15;
}
echo("Les Brèves
");
$requete2="select * from feed where ID >='$idnew' ";
$jokes = mysql_query($requete2);
*/
//$jokes = mysql_query(select * from artbrnew where ID > "$idnew");
while ($joke = mysql_fetch_array($jokes)) {
$titre = $joke["titre"];
$titre = ereg_replace("é","é",$titre);
$titre = ereg_replace("à","à",$titre);
$titre = ereg_replace("ê","ê",$titre);
$titre = ereg_replace("î","î",$titre);
$titre = ereg_replace("Ï","ï",$titre);
$titre = ereg_replace("è","è",$titre);
$titre = ereg_replace("ç","ç",$titre);
$titre = ereg_replace("û","û",$titre);
$titre = ereg_replace("ù","ù",$titre);
$titre = ereg_replace("ô","ô",$titre);
$titre = ereg_replace("â","â",$titre);
$idfeed = $joke["ID"];
$dtt = $joke["date"];
$dte = $joke["date"];
$year1=substr($dte,0,4);
$mois1=substr($dte,5,2);
$jour1=substr($dte,8,2);
$jokedt = "$jour1-$mois1-$year1";
$dtit = $joke["tit"];
echo ("$jokedt - $titre Lire Imprimer Zoom
");
/*
if ($id < 203) {
echo ("$jokedt - $titre Lire Zoom
");
}else {
echo ("$jokedt - $titre Lire [Zoom ]
");
}
if($id<79){
echo ("$jokedt - $titre Lire [Zoom ]
");
}
*/
}
echo ('Plus de brèves ');
echo '
';
echo '
';
echo' ';
echo'