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
<?php
// ---------------------------------------------------------------
// KwsPHP kOoGar Web System
// $Id: index.php 951 2012-12-05 16:10:22Z mike007 $
// ---------------------------------------------------------------
// Mise a jour : 28/07/06 par Ditch
// Mise a jour : 14/10/07 par mike007
// ---------------------------------------------------------------
-
if (!(defined('__KWS__'))) {die ('Erreur d\'appel de fichier.');}
-
-
// REQUETE QUI GERE LES FORUMS PRIVES OU PUBLICS
$cont = (count($_SESSION['forum_lu'])>1);
$cond = '(`forum_topic`.`dern_date` > '.$_SESSION['forum_lu']['all'].' and `forum_topic`.`id` '
.($cont ? 'NOT IN ('.str_replace(array('all,','all'),array('',"'all'"),implode(',',array_keys($_SESSION['forum_lu']))).')':'!=0').')';
-
if($cont)
{
$cond .= ' OR';
foreach($_SESSION['forum_lu'] as $a => $b)
{
if(intval($a)!=0)
{
$cond .= ' (`forum_topic`.`id`="'.$a.'" and `forum_topic`.`dern_date` > '.$b.') OR';
}
}
$cond = substr($cond ,0,-2);
}
-
$sql2 = 'SELECT COUNT(`forum_topic`.`id`) AS news,`ref` FROM `forum_topic` WHERE ('.$cond.') GROUP BY `ref` ORDER BY `ref`';
$nb_lu = reqmysql($sql2);
if(!$nb_lu)
{
reqmysql('DELETE FROM `forum_lecture` WHERE `ref`="'.$K_user->id.'"');
echo df_message('information',
'Une erreur s’est produite.','Vos sujets non lus ont été supprimés.');
}
$tab_lu = array();
-
if(mysql_num_rows($nb_lu)>0)
{
while($res=mysql_fetch_object($nb_lu))
{
$tab_lu[$res->ref] = $res->news;
if($tab_cat[$res->ref]['ref']!=0)
{
$tab_lu[$tab_cat[$res->ref]['ref']]+=$res->news;
}
}
}
-
// APPEL DES FICHIERS NECESSAIRES
if ($K_forum_legende == 'haut') include_once 'modules/'.$K_mod.'/legende.php';
-
$ref = intval($_REQUEST['ref']);
-
if (!empty($K_pseudo))
{
unset($_SESSION['visiteur_forum_ref_acces']);
}
-
if(!isset($_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir']))
{
## Vérification dans les groupes pour voir si la personne peut voir la catégorie. ##
if(empty($_SESSION[$CachePseudo.'_CatForum_0']))
{
include './modules/'.$K_mod.'/sessionCache.php';
}
-
$r_forum_cat = reqmysql('
SELECT `forum_cat`.`id`, `forum_cat`.`ref`
FROM `forum_cat`
WHERE `forum_cat`.`id` IN '.$_SESSION[$CachePseudo.'_CatForum_0'].'
AND '.(!empty($ref) ?
'`forum_cat`.`ref`="'.$ref.'" AND `forum_cat`.`attribut`!="2"'
:
'(`forum_cat`.`ref`="0" OR `forum_cat`.`attribut`=2)'
).'
ORDER BY `forum_cat`.`position`
');
$nb_topic_cat = mysql_num_rows($r_forum_cat);
-
if($nb_topic_cat>0)
{
while($result = mysql_fetch_object($r_forum_cat))
{
$_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir'] = 'oui';
$_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'] .= '`forum_cat`.`id`="'.$result->id.'" OR ';
}
$_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'] = substr($_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'],0,-3);
}
else
{
$_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir'] = 'non';
}
}
-
## La personne est autorisée à voir ce forum ##
if($_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['voir']=='oui')
{
$Name_SF = (!empty($ref) ? (!empty($title_add_plus) ? $title_add_plus:'Sous Forum'):'');
if (!empty($ref))
{
open_table();
echo '
<img src="./themes/'.$K_theme.'/images/forum/puce.png" alt="puce" style="'.$StylePuceFofo.'" />
<a href="'.url_rw('./index.php?mod='.$K_mod).'">Index du Forum</a>
» '.$Name_SF;
close_table();
}
-
// modifications by gothicae 290208
$calcul = '1';
-
// $nbrcellbyligne permet de choisir combien de cellule <td></td> vous souhaitez afficher par ligne
-
$nbrcellbyligne = '2';
-
if (is_callable(forum_cat_head2)) forum_cat_head2();
else forum_cat_head();
-
$sql='
SELECT `forum_cat`.`id`,
`forum_cat`.`titre`,
`forum_cat`.`ref`,
`forum_cat`.`description`,
`forum_cat`.`image`,
`forum_cat`.`attribut`,
`forum_cat`.`position`,
`forum_cat`.`nbtopic`,
`forum_cat`.`nbrep`,
`forum_cat`.`dern_rep`,
`forum_cat`.`dern_id`,
`forum_cat`.`dern_posteur`,
`forum_cat`.`dern_date`,
`forum_cat`.`id_groupe`,
`forum_cat`.`deroule`,
`users`.`grade` as gr_user
FROM `forum_cat`
LEFT JOIN `users`
ON `users`.`id` = `forum_cat`.`dern_id`
LEFT JOIN `forum_cniv`
ON `forum_cniv`.`id_cat`=`forum_cat`.`id`
WHERE ('.$_SESSION[$CachePseudo.'_forum_ref_acces'][$ref]['ids'].')
ORDER BY `forum_cat`.`position` ASC, `forum_cniv`.`sous_position` ASC
';
-
$r_liste_cat = reqmysql($sql);
$fait = FALSE;
-
if (mysql_num_rows($r_liste_cat)>0)
{
while ( $ligne_cat = mysql_fetch_object ($r_liste_cat))
{
$lu=1;
//LA CATEGORIE EST UN FORUM ou SOUS FORUM
if($ligne_cat->attribut!=0)
{
$CatImg = '';
if (!empty($ligne_cat->image) and file_exists('./images/'.$K_mod.'/categories/'.$ligne_cat->image))
{
list($CatImgW, $CatImgH) = @getimagesize('./images/'.$K_mod.'/categories/'.$ligne_cat->image);
$CatImgRatio = $CatImgW/$CatImgH;
$CatImgH = round(ax(($CatImgH < 40) ? $CatImgH : 40));
$CatImgW = round($CatImgH*$CatImgRatio);
$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>';
}
$fait = TRUE;
-
/****S'IL EXISTE DES REPONSES, ON MEMORISE LES INFOS DU DERNIER POST****/
if($ligne_cat->attribut>1)
{
$_SESSION['section'.$ligne_cat->position] = $ligne_cat->titre;
$req = reqmysql('
SELECT `forum_cat`.`id`,
`forum_cat`.`ref`,
`forum_cat`.`titre`,
`forum_cat`.`description`,
`forum_cat`.`attribut`,
`forum_cat`.`nbtopic`,
`forum_cat`.`nbrep`
FROM `forum_cat`
LEFT JOIN `forum_cniv`
ON `forum_cniv`.`id_cat`=`forum_cat`.`id`
WHERE `forum_cat`.`id` IN '.$_SESSION[$CachePseudo.'_CatForum_0'].'
AND `forum_cat`.`ref`="'.$ligne_cat->ref.'"
AND `forum_cat`.`position`="'.$ligne_cat->position.'"
GROUP BY `forum_cat`.`id`
ORDER BY `forum_cat`.`position` ASC, `forum_cniv`.`sous_position` ASC
');
$nb_Sfo = mysql_num_rows($req);
if ($nb_Sfo > 1)
{
if (is_array($DisplayCookie) and array_key_exists('SsFo'.$ligne_cat->ref,$DisplayCookie))
$Display = $DisplayCookie['SsFo'.$ligne_cat->ref];
else
$Display = ($ligne_cat->deroule == 'on' ? 'block':'none');
-
$Sous_forum ='<ul class="CSF_deroule" style="font-size:smaller;display:'.$Display.'" id="SsFo'.$ligne_cat->ref.'">';
while($j = mysql_fetch_object($req))
{
if($j->attribut==1)
{
$ligne_cat->nbtopic += $j->nbtopic;
$ligne_cat->nbrep += $j->nbrep;
$lu1 = (!isset($tab_lu[$j->id]));
if(!$lu1)
$lu = $lu1;
$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').'';
$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.'&ac=rubrique&cat='.$j->id,array($ligne_cat->titre,$j->titre)).'" title="'.ax($j->description).'" >'.ax($j->titre).'</a></li>';
}
elseif($j->attribut==0)
{
$Sous_forum .= '<li style="list-style:none;"><hr /></li>';
}
}
$Sous_forum .= '</ul>';
$date ='Sous-forum, cliquez pour<br />
<span style="cursor: pointer;font-style:italic"
onmouseover="javascript:window.status=\'\';return(true)"
onclick="javascript:cachecache(\'SsFo'.$ligne_cat->ref.'\',\'\',\'Voir ses catégories\',\'Masquer ses catégories\');
EcrireDisplay(\'DisplayDiv\',\'SsFo'.$ligne_cat->ref.'\',document.getElementById(\'SsFo'.$ligne_cat->ref.'\').style.display);"
id="SsFo'.$ligne_cat->ref.'_lien">
'.($Display == 'block' ? 'Masquer':'Voir').' ses catégories
</span>';
}
else
{
$date = '<i>Sous-forum, aucune catégorie.</i>';
$Sous_forum = '';
}
}
elseif($ligne_cat->nbtopic>0)
{
/* récupération du titre du dernier topic modifié*/
$req = reqmysql('SELECT `titre`, `dern_rep`, `nbrep`, `resolu`, `sondage`, `attribut` FROM `forum_topic` WHERE `dern_date`="'.$ligne_cat->dern_date.'" ');
while($j = mysql_fetch_array($req))
{
$titre_dern_sujet = $j[titre];
$nombre_reponses = $j[nbrep];
$dern_reponse = $j[dern_rep];
$pre_topic = '';
if ($j[resolu] == 1)
$pre_topic = '<span style="color:'.$topic_R.'">[R]</span> '.$pre_topic;
if (!empty($j[sondage]))
$pre_topic = '<span style="color:'.$topic_S.'">[S]</span> '.$pre_topic;
-
switch($j[attribut])
{
case '1' : $pre_topic = '<span style="color:'.$topic_AV.'">[AV]</span> '.$pre_topic;
break;
case '2' : $pre_topic = '<span style="color:'.$topic_A.'">[A]</span> '.$pre_topic;
break;
case '3' : $pre_topic = '<span style="color:'.$topic_V.'">[V]</span> '.$pre_topic;
break;
default : $pre_topic = $pre_topic;
}
}
-
// on ne prend que les 20 premiers caractères du sujet pour ne pas killer la mise en page
$dern_sujet = ax(substr($titre_dern_sujet,0,20));
-
// on ajoute les propriétés du topic
$dern_sujet = $pre_topic.$dern_sujet;
-
$dte = $ligne_cat->dern_date ;
$rep = $ligne_cat->dern_rep ;
-
$lu = (!isset($tab_lu[$ligne_cat->id]));
-
if(strlen($titre_dern_sujet)> 20) {$dern_sujet .= '...'; }
-
$lien_dern_post = (ceil($nombre_reponses/$forum_nbrep)-1)*$forum_nbrep;
if($lien_dern_post<0){$lien_dern_post=0;}
-
// modifications by gothicae 290208
-
$date = kws_date("d/m/Y\, H:i",$dte,1);
-
$dans = '<a href="'.url_rw('./index.php?mod='.$K_mod.'&ac=voir&id='.$rep.($lien_dern_post>0?'&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>';
-
$par = get_grd_symbol($ligne_cat->gr_user).'<a href="'.url_rw('./index.php?mod=espace_membre&ac=profil&id='.$ligne_cat->dern_id,array(ax($ligne_cat->dern_posteur))).'"><strong>'.$ligne_cat->dern_posteur.'</strong></a>';
}
else //SINON ON ECRIT QU'IL N'Y A PAS DE MESSAGE
$date = '<i>Aucun message.</i>';
-
// Gestion de l'image de catégorie
$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').'';
-
if($ligne_cat->attribut > 1)
{
$lien_phorum ='index.php?mod='.$K_mod.'&ref='.$ligne_cat->ref;
}
else
{
$lien_phorum ='./index.php?mod='.$K_mod.'&ac=rubrique&cat='.intval($ligne_cat->id);
}
-
//ON AFFICHE LE FORUM AVEC LES INFOS MEMORISEES
if (is_callable(forum_cat_mid2))
{
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);
-
//Calcul du nombre de td à afficher sur la largeur
$division = $calcul/$nbrcellbyligne;
if ( is_int($division) )
{
echo '</tr>
<tr>';
}
$calcul = $calcul+1;
}
else
{
if (!preg_match('#aucun message#i',$date) and !preg_match('#sous-forum,#i',$date))
{
$date = $par.'<br />'.kws_date("d/m/Y\, H:i",$dte,1).'<br />'.$dans.'<br />';
}
//ON AFFICHE LE FORUM AVEC LES INFOS MEMORISEES
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));
}
}
//LA CATEGORIE EST UN SEPARATEUR DE FORUM
else
{
if (is_callable(forum_cat_sep2)) forum_cat_sep2(ax($ligne_cat->titre));
else forum_cat_sep(ax($ligne_cat->titre));
}
}
}
forum_cat_close();
}
if ($K_forum_legende == 'bas') include_once 'modules/'.$K_mod.'/legende.php';
-
?>
-
Réponse ci-dessus postée le vendredi 31 octobre 2014 : 06:13
quelqu'un peut il m'aider svp merci d'avance