12-03-2007, 04:03 PM
merci bien je fait que sa allez sur site du zero mais bon me aide pas grand chose
voicie la page complete de forum.php
voicie la page complete de forum.php
Code PHP :
<?php
require 'Templates/config.php';
require 'Templates/functions.php';
require 'Templates/header.php';
?>
<?php
if(($_GET['cat'])&& is_numeric($_GET['cat'])&& isset($_GET['f'])&& is_numeric($_GET['f']))
{
Sql();
$query_cat = mysql_query("SELECT * FROM `categories` WHERE id='".$_GET['cat']."'");
$data_cat = mysql_fetch_array($query_cat);
if(empty($data_cat['id'])|| empty($data_cat['nom']))
{ erreur('Cette categorie n\'existe pas !','');
die;
}
$query_forum = mysql_query("SELECT * FROM `forums` WHERE idcat='".$_GET['cat']."' && id='".$_GET['f']."'");
$data_forum = mysql_fetch_array($query_forum);
if(empty($data_forum['id'])|| empty($data_forum['nom']))
{ erreur('Ce forum n\'existe pas !','');
die;
}
SqlC();
}
elseif(!($_GET['cat'])|| !($_GET['f']))
{ erreur('Vous n\'avez pas l\'autorisation de voir cette page !','');
die;
}
arbo();
print('<table border="0" align="center" width="800" cellspacing="0">');
print(' <tr>');
print(' <td width="800" align="left">');
print(' <a href="?page=nouveau&cat='.$_GET['cat'].'&f='.$_GET['f'].'"><img class="image" alt="Nouveau" src="pics/nouveau.png" /></a>');
print(' </td>');
print(' </tr>');
print('</table>');
print('<table border="1" align="center" width="800" class="Forums" cellspacing="0" cellpadding="0">');
Sql();
//------
$q = mysql_query("SELECT COUNT(*) AS nb_sujets FROM `sujets` WHERE idcat='".$_GET['cat']."' && idforum='".$_GET['f']."'");
$d = mysql_fetch_array($q);
$nb_sujets = $d['nb_sujets'];
$nb_sujets_ppage = $INFO['forum_nbsujetsppages'];
$nb_pages = ceil($nb_sujets / $nb_sujets_ppage);
if (isset($_GET['page']))
$page = $_GET['page'];
else
$page = 1;
$sujet1 = ($page - 1) * $nb_sujets_ppage;
//------
$gris = 1;
//------
pagination($nb_pages,'?page=forum&cat='.$_GET['cat'].'&f='.$_GET['f'].'');
print(' <br/>');
//------
$query1 = mysql_query("SELECT * FROM `sujets` WHERE idcat='".$_GET['cat']."' && idforum='".$_GET['f']."' ORDER BY date2 DESC LIMIT ".$sujet1.",".$nb_sujets_ppage) or die(mysql_error());
while (($data1 = mysql_fetch_array($query1)) !== false)
{ if($gris > 2) { $gris = 1; }
//------
$id = stripslashes($data1['id']);
$idcat = stripslashes($data1['idcat']);
$idforum = stripslashes($data1['idforum']);
$status = stripslashes($data1['status']);
$titre = stripslashes($data1['titre']);
$description = stripslashes(emoticon($data1['description']));
$pseudo = stripslashes($data1['pseudo']);
$date = stripslashes($data1['date']);
//------
$query2 = mysql_query("SELECT COUNT(*) AS nb_reponses FROM `reponses` WHERE idcat='".$idcat."' && idforum='".$idforum."' && idsujet='".$id."'");
$data2 = mysql_fetch_array($query2);
$nb_reponses = stripslashes($data2['nb_reponses']);
//------
print('<tr>');
print(' <td class="gris'.$gris.'" width="400">');
if($status == '0')
{
print(' <img class="image" src="pics/fermer.gif" alt="-" /> <a href="?page=liresujet&cat='.$idcat.'&f='.$idforum.'&sujet='.$id.'">'.$titre.'</a> <br/>');
}
elseif($status == '1')
{
print(' <img class="image" src="pics/bouton.gif" alt="-" /> <a href="?page=liresujet&cat='.$idcat.'&f='.$idforum.'&sujet='.$id.'">'.$titre.'</a> <br/>');
}
print(' <span class="description">'.$description.'</span>');
print(' </td>');
print(' <td class="gris'.$gris.'" width="133" align="center">');
print(' Par <em>'.$pseudo.'</em>');
print(' </td>');
print(' <td class="gris'.$gris.'" width="133" align="center">');
print(' '.$nb_reponses.' reponses');
print(' </td>');
print(' <td class="gris'.$gris.'" width="134">');
print(' '.date('\l\e d/m/Y \à h\:i',$date).'');
print(' </td>');
print('</tr>');
//------
$gris++;
}
SqlC();
print('</table>');
//------
print(' <br/>');
pagination($nb_pages,'?page=forum&cat='.$_GET['cat'].'&f='.$_GET['f'].'');
//------
print('<table border="0" align="center" >');
print(' <tr>');
print(' <td align="left">');
print(' <a href="?page=nouveau&cat='.$_GET['cat'].'&f='.$_GET['f'].'"><img class="image" alt="Nouveau" src="pics/nouveau.png" /></a>');
print(' </td>');
print(' </tr>');
print('</table>');
arbo();
?>
<?php
require 'Templates/footer.php';
?>