FestivAlgo/forum.php

122 lines
5.0 KiB
PHP

<?php
//Cette page permet dafficher la liste des categories
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script src="jquery.js"></script>
<script src="menus.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="Images/favicon_ie.ico">
<title>Festiv'Algo - forum</title>
<meta name="keywords" content="festivalgo, algobox, forum, aide, algorithme, algorithmique, problème, problème algorithme, programmation, Casio, TI, HP, apprendre, bac, mathématiques, ROC, nouveaux programmes, réformes" />
<meta name="description" content="Posez toutes vos questions sur des algorithmes sur ce forum. Résolvez vos problèmes d'algorithmique. Inscription rapide et gratuite." />
</head>
<body>
<div id="content">
<?php include("menu.php"); ?>
<div class="content">
<?php
if(isset($_SESSION['username']))
{
$nb_new_pm = mysql_fetch_array(mysql_query('select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['userid'].'" and user1read="no") or (user2="'.$_SESSION['userid'].'" and user2read="no")) and id2="1"'));
$nb_new_pm = $nb_new_pm['nb_new_pm'];
?>
<div class="box">
<div class="box_right">
<a href="list_pm.php">Vos messages&nbsp;(<?php echo $nb_new_pm; ?>)</a> - <a href="profile.php?id=<?php echo $_SESSION['userid']; ?>"></a> <a href="login.php">Déconnexion</a>
</div>
<div class="clean"></div>
</div>
<?php
}
else
{
?>
<?php
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<a href="new_category.php" class="button">Nouvelle Catégorie</a>
<?php
}
if(!isset($_SESSION['username']))
{
?>
<div class="box_login">
<form action="login.php" method="post">
<label for="username">Nom d'utilisateur</label><input type="text" name="username" class="champs" id="username" /><br />
<label for="password">Mot de passe</label><input type="password" name="password" class="champs" id="password" /><br />
<label id="se_souvenir" for="memorize">Se souvenir</label><input class="champs" type="checkbox" name="memorize" id="memorize" value="yes" />
<div class="center">
<input type="button" onclick="javascript:document.location='signup.php';" value="S'inscrire" /> <input type="submit" value="Login" />
</div>
</form>
</div>
<?php
}
?>
<?php
}
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<a href="new_category.php" class="button">Nouvelle Catégorie</a>
<?php
}
?>
<table class="categories_table">
<tr>
<th class="forum_cat">Catégorie</th>
<th class="forum_ntop">Sujets</th>
<th class="forum_nrep">Réponses</th>
<?php
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<th class="forum_act">Action</th>
<?php
}
?>
</tr>
<?php
$dn1 = mysql_query('select c.id, c.name, c.description, c.position, (select count(t.id) from topics as t where t.parent=c.id and t.id2=1) as topics, (select count(t2.id) from topics as t2 where t2.parent=c.id and t2.id2!=1) as replies from categories as c group by c.id order by c.position asc');
$nb_cats = mysql_num_rows($dn1);
while($dnn1 = mysql_fetch_array($dn1))
{
?>
<tr>
<td class="forum_cat"><a href="list_topics.php?parent=<?php echo $dnn1['id']; ?>" class="title"><?php echo htmlentities($dnn1['name'], ENT_QUOTES, 'UTF-8'); ?></a>
<div class="description"><?php echo $dnn1['description']; ?></div></td>
<td><?php echo $dnn1['topics']; ?></td>
<td><?php echo $dnn1['replies']; ?></td>
<?php
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
?>
<td><a href="delete_category.php?id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/Images/delete.png" alt="Delete" /></a>
<?php if($dnn1['position']>1){ ?><a href="move_category.php?action=up&id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/Images/up.png" alt="Faire Monter" /></a><?php } ?>
<?php if($dnn1['position']<$nb_cats){ ?><a href="move_category.php?action=down&id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/Images/down.png" alt="Faire Descendre" /></a><?php } ?>
<a href="edit_category.php?id=<?php echo $dnn1['id']; ?>"><img src="<?php echo $design; ?>/Images/edit.png" alt="Edit" /></a></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
</div>
<?php include "pub.php" ?>
</div>
</body>
<?php include("bas_de_page.php"); ?>
</html>