| |
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");
$ref=@$HTTP_REFERER;
$nb_t = 0;
if (isset($_GET['action']))
{
$actione =$_GET['action'];
} else{
$actione ="";
}
if (isset($_GET['FRecherche']))
{
$FRechercher =$_GET['FRecherche'];
} else{
$FRechercher ="";
}
if (isset($_GET['moid3']))
{
$moid33 =$_GET['moid3'];
} else{
$moid33 ="";
}
if (isset($_GET['anid1']))
{
$anid11 =$_GET['anid1'];
} else{
$anid11 ="";
}
if (isset($_GET['moid4']))
{
$moid44 =$_GET['moid4'];
} else{
$moid44 ="";
}
if (isset($_GET['anid2']))
{
$anid22 =$_GET['anid2'];
} else{
$anid22 ="";
}
if (isset($_GET['cid']))
{
$cide =$_GET['cid'];
} else{
$cide ="";
}
if (isset($_GET['motid']))
{
$motide =$_GET['motid'];
} else{
$motide ="";
}
if (isset($_GET['page']))
{
$ppage =$_GET['page'];
} else{
$ppage ="";
}
if (isset($_GET['Selecti']))
{
$Selecti =$_GET['Selecti'];
} else{
$Selecti ="";
}
if (isset($_GET['moid1']))
{
$moid1 =$_GET['moid1'];
} else{
$moid1 ="";
}
if (isset($_GET['moid2']))
{
$moid2 =$_GET['moid2'];
} else{
$moid2 ="";
}
if (isset($_GET['moid']))
{
$moid =$_GET['moid'];
} else{
$moid ="";
}
if (isset($_GET['anid']))
{
$anid =$_GET['anid'];
} else{
$anid ="";
}
$action= "$actione";
$FRecherche ="$FRechercher";
$moid3 ="$moid33";
$anid1="$anid11";
$moid4="$moid44";
$anid2="$anid22";
$motid="$motide";
$cid= "$cide";
$page ="$ppage";
$test=0;
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);
$nb_news = mysql_num_rows($result);
$row = mysql_fetch_array($result);
$id = trim($row["id"]);
$anid = "$id";
$moid = "$arr11";
}
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);
$id = trim($row["id"]);
$idmax=mysql_db_query("cmsnews","select max(ID) from feed");
//echo $idmax;
$Nb_msg_page = "15";
// 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 feed";
$where = " WHERE ID > 0";
if ($anid != "") { // Une Année is selected
$where .= " AND anid=$anid";
}
if ($moid3 < 10) {
$moid3 = "0$moid3";
}
if ($moid4 < 10) {
$moid4 = "0$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 == "11") { // Une Année is selected
$ann="2009";}
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 == "11") { // Une Année is selected
$ann2="2009";}
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 .= ", jokelookfeed";
$where .= " AND ID=JID AND CID=$cid";
}
if ($FRecherche != "") { // Some search text was specified
$where .= " AND texte_long LIKE '%$FRecherche%' ";
}
$mysql_result = mysql_query($select . $from . $where);
// Nb total d'articles trouvés
if ($mysql_result) {
$nb_t = mysql_num_rows($mysql_result);
}
//echo "$nb_t";
if ($nb_t < 1) {
$anid = "$id";
$moid = "$arr12";
if ($arr11 == 1) {
$arr11 = 12;
$year1=$year1-1;
$anid = $id-1;
$moid = "$arr11";
}
$resultat = mysql_query("select * from feed");
$nombre2 = mysql_num_rows($resultat);
$succ = mysql_data_seek($resultat,$nombre2-1);
$idnew2 ="$nombre2" -15;
$requete2 = "SELECT * FROM feed LIMIT $idnew2 , 15";
//$requete2="select * from articles where ID >='$idnew2' ";
$jokes = mysql_query($requete2);
while ($joke = mysql_fetch_array($jokes)) {
echo("\n");
$id = $joke["ID"];
$tite = $joke["tit"];
$lien = $joke["lien1"];
$titre = $joke["titre"];
//$joketext = $joke["petit"];
$comm2 = $joke["comment"];
$ref2= $joke["reference"];
$text2= $joke["texte_court"];
$joketext = $joke["texte_long"];
$jokedt=$joke["date"];
$idte = $joke["ID"];
$jokebig = $joke["image_big"];
$dte = $joke["date"];
$year1=substr($dte,0,4);
$mois1=substr($dte,5,2);
$jour1=substr($dte,8,2);
$jokedt = "$jour1-$mois1-$year1";
$fich="http://www.medicms.be/medi/dt/";
$fich .=$tite ."2" .".htm";
$fichh="http://www.medicms.be/medi/dt/";
$fichh .="print_" . $year1 . $idte .".htm";
$fichir="http://www.medicms.be/dt1/";
$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);
// 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(" | \n");
echo("$jokedt
$titre $joketext | \n");
echo(" \n");
echo("\n");
echo(" | \n");
echo(" ");
echo ("[Référence - Lien");
echo ("$jokebig ]");
echo("
");
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 ");
}
// }
//echo "document.write(\"\"\n";
}else{
echo " Les Feeds : ";
}
$test = $page * $affi_page;
if ($test > $nb_t)
{
$page_c = $page - 1;
$affi_page = $nb_t - ($affi_page * $page_c);
}
$select = "SELECT * ";
$from = " FROM feed";
$where = " WHERE ID > 0";
if ($anid != "") { // Une Année is selected
$where .= " AND anid=$anid";
$Selecti .= "&anid=$anid";
}
if ($moid != "") { // Un Mois is selected
$where .= " AND moid=$moid";
$Selecti .= "&moid=$moid";
}
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
//echo date("Y-m-d",mktime(0,0,0,$moid4,1,$ann2));
//echo time("U",mktime(0,0,0,$moid4,1,$ann2));
$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($moid3 > 0){
echo "Résultats pour la catégorie recherchée de $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 .= ", jokelookfeed";
$where .= " AND ID=JID 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";
$where .= " ORDER BY date DESC LIMIT $debut,$affi_page";
//echo( " $nb_t article(s) trouvé(s).");
//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(" \n");
$id = $joke["ID"];
$tite = $joke["tit"];
$lien = $joke["lien1"];
$titre = $joke["titre"];
//$joketext = $joke["petit"];
$comm2 = $joke["comment"];
$ref2= $joke["reference"];
$text2= $joke["texte_court"];
$joketext = $joke["texte_long"];
$jokedt=$joke["date"];
$idte = $joke["ID"];
$jokebig = $joke["image_big"];
$dte = $joke["date"];
$year1=substr($dte,0,4);
$mois1=substr($dte,5,2);
$jour1=substr($dte,8,2);
$jokedt = "$jour1-$mois1-$year1";
$fich="http://www.medicms.be/medi/dt/";
$fich .=$tite ."2" .".htm";
$fichh="http://www.medicms.be/medi/dt/";
$fichh .="print_" . $year1 . $idte .".htm";
$fichir="http://www.medicms.be/dt1/";
$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);
// 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(" | \n");
echo("$jokedt
$titre $joketext | \n");
echo(" \n");
echo("\n");
echo(" | \n");
echo(" ");
echo ("[Référence - Lien");
echo ("$jokebig ]");
echo("
");
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 ");
} }
echo"
| Les Infos du mois...
L'épidémie du siècle
Maigrir - Comment ? - Pourquoi ?
";
echo'
Grossesse
Contraception
Maladies Sexuelles
Fertilité
Sexologie Sénologie';
echo'
';
echo' |