Re: Erreur forum

non pas résolue:#

Réponse ci-dessus postée le jeudi 30 octobre 2014 : 19:29



quand je me deconnecte et reconnecte l'erreur revient


Réponse ci-dessus postée le jeudi 30 octobre 2014 : 19:54



en plus de l'erreur de requette

Il y a une erreur de requête dans le fichier forum/index.php à la ligne 32.
Cette erreur est intervenue le 30/10/2014 à 20:59 lors du passage d'un visiteur à partir de ce lien en venant de cette page.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and `forum_topic`.`id` !=0)) GROUP BY `ref` ORDER BY `ref`' at line 1
SELECT COUNT(`forum_topic`.`id`) AS news,`ref` FROM `forum_topic` WHERE ((`forum_topic`.`dern_date` > and `forum_topic`.`id` !=0)) GROUP BY `ref` ORDER BY `ref`


j'ai même cette erreur qui suit

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/insoliterb/www/modules/forum/index.php on line 41

ses erreur je les ai quand je met le forum sur la page acueil


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php
  2. // ---------------------------------------------------------------
  3. // KwsPHP kOoGar Web System
  4. // $Id: index.php 951 2012-12-05 16:10:22Z mike007 $
  5. // ---------------------------------------------------------------
  6. // Mise a jour : 28/07/06 par Ditch
  7. // Mise a jour : 14/10/07 par mike007
  8. // ---------------------------------------------------------------
  9.  
  10. if (!(defined('__KWS__'))) {die ('Erreur d\'appel de fichier.');}
  11.  
  12.  
  13. // REQUETE QUI GERE LES FORUMS PRIVES OU PUBLICS
  14. $cont = (count($_SESSION['forum_lu'])>1);
  15. $cond = '(`forum_topic`.`dern_date` > '.$_SESSION['forum_lu']['all'].' and `forum_topic`.`id` '
  16.         .($cont ? 'NOT IN ('.str_replace(array('all,','all'),array('',"'all'"),implode(',',array_keys($_SESSION['forum_lu']))).')':'!=0').')';
  17.  
  18. if($cont)
  19. {
  20.     $cond .= ' OR';
  21.     foreach($_SESSION['forum_lu'] as $a => $b)
  22.     {
  23.         if(intval($a)!=0)
  24.         {
  25.             $cond .= ' (`forum_topic`.`id`="'.$a.'" and `forum_topic`.`dern_date` > '.$b.') OR';
  26.         }
  27.     }
  28.     $cond = substr($cond ,0,-2);
  29. }
  30.  
  31. $sql2   = 'SELECT COUNT(`forum_topic`.`id`) AS news,`ref` FROM `forum_topic` WHERE ('.$cond.') GROUP BY `ref` ORDER BY `ref`';
  32. $nb_lu  = reqmysql($sql2);
  33. if(!$nb_lu)
  34. {
  35.     reqmysql('DELETE FROM `forum_lecture` WHERE `ref`="'.$K_user->id.'"');
  36.     echo df_message('information',
  37.     'Une erreur s&rsquo;est produite.','Vos sujets non lus ont &eacute;t&eacute; supprim&eacute;s.');
  38. }
  39. $tab_lu = array();
  40.  
  41. if(mysql_num_rows($nb_lu)>0)
  42. {
  43.     while($res=mysql_fetch_object($nb_lu))
  44.     {
  45.         $tab_lu[$res->ref] = $res->news;
  46.         if($tab_cat[$res->ref]['ref']!=0)
  47.         {
  48.             $tab_lu[$tab_cat[$res->ref]['ref']]+=$res->news;
  49.         }
  50.     }
  51. }
  52.  
  53. // APPEL DES FICHIERS NECESSAIRES
  54. if ($K_forum_legende == 'haut')    include_once 'modules/'.$K_mod.'/legende.php';
  55.  
  56. $ref = intval($_REQUEST['ref']);
  57.  
  58. if (!empty($K_pseudo))
  59. {
  60.     unset($_SESSION['visiteur_forum_ref_acces']);
  61. }
  62.  
  63. if(!isset($_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir']))
  64. {
  65.     ##  Vérification dans les groupes pour voir si la personne peut voir la catégorie.  ##
  66.     if(empty($_SESSION[$CachePseudo.'_CatForum_0']))
  67.     {
  68.         include './modules/'.$K_mod.'/sessionCache.php';
  69.     }
  70.  
  71.     $r_forum_cat = reqmysql('
  72.         SELECT        `forum_cat`.`id`, `forum_cat`.`ref`
  73.         FROM `forum_cat`
  74.         WHERE        `forum_cat`.`id` IN '.$_SESSION[$CachePseudo.'_CatForum_0'].'
  75.         AND            '.(!empty($ref) ?
  76.                     '`forum_cat`.`ref`="'.$ref.'" AND `forum_cat`.`attribut`!="2"'
  77.                     :
  78.                     '(`forum_cat`.`ref`="0" OR `forum_cat`.`attribut`=2)'
  79.                     ).'
  80.         ORDER BY    `forum_cat`.`position`
  81.     ');
  82.     $nb_topic_cat = mysql_num_rows($r_forum_cat);
  83.  
  84.     if($nb_topic_cat>0)
  85.     {
  86.         while($result = mysql_fetch_object($r_forum_cat))
  87.         {
  88.             $_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir']    = 'oui';
  89.             $_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids']    .= '`forum_cat`.`id`="'.$result->id.'" OR ';
  90.         }
  91.         $_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'] = substr($_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'],0,-3);
  92.     }
  93.     else
  94.     {
  95.         $_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir']    = 'non';
  96.     }
  97. }
  98.  
  99. ##  La personne est autorisée à voir ce forum  ##
  100. if($_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir']=='oui')
  101. {
  102.     $Name_SF = (!empty($ref) ? (!empty($title_add_plus) ? $title_add_plus:'Sous Forum'):'');
  103.     if (!empty($ref))
  104.     {
  105.         open_table();
  106.         echo '
  107.         <img src="./themes/'.$K_theme.'/images/forum/puce.png" alt="puce" style="'.$StylePuceFofo.'" />
  108.         <a href="'.url_rw('./index.php?mod='.$K_mod).'">Index du Forum</a>
  109.         &raquo; '.$Name_SF;
  110.         close_table();
  111.     }
  112.  
  113.     // modifications by gothicae 290208
  114.     $calcul = '1';
  115.  
  116.     // $nbrcellbyligne permet de choisir combien de cellule <td></td> vous souhaitez afficher par ligne
  117.  
  118.     $nbrcellbyligne = '2';
  119.  
  120.     if (is_callable(forum_cat_head2))    forum_cat_head2();
  121.     else                                forum_cat_head();
  122.  
  123.     $sql='
  124.         SELECT            `forum_cat`.`id`,
  125.                         `forum_cat`.`titre`,
  126.                         `forum_cat`.`ref`,
  127.                         `forum_cat`.`description`,
  128.                         `forum_cat`.`image`,
  129.                         `forum_cat`.`attribut`,
  130.                         `forum_cat`.`position`,
  131.                         `forum_cat`.`nbtopic`,
  132.                         `forum_cat`.`nbrep`,
  133.                         `forum_cat`.`dern_rep`,
  134.                         `forum_cat`.`dern_id`,
  135.                         `forum_cat`.`dern_posteur`,
  136.                         `forum_cat`.`dern_date`,
  137.                         `forum_cat`.`id_groupe`,
  138.                         `forum_cat`.`deroule`,
  139.                         `users`.`grade` as gr_user
  140.         FROM `forum_cat`
  141.         LEFT JOIN `users`
  142.             ON            `users`.`id` = `forum_cat`.`dern_id`
  143.         LEFT JOIN `forum_cniv`
  144.             ON            `forum_cniv`.`id_cat`=`forum_cat`.`id`
  145.         WHERE            ('.$_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'].')
  146.         ORDER BY        `forum_cat`.`position` ASC, `forum_cniv`.`sous_position` ASC
  147.     ';
  148.  
  149.     $r_liste_cat = reqmysql($sql);
  150.     $fait        = FALSE;
  151.  
  152.     if (mysql_num_rows($r_liste_cat)>0)
  153.     {
  154.         while ( $ligne_cat = mysql_fetch_object ($r_liste_cat))
  155.         {
  156.             $lu=1;
  157.             //LA CATEGORIE EST UN FORUM ou SOUS FORUM
  158.             if($ligne_cat->attribut!=0)
  159.             {
  160.                 $CatImg = '';
  161.                 if (!empty($ligne_cat->image) and file_exists('./images/'.$K_mod.'/categories/'.$ligne_cat->image))
  162.                 {
  163.                     list($CatImgW, $CatImgH) = @getimagesize('./images/'.$K_mod.'/categories/'.$ligne_cat->image);
  164.                     $CatImgRatio = $CatImgW/$CatImgH;
  165.                     $CatImgH = round(ax(($CatImgH < 40) ? $CatImgH : 40));
  166.                     $CatImgW = round($CatImgH*$CatImgRatio);
  167.                     $CatImg = '<div class="ForumImgCat" style="float:right;margin:auto 5px"><img style="width:'.$CatImgW.'px;height:'.$CatImgH.'px" src="./images/'.$K_mod.'/categories/'.ax($ligne_cat->image).'" alt="img cat'.$ligne_cat->id.'" /></div>';
  168.                 }
  169.                 $fait = TRUE;
  170.  
  171.                 /****S'IL EXISTE DES REPONSES, ON MEMORISE LES INFOS DU DERNIER POST****/
  172.                 if($ligne_cat->attribut>1)
  173.                 {
  174.                     $_SESSION['section'.$ligne_cat->position] = $ligne_cat->titre;
  175.                     $req = reqmysql('
  176.                         SELECT        `forum_cat`.`id`,
  177.                                     `forum_cat`.`ref`,
  178.                                     `forum_cat`.`titre`,
  179.                                     `forum_cat`.`description`,
  180.                                     `forum_cat`.`attribut`,
  181.                                     `forum_cat`.`nbtopic`,
  182.                                     `forum_cat`.`nbrep`
  183.                         FROM `forum_cat`
  184.                         LEFT JOIN `forum_cniv`
  185.                             ON        `forum_cniv`.`id_cat`=`forum_cat`.`id`
  186.                         WHERE        `forum_cat`.`id` IN '.$_SESSION[$CachePseudo.'_CatForum_0'].'
  187.                             AND        `forum_cat`.`ref`="'.$ligne_cat->ref.'"
  188.                             AND        `forum_cat`.`position`="'.$ligne_cat->position.'"
  189.                         GROUP BY    `forum_cat`.`id`
  190.                         ORDER BY    `forum_cat`.`position` ASC, `forum_cniv`.`sous_position` ASC
  191.                     ');
  192.                     $nb_Sfo = mysql_num_rows($req);
  193.                     if ($nb_Sfo > 1)
  194.                     {
  195.                         if (is_array($DisplayCookie) and array_key_exists('SsFo'.$ligne_cat->ref,$DisplayCookie))
  196.                             $Display = $DisplayCookie['SsFo'.$ligne_cat->ref];
  197.                         else
  198.                             $Display = ($ligne_cat->deroule == 'on' ? 'block':'none');
  199.  
  200.                         $Sous_forum ='<ul class="CSF_deroule" style="font-size:smaller;display:'.$Display.'" id="SsFo'.$ligne_cat->ref.'">';
  201.                         while($j = mysql_fetch_object($req))
  202.                         {
  203.                             if($j->attribut==1)
  204.                             {
  205.                                 $ligne_cat->nbtopic += $j->nbtopic;
  206.                                 $ligne_cat->nbrep += $j->nbrep;
  207.                                 $lu1 = (!isset($tab_lu[$j->id]));
  208.                                 if(!$lu1)
  209.                                     $lu = $lu1;
  210.                                 $img_cat = (file_exists('themes/'.$K_theme.'/images/'.$K_mod.'/'.(!$lu1?'lu_':'').'cat.png')?'themes/'.$K_theme.'/images/'.$K_mod.'/':'modules/'.$K_mod.'/images/').(!$lu1?'lu_':'').'cat.png" alt="Catégorie'.(!$lu?' non lue':' lue').'';
  211.                                 $Sous_forum .= '<li style="list-style:none;margin-left:-30px"><img src="'.$img_cat.'" style="height:9px;margin:0 5px" /><a href="'.url_rw('./index.php?mod='.$K_mod.'&amp;ac=rubrique&amp;cat='.$j->id,array($ligne_cat->titre,$j->titre)).'" title="'.ax($j->description).'" >'.ax($j->titre).'</a></li>';
  212.                             }
  213.                             elseif($j->attribut==0)
  214.                             {
  215.                                 $Sous_forum .= '<li style="list-style:none;"><hr /></li>';
  216.                             }
  217.                         }
  218.                         $Sous_forum .= '</ul>';
  219.                         $date ='Sous-forum, cliquez pour<br />
  220.                             <span style="cursor: pointer;font-style:italic"
  221.                                 onmouseover="javascript:window.status=\'\';return(true)"
  222.                                 onclick="javascript:cachecache(\'SsFo'.$ligne_cat->ref.'\',\'\',\'Voir ses cat&eacute;gories\',\'Masquer ses cat&eacute;gories\');
  223.                                          EcrireDisplay(\'DisplayDiv\',\'SsFo'.$ligne_cat->ref.'\',document.getElementById(\'SsFo'.$ligne_cat->ref.'\').style.display);"
  224.                                 id="SsFo'.$ligne_cat->ref.'_lien">
  225.                                     '.($Display == 'block' ? 'Masquer':'Voir').' ses cat&eacute;gories
  226.                             </span>';
  227.                     }
  228.                     else
  229.                     {
  230.                         $date = '<i>Sous-forum, aucune cat&eacute;gorie.</i>';
  231.                         $Sous_forum = '';
  232.                     }
  233.                 }
  234.                 elseif($ligne_cat->nbtopic>0)
  235.                 {
  236.                     /* récupération du titre du dernier topic modifié*/
  237.                     $req = reqmysql('SELECT `titre`, `dern_rep`, `nbrep`, `resolu`, `sondage`, `attribut` FROM `forum_topic` WHERE `dern_date`="'.$ligne_cat->dern_date.'" ');
  238.                     while($j = mysql_fetch_array($req))
  239.                     {
  240.                         $titre_dern_sujet    = $j[titre];
  241.                         $nombre_reponses    = $j[nbrep];
  242.                         $dern_reponse        = $j[dern_rep];
  243.                         $pre_topic            = '';
  244.                         if ($j[resolu] == 1)
  245.                             $pre_topic = '<span style="color:'.$topic_R.'">[R]</span> '.$pre_topic;
  246.                         if (!empty($j[sondage]))
  247.                             $pre_topic = '<span style="color:'.$topic_S.'">[S]</span> '.$pre_topic;
  248.  
  249.                         switch($j[attribut])
  250.                         {
  251.                             case '1' : $pre_topic = '<span style="color:'.$topic_AV.'">[AV]</span> '.$pre_topic;
  252.                             break;
  253.                             case '2' : $pre_topic = '<span style="color:'.$topic_A.'">[A]</span> '.$pre_topic;
  254.                             break;
  255.                             case '3' : $pre_topic = '<span style="color:'.$topic_V.'">[V]</span> '.$pre_topic;
  256.                             break;
  257.                             default  : $pre_topic = $pre_topic;
  258.                         }
  259.                     }
  260.  
  261.                     // on ne prend que les 20 premiers caractères du sujet pour ne pas killer la mise en page
  262.                     $dern_sujet = ax(substr($titre_dern_sujet,0,20));
  263.  
  264.                     // on ajoute les propriétés du topic
  265.                     $dern_sujet = $pre_topic.$dern_sujet;
  266.  
  267.                     $dte        = $ligne_cat->dern_date ;
  268.                     $rep        = $ligne_cat->dern_rep ;
  269.  
  270.                     $lu = (!isset($tab_lu[$ligne_cat->id]));
  271.  
  272.                     if(strlen($titre_dern_sujet)> 20) {$dern_sujet .= '...'; }
  273.  
  274.                     $lien_dern_post = (ceil($nombre_reponses/$forum_nbrep)-1)*$forum_nbrep;
  275.                     if($lien_dern_post<0){$lien_dern_post=0;}
  276.  
  277.                     // modifications by gothicae 290208
  278.  
  279.                     $date = kws_date("d/m/Y\, H:i",$dte,1);
  280.  
  281.                     $dans = '<a href="'.url_rw('./index.php?mod='.$K_mod.'&amp;ac=voir&amp;id='.$rep.($lien_dern_post>0?'&amp;debut='.$lien_dern_post:'').($dern_reponse>0 ? '#r'.$dern_reponse:''),array($ligne_cat->titre,$titre_dern_sujet)).'" title="'.ax($titre_dern_sujet).'">'.$dern_sujet.'</a>';
  282.  
  283.                     $par = get_grd_symbol($ligne_cat->gr_user).'<a href="'.url_rw('./index.php?mod=espace_membre&amp;ac=profil&amp;id='.$ligne_cat->dern_id,array(ax($ligne_cat->dern_posteur))).'"><strong>'.$ligne_cat->dern_posteur.'</strong></a>';
  284.                 }
  285.                 else    //SINON ON ECRIT QU'IL N'Y A PAS DE MESSAGE
  286.                     $date = '<i>Aucun message.</i>';
  287.  
  288.                 // Gestion de l'image de catégorie
  289.                 $img_cat = (file_exists('themes/'.$K_theme.'/images/'.$K_mod.'/'.(!$lu?'lu_':'').'cat.png')?'themes/'.$K_theme.'/images/'.$K_mod.'/':'modules/'.$K_mod.'/images/').(!$lu?'lu_':'').'cat.png" alt="Catégorie'.(!$lu?' non lue':' lue').'';
  290.  
  291.                 if($ligne_cat->attribut > 1)
  292.                 {
  293.                     $lien_phorum ='index.php?mod='.$K_mod.'&amp;ref='.$ligne_cat->ref;
  294.                 }
  295.                 else
  296.                 {
  297.                     $lien_phorum ='./index.php?mod='.$K_mod.'&amp;ac=rubrique&amp;cat='.intval($ligne_cat->id);
  298.                 }
  299.  
  300.                 //ON AFFICHE LE FORUM AVEC LES INFOS MEMORISEES
  301.                 if (is_callable(forum_cat_mid2))
  302.                 {
  303.                     forum_cat_mid2($img_cat,$CatImg.'<a href="'.url_rw($lien_phorum,array($Name_SF,$ligne_cat->titre)).'">'.ax($ligne_cat->titre).'</a>', bbcode($ligne_cat->description,1,1).($ligne_cat->attribut=='2'? $Sous_forum:''), intval($ligne_cat->nbtopic), intval($ligne_cat->nbrep), $date, intval($ligne_cat->id), $dans, $par);
  304.  
  305.                     //Calcul du nombre de td à  afficher sur la largeur
  306.                     $division = $calcul/$nbrcellbyligne;
  307.                     if ( is_int($division) )
  308.                     {
  309.                         echo '</tr>
  310.                         <tr>';
  311.                     }
  312.                     $calcul = $calcul+1;
  313.                 }
  314.                 else
  315.                 {
  316.                     if (!preg_match('#aucun message#i',$date) and !preg_match('#sous-forum,#i',$date))
  317.                     {
  318.                         $date = $par.'<br />'.kws_date("d/m/Y\, H:i",$dte,1).'<br />'.$dans.'<br />';
  319.                     }
  320.                     //ON AFFICHE LE FORUM AVEC LES INFOS MEMORISEES
  321.                     forum_cat_mid($img_cat,$CatImg.'<a href="'.url_rw($lien_phorum,array($Name_SF,$ligne_cat->titre)).'">'.ax($ligne_cat->titre).'</a>', bbcode($ligne_cat->description,1,1).($ligne_cat->attribut=='2'? $Sous_forum:''), intval($ligne_cat->nbtopic), intval($ligne_cat->nbrep), $date, intval($ligne_cat->id));
  322.                 }
  323.             }
  324.             //LA CATEGORIE EST UN SEPARATEUR DE FORUM
  325.             else
  326.             {
  327.                 if (is_callable(forum_cat_sep2))    forum_cat_sep2(ax($ligne_cat->titre));
  328.                 else                                forum_cat_sep(ax($ligne_cat->titre));
  329.             }
  330.         }
  331.     }
  332.     forum_cat_close();
  333. }
  334. if ($K_forum_legende == 'bas')    include_once 'modules/'.$K_mod.'/legende.php';
  335.  
  336. ?>
  337.  


Réponse ci-dessus postée le vendredi 31 octobre 2014 : 06:13



quelqu'un peut il m'aider svp merci d'avance


Sujet écrit par CMS le vendredi 31 octobre 2014 à 12:33

[ Imprimer ] - [ Fermer la fenêtre ]