oops
This commit is contained in:
1 parent
6a7cbd5cfc
commit
09e05d8736
108 files changed
+5528
-93
No files matched your search
+580
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Administration";
|
||||
$balises = true;
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
// On indique o l'on se trouve
|
||||
$cat = (isset($_GET['cat']))?htmlspecialchars($_GET['cat']):'';
|
||||
|
||||
echo'<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./admin.php">Administration du forum</a>';
|
||||
if (!verif_auth(ADMIN)) erreur(ERR_AUTH_ADMIN);
|
||||
|
||||
switch($cat) {//1er switch
|
||||
case "forum":
|
||||
//Ici forum
|
||||
$action = htmlspecialchars(isset($_GET['action'])?$_GET['action']:""); //On récupère la valeur de action
|
||||
switch($action) {//2eme switch
|
||||
case "creer":
|
||||
//Création d'un forum
|
||||
|
||||
//1er cas : pas de variable c
|
||||
if(empty($_GET['c'])) {
|
||||
echo'<br /><br /><br />Que voulez-vous faire?<br />
|
||||
<a href="./admin.php?cat=forum&action=creer&c=f">Créer un forum</a><br />
|
||||
<a href="./admin.php?cat=forum&action=creer&c=c">Créer une catégorie</a></br>';
|
||||
}
|
||||
|
||||
//2ème cas : on cherche à créer un forum (c=f)
|
||||
elseif($_GET['c'] == "f") {
|
||||
$query=$db->query('SELECT cat_id, cat_nom FROM forum_categorie
|
||||
ORDER BY cat_ordre DESC');
|
||||
echo'<h1>Création d\'un forum</h1>';
|
||||
echo'<form method="post" action="./adminok.php?cat=forum&action=creer&c=f">';
|
||||
echo'<label>Nom :</label><input type="text" id="nom" name="nom" /><br /><br />
|
||||
<label>Description :</label>
|
||||
<textarea cols=40 rows=4 name="desc" id="desc"></textarea>
|
||||
<br /><br />
|
||||
<label>Catégorie : </label><select name="cat">';
|
||||
while($data = $query->fetch()) {
|
||||
echo'<option value="'.$data['cat_id'].'">'.$data['cat_nom'].'</option>';
|
||||
}
|
||||
echo'</select><br /><br />
|
||||
<input type="submit" value="Envoyer"></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
//3ème cas : on cherche à créer une catégorie (c=c)
|
||||
elseif($_GET['c'] == "c") {
|
||||
echo'<h1>Création d\'une catégorie</h1>';
|
||||
echo'<form method="post" action="./adminok.php?cat=forum&action=creer&c=c">';
|
||||
echo'<label> Indiquez le nom de la catégorie :</label>
|
||||
<input type="text" id="nom" name="nom" /><br /><br />
|
||||
<input type="submit" value="Envoyer"></form>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "edit":
|
||||
//Edition d'un forum
|
||||
echo'<h1>Edition d\'un forum</h1>';
|
||||
if(!isset($_GET['e'])) {
|
||||
echo'<p>Que voulez vous faire ?<br />
|
||||
<a href="./admin.php?cat=forum&action=edit&e=editf">
|
||||
Editer un forum</a><br />
|
||||
<a href="./admin.php?cat=forum&action=edit&e=editc">
|
||||
Editer une catégorie</a><br />
|
||||
<a href="./admin.php?cat=forum&action=edit&e=ordref">
|
||||
Changer l\'ordre des forums</a><br />
|
||||
<a href="./admin.php?cat=forum&action=edit&e=ordrec">
|
||||
Changer l\'ordre des catégories</a>
|
||||
<br /></p>';
|
||||
}
|
||||
elseif($_GET['e'] == "editf") {
|
||||
//On affiche dans un premier temps la liste des forums
|
||||
if(!isset($_POST['forum']))
|
||||
{
|
||||
$query=$db->query('SELECT forum_id, forum_name
|
||||
FROM forum_forum ORDER BY forum_ordre DESC');
|
||||
|
||||
echo'<form method="post" action="admin.php?cat=forum&action=edit&e=editf">';
|
||||
echo'<p>Choisir un forum :</br /></h2>
|
||||
<select name="forum">';
|
||||
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<option value="'.$data['forum_id'].'">
|
||||
'.stripslashes(htmlspecialchars($data['forum_name'])).'</option>';
|
||||
}
|
||||
echo'<input type="submit" value="Envoyer"></p></form>';
|
||||
$query->CloseCursor();
|
||||
|
||||
}
|
||||
//Ensuite, on affiche les renseignements sur le forum choisi
|
||||
else
|
||||
{
|
||||
$query = $db->prepare('SELECT forum_id, forum_name, forum_desc,
|
||||
forum_cat_id
|
||||
FROM forum_forum
|
||||
WHERE forum_id = :forum');
|
||||
$query->bindValue(':forum',(int) $_POST['forum'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
$data1 = $query->fetch();
|
||||
|
||||
echo'<p>Edition du forum
|
||||
<strong>'.stripslashes(htmlspecialchars($data1['forum_name'])).'</strong></p>';
|
||||
|
||||
echo'<form method="post" action="adminok.php?cat=forum&action=edit&e=editf">
|
||||
<label>Nom du forum : </label><input type="text" id="nom"
|
||||
name="nom" value="'.$data1['forum_name'].'" />
|
||||
<br />
|
||||
|
||||
<label>Description :</label><textarea cols=40 rows=4 name="desc"
|
||||
id="desc">'.$data1['forum_desc'].'</textarea><br /><br />';
|
||||
$query->CloseCursor();
|
||||
//A partir d'ici, on boucle toutes les catégories,
|
||||
//On affichera en premier celle du forum
|
||||
|
||||
$query = $db->query('SELECT cat_id, cat_nom
|
||||
FROM forum_categorie ORDER BY cat_ordre DESC');
|
||||
echo'<label>Déplacer le forum vers : </label>
|
||||
<select name="depl">';
|
||||
while($data2 = $query->fetch())
|
||||
{
|
||||
if($data2['cat_id'] == $data1['forum_cat_id'])
|
||||
{
|
||||
echo'<option value="'.$data2['cat_id'].'"
|
||||
selected="selected">'.stripslashes(htmlspecialchars($data2['cat_nom'])).'
|
||||
</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<option value="'.$data2['cat_id'].'">'.$data2['cat_nom'].'</option>';
|
||||
}
|
||||
}
|
||||
echo'</select><input type="hidden" name="forum_id" value="'.$data1['forum_id'].'">';
|
||||
echo'<p><input type="submit" value="Envoyer"></p></form>';
|
||||
$query->CloseCursor();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
elseif($_GET['e'] == "editc")
|
||||
{
|
||||
//On commence par afficher la liste des catégories
|
||||
if(!isset($_POST['cat']))
|
||||
{
|
||||
$query = $db->query('SELECT cat_id, cat_nom
|
||||
FROM forum_categorie ORDER BY cat_ordre DESC');
|
||||
echo'<form method="post" action="admin.php?cat=forum&action=edit&e=editc">';
|
||||
echo'<p>Choisir une catégorie :</br />
|
||||
<select name="cat">';
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<option value="'.$data['cat_id'].'">'.$data['cat_nom'].'</option>';
|
||||
}
|
||||
echo'<input type="submit" value="Envoyer"></p></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
//Puis le formulaire
|
||||
else
|
||||
{
|
||||
$query = $db->prepare('SELECT cat_nom FROM forum_categorie
|
||||
WHERE cat_id = :cat');
|
||||
$query->bindValue(':cat',(int) $_POST['cat'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
echo'<form method="post" action="./adminok.php?cat=forum&action=edit&e=editc">';
|
||||
|
||||
echo'<label> Indiquez le nom de la catégorie :</label>
|
||||
<input type="text" id="nom" name="nom"
|
||||
value="'.stripslashes(htmlspecialchars($data['cat_nom'])).'" />
|
||||
<br /><br />
|
||||
<input type="hidden" name="cat" value="'.$_POST['cat'].'" />
|
||||
<input type="submit" value="Envoyer" /></p></form>';
|
||||
$query->CloseCursor();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
elseif($_GET['e'] == "ordref") {
|
||||
$categorie="";
|
||||
$query = $db->query('SELECT forum_id, forum_name, forum_ordre, forum_cat_id, cat_id, cat_nom FROM forum_categorie LEFT JOIN forum_forum ON cat_id = forum_cat_id ORDER BY cat_ordre DESC');
|
||||
|
||||
echo'<form method="post" action="adminok.php?cat=forum&action=edit&e=ordref">';
|
||||
|
||||
echo '<table>';
|
||||
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
if( $categorie !== $data['cat_id'] )
|
||||
{
|
||||
$categorie = $data['cat_id'];
|
||||
echo'
|
||||
<tr>
|
||||
<th><strong>'.stripslashes(htmlspecialchars($data['cat_nom'])).'</strong></th>
|
||||
<th><strong>Ordre</strong></th>
|
||||
</tr>';
|
||||
}
|
||||
echo'<tr><td>
|
||||
<a href="./voirforum.php?f='.$data['forum_id'].'">'.$data['forum_name'].'</a></td>
|
||||
<td><input type="text" value="'.$data['forum_ordre'].'" name="'.$data['forum_id'].'" />
|
||||
</td></tr>';
|
||||
}
|
||||
echo'</table>
|
||||
<p><input type="submit" value="Envoyer" /></p></form>';
|
||||
|
||||
}
|
||||
|
||||
elseif($_GET['e'] == "ordrec")
|
||||
{
|
||||
$query = $db->query('SELECT cat_id, cat_nom, cat_ordre
|
||||
FROM forum_categorie
|
||||
ORDER BY cat_ordre DESC');
|
||||
|
||||
echo'<form method="post" action="adminok.php?cat=forum&action=edit&e=ordrec">';
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<label>'.stripslashes(htmlspecialchars($data['cat_nom'])).' :</label>
|
||||
<input type="text" value="'.$data['cat_ordre'].'"name="'.$data['cat_id'].'" /><br /><br />';
|
||||
}
|
||||
echo '<input type="submit" value="Envoyer" /></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
case "messageauto":
|
||||
if (!isset($_POST['idmessage'])) {
|
||||
$query=$db->query('SELECT automess_id, automess_titre
|
||||
FROM forum_automess ORDER BY automess_id DESC');
|
||||
echo'<h1>Modification, ajout ou suppression d\'un message automatique.</h1>';
|
||||
echo'<p>Ajout:</p>';
|
||||
echo'<form style="margin-bottom: 16px" method="post" action="adminok.php?cat=forum&action=messageauto&c=new">';
|
||||
echo'<label>Titre :</label><input type="text" id="titre" name="titre"><br/>';
|
||||
echo'<label>Message :</label><textarea cols=40 rows=4 name="message" id="message"></textarea><br/>';
|
||||
echo'<input type="submit" value="Envoyer !"></input></form>';
|
||||
echo'<hr/><p>Modification:<p/>';
|
||||
echo'<form style="margin-bottom: 16px" method="post" action="admin.php?cat=forum&action=messageauto&c=0">';
|
||||
echo'<p>Choisir le message automatique:<p/>
|
||||
<select name="idmessage">';
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<option value="'.$data['automess_id'].'">'.$data['automess_titre'].'</option>';
|
||||
}
|
||||
echo'<input type="submit" value="Envoyer"></p></form>';
|
||||
$query->CloseCursor();
|
||||
$query=$db->query('SELECT automess_id, automess_titre
|
||||
FROM forum_automess ORDER BY automess_id DESC');
|
||||
echo'<hr/><p>Suppression :<p/>';
|
||||
echo'<form style="margin-bottom: 16px" method="post" action="admin.php?cat=forum&action=messageauto&c=del">';
|
||||
echo'<p>Choisir le message automatique:<p/>
|
||||
<select name="idmessage">';
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<option value="'.$data['automess_id'].'">'.$data['automess_titre'].'</option>';
|
||||
}
|
||||
echo'<input type="submit" value="Envoyer"></p></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
elseif ($_GET['c'] == "del") {
|
||||
echo'<h1>Suppression d\'un message.</h1><p>Êtes vous sur de vouloir supprimer ce message ?';
|
||||
echo'<p><a href="adminok.php?cat=forum&action=messageauto&c=del&m='.$_POST['idmessage'].'">Oui</a> ou <a href="admin.php?cat=forum&action=messageauto">non</a>.</p>';
|
||||
}
|
||||
else {
|
||||
$query=$db->prepare('SELECT automess_mess, automess_titre FROM forum_automess WHERE automess_id = :automess_id');
|
||||
$query->bindValue(':automess_id',(int) $_POST['idmessage'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
echo'<h1>Edition</h1><form method="post" action="adminok.php?cat=forum&action=messageauto&c=edit">
|
||||
<label>Titre</label><input type="text" id="titre" name="titre" value="'.$data['automess_titre'].'"></input><br/>
|
||||
<label>Message</label><textarea cols=40 rows=4 name="message" id="message">'.$data['automess_mess'].'</textarea><br/>
|
||||
<input type="hidden" value="'.$_POST['idmessage'].'" name="automess_id"></input>
|
||||
<input type="submit" value="Envoyer !"></input></form>';
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "droits":
|
||||
//Gestion des droits
|
||||
echo'<h1>Edition des droits</h1>';
|
||||
|
||||
if(!isset($_POST['forum']))
|
||||
{
|
||||
$query=$db->query('SELECT forum_id, forum_name
|
||||
FROM forum_forum ORDER BY forum_ordre DESC');
|
||||
echo'<form method="post" action="admin.php?cat=forum&action=droits">';
|
||||
echo'<p>Choisir un forum :</br />
|
||||
<select name="forum">';
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<option value="'.$data['forum_id'].'">'.$data['forum_name'].'</option>';
|
||||
}
|
||||
echo'<input type="submit" value="Envoyer"></p></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = $db->prepare('SELECT forum_id, forum_name, auth_view,
|
||||
auth_post, auth_topic, auth_annonce, auth_modo
|
||||
FROM forum_forum WHERE forum_id = :forum');
|
||||
$query->bindValue(':forum',(int) $_POST['forum'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
echo '<form method="post" action="adminok.php?cat=forum&action=droits"><p><table><tr>
|
||||
<th>Lire</th>
|
||||
<th>Répondre</th>
|
||||
<th>Poster</th>
|
||||
<th>Annonce</th>
|
||||
<th>Modérer</th>
|
||||
</tr>';
|
||||
$data = $query->fetch();
|
||||
|
||||
//Ces deux tableaux vont permettre d'afficher les résultats
|
||||
$rang = array(
|
||||
VISITEUR=>"Visiteur",
|
||||
INSCRIT=>"Membre",
|
||||
KT=>"KT",
|
||||
MODO=>"Modérateur",
|
||||
ADMIN=>"Administrateur");
|
||||
$list_champ = array("auth_view", "auth_post", "auth_topic","auth_annonce", "auth_modo");
|
||||
|
||||
//On boucle
|
||||
foreach($list_champ as $champ)
|
||||
{
|
||||
echo'<td><select name="'.$champ.'">';
|
||||
for($i=1;$i<5;$i++)
|
||||
{
|
||||
if ($i == $data[$champ])
|
||||
{
|
||||
echo'<option value="'.$i.'" selected="selected">'.$rang[$i].'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<option value="'.$i.'">'.$rang[$i].'</option>';
|
||||
}
|
||||
}
|
||||
echo'</td></select>';
|
||||
}
|
||||
echo'<br /><input type="hidden" name="forum_id" value="'.$data['forum_id'].'" />
|
||||
<input type="submit" value="Envoyer"></p></form>';
|
||||
|
||||
$query->CloseCursor();
|
||||
|
||||
}
|
||||
echo '</table>';
|
||||
break;
|
||||
|
||||
default; //action n'est pas remplie, on affiche le menu
|
||||
echo'<h1>Administration des forums</h1>';
|
||||
echo'<p>Bonjour, cher administrateur :p, que veux tu faire ?
|
||||
<br />
|
||||
<a href="./admin.php?cat=forum&action=creer">Créer un forum</a>
|
||||
<br />
|
||||
<a href="./admin.php?cat=forum&action=edit">Modifier un forum</a>
|
||||
<br/>
|
||||
<a href="./admin.php?cat=forum&action=messageauto">Modifier/ajouter/supprimer un message automatique</a>
|
||||
<br />
|
||||
<a href="./admin.php?cat=forum&action=droits">
|
||||
Modifier les droits d\'un forum</a><br /></p>';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "membres":
|
||||
//Ici membres
|
||||
$action = htmlspecialchars(isset($_GET['action'])?$_GET['action']:""); //On récupère la valeur de action
|
||||
switch($action) //2eme switch
|
||||
{
|
||||
case "edit":
|
||||
echo'<h1>Edition du profil d\'un membre</h1>';
|
||||
|
||||
if(!isset($_POST['membre'])) //Si la variable $_POST['membre'] n'existe pas
|
||||
{
|
||||
echo'De quel membre voulez-vous éditer le profil ?<br />';
|
||||
echo'<br /><form method="post" action="./admin.php?cat=membres&action=edit">
|
||||
<p><label for="membre">Inscrivez le pseudo : </label>
|
||||
<input type="text" id="membre" name="membre"><input type="submit" name="Chercher">
|
||||
</p></form>';
|
||||
}
|
||||
else //sinon
|
||||
{
|
||||
$pseudo_d = $_POST['membre'];
|
||||
|
||||
//Requête qui ramène des info sur le membre à
|
||||
//Partir de son pseudo
|
||||
$query = $db->prepare('SELECT membre_id,
|
||||
membre_pseudo, membre_email,
|
||||
membre_siteweb, membre_signature,
|
||||
membre_twitch, membre_localisation, membre_avatar
|
||||
FROM forum_membres WHERE LOWER(membre_pseudo)=:pseudo');
|
||||
$query->bindValue(':pseudo',strtolower($pseudo_d),PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
//Si la requête retourne un truc, le membre existe
|
||||
if ($data = $query->fetch())
|
||||
{
|
||||
?>
|
||||
<form method="post" action="adminok.php?cat=membres&action=edit" enctype="multipart/form-data">
|
||||
<fieldset><legend>Identifiants</legend>
|
||||
<label for="pseudo">Pseudo :</label>
|
||||
<input type="text" name="pseudo" id="pseudo"
|
||||
value="<?php echo stripslashes(htmlspecialchars($data['membre_pseudo'])) ?>" /><br />
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend>Contacts</legend>
|
||||
<label for="email">Adresse E_Mail :</label>
|
||||
<input type = "text" name="email" id="email"
|
||||
value="<?php echo stripslashes(htmlspecialchars($data['membre_email'])) ?>" /><br />
|
||||
<label for="twitch">Adresse twitch :</label>
|
||||
<input type = "text" name="twitch" id="twitch"
|
||||
value="<?php echo stripslashes(htmlspecialchars($data['membre_twitch'])) ?>" /><br />
|
||||
<label for="website">Site web :</label>
|
||||
<input type = "text" name="website" id="website"
|
||||
value="<?php echo stripslashes(htmlspecialchars($data['membre_siteweb'])) ?>"/><br />
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend>Informations supplémentaire</legend>
|
||||
<label for="localisation">Localisation :</label>
|
||||
<input type = "text" name="localisation" id="localisation"
|
||||
value="<?php echo stripslashes(htmlspecialchars($data['membre_localisation'])) ?>" />
|
||||
<br />
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend>Profil sur le forum</legend>
|
||||
<label for="avatar">Changer l'avatar :</label>
|
||||
<input type="file" name="avatar" id="avatar" />
|
||||
<br /><br />
|
||||
<label><input type="checkbox" name="delete" value="Delete" /> Supprimer l'avatar</label>
|
||||
Avatar actuel :
|
||||
<?php echo'
|
||||
<img src="./images/avatars/'.$data['membre_avatar'].'" alt="pas d\'avatar" />' ?>
|
||||
|
||||
<br /><br />
|
||||
<label for="signature">Signature :</label>
|
||||
<textarea cols=40 rows=4 name="signature" id="signature">
|
||||
<?php echo $data['membre_signature'] ?></textarea>
|
||||
<input type="hidden" name="idori" id="idori" value="<?php echo stripslashes(htmlspecialchars($data['membre_id'])) ?>" />
|
||||
<br /></h2>
|
||||
</fieldset>
|
||||
<?php
|
||||
echo'<input type="hidden" value="'.stripslashes($pseudo_d).'" name="pseudo_d">
|
||||
<input type="submit" value="Modifier le profil" /></form>';
|
||||
$query->CloseCursor();
|
||||
|
||||
}
|
||||
else echo' <p>Erreur : Ce membre n existe pas, <br />
|
||||
cliquez <a href="./admin.php?cat=membres&action=edit">ici</a> pour réessayez</p>';
|
||||
}
|
||||
break;
|
||||
|
||||
case "droits":
|
||||
echo'<h1>Edition des droits d\'un membre</h1>';
|
||||
|
||||
if(!isset($_POST['membre'])) {
|
||||
echo'De quel membre voulez-vous modifier les droits ?<br />';
|
||||
echo'<br /><form method="post" action="./admin.php?cat=membres&action=droits">
|
||||
<p><label for="membre">Inscrivez le pseudo : </label>
|
||||
<input type="text" id="membre" name="membre">
|
||||
<input type="submit" value="Chercher"></p></form>';
|
||||
}
|
||||
else {
|
||||
$pseudo_d = $_POST['membre'];
|
||||
$query = $db->prepare('SELECT membre_pseudo,membre_rang
|
||||
FROM forum_membres WHERE LOWER(membre_pseudo) = :pseudo');
|
||||
$query->bindValue(':pseudo',strtolower($pseudo_d),PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
if ($data = $query->fetch()) {
|
||||
echo'<form action="./adminok.php?cat=membres&action=droits" method="post">';
|
||||
$rang = array
|
||||
(0 => "Bannis",
|
||||
1 => "Visiteur",
|
||||
2 => "Membre",
|
||||
3 => "KT",
|
||||
4 => "Modérateur",
|
||||
5 => "Administrateur"); //Ce tableau associe numéro de droit et nom
|
||||
echo'<label>'.$data['membre_pseudo'].'</label>';
|
||||
echo'<select name="droits">';
|
||||
for($i=0;$i<6;$i++) {
|
||||
if ($i == $data['membre_rang']) {
|
||||
echo'<option value="'.$i.'" selected="selected">'.$rang[$i].'</option>';
|
||||
}
|
||||
else {
|
||||
echo'<option value="'.$i.'">'.$rang[$i].'</option>';
|
||||
}
|
||||
}
|
||||
echo'</select>
|
||||
<input type="hidden" value="'.stripslashes($pseudo_d).'" name="pseudo">
|
||||
<input type="submit" value="Envoyer"></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else echo' <p>Erreur : Ce membre n existe pas, <br />
|
||||
cliquez <a href="./admin.php?cat=membres&action=edit">ici</a> pour réessayer</p>';
|
||||
}
|
||||
break;
|
||||
|
||||
case "ban":
|
||||
//Bannissement
|
||||
echo'<h1>Gestion du bannissement</h1>';
|
||||
|
||||
//Zone de texte pour bannir le membre
|
||||
echo'Quel membre voulez-vous bannir ?<br />';
|
||||
echo'<br />
|
||||
<form method="post" action="./adminok.php?cat=membres&action=ban">
|
||||
<label for="membre">Inscrivez le pseudo : </label>
|
||||
<input type="text" id="membre" name="membre">
|
||||
<input type="submit" value="Envoyer"><br />';
|
||||
|
||||
//Ici, on boucle : pour chaque membre banni, on affiche une checkbox
|
||||
//Qui propose de le débannir
|
||||
$query = $db->query('SELECT membre_id, membre_pseudo
|
||||
FROM forum_membres WHERE membre_rang = 0');
|
||||
|
||||
//Bien sur, on ne lance la suite que s'il y a des membres bannis !
|
||||
if ($query->rowCount() > 0)
|
||||
{
|
||||
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
echo'<br /><label><a href="./voirprofil.php?action=consulter&m='.$data['membre_id'].'">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a></label>
|
||||
<input type="checkbox" name="'.$data['membre_id'].'" />
|
||||
Débannir<br />';
|
||||
}
|
||||
echo'<p><input type="submit" value="Go !" /></p></form>';
|
||||
}
|
||||
else echo' <p>Aucun membre banni pour le moment :p</p>';
|
||||
$query->CloseCursor();
|
||||
break;
|
||||
|
||||
default; //action n'est pas remplie, on affiche le menu
|
||||
echo'<h1>Administration des membres</h1>';
|
||||
echo'<p>Bonjour, que voulez-vous faire ?<br />
|
||||
<a href="./admin.php?cat=membres&action=edit">
|
||||
Editer le profil d\'un membre</a><br />
|
||||
<a href="./admin.php?cat=membres&action=droits">
|
||||
Modifier les droits d\'un membre</a><br />
|
||||
<a href="./admin.php?cat=membres&action=ban">
|
||||
Bannir / Debannir un membre</a><br /></p>';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "config":
|
||||
//ici configuration
|
||||
echo'<h1>Configuration du forum</h1>';
|
||||
echo '<form method="post" action="adminok.php?cat=config">';
|
||||
|
||||
//Le tableau associatif
|
||||
$config_name = array(
|
||||
"avatar_maxsize" => "Taille maximale de l'avatar",
|
||||
"avatar_maxh" => "Hauteur maximale de l'avatar",
|
||||
"avatar_maxl" => "Largeur maximale de l'avatar",
|
||||
"sign_maxl" => "Taille maximale de la signature",
|
||||
"auth_bbcode_sign" => "Autoriser le bbcode dans la signature",
|
||||
"pseudo_maxsize" => "Taille maximale du pseudo",
|
||||
"pseudo_minsize" => "Taille minimale du pseudo",
|
||||
"topic_par_page" => "Nombre de topics par page",
|
||||
"post_par_page" => "Nombre de posts par page",
|
||||
"forum_titre" => "Titre du forum",
|
||||
);
|
||||
$query = $db->query('SELECT config_nom, config_valeur FROM forum_config');
|
||||
|
||||
while($data=$query->fetch())
|
||||
{
|
||||
echo '<p><label for='.$data['config_nom'].'>'.$config_name[$data['config_nom']].' </label> :
|
||||
<input type="text" id="'.$data['config_nom'].'" value="'.$data['config_valeur'].'" name="'.$data['config_nom'].'"></p>';
|
||||
}
|
||||
echo '<p><input type="submit" value="Envoyer" /></p></form>';
|
||||
$query->CloseCursor();
|
||||
break;
|
||||
|
||||
|
||||
default; //cat n'est pas remplie, on affiche le menu général
|
||||
echo'<h1>Index de l\'administration</h1>';
|
||||
echo'<p>Bienvenue sur la page d\'administration.<br />
|
||||
<a href="./admin.php?cat=config">Configuration du forum</a><br />
|
||||
<a href="./admin.php?cat=forum">Administration des forums</a><br />
|
||||
<a href="./admin.php?cat=membres">Administration des membres</a><br /></p>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
3e100ffafb6767f9b4a662cc15439dd245cba665
|
||||
@@ -0,0 +1,487 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Administration";
|
||||
$balises = true;
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
echo'<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./admin.php">Administration du forum</a>';
|
||||
if (!verif_auth(ADMIN)) erreur(ERR_AUTH_ADMIN);
|
||||
$cat = htmlspecialchars($_GET['cat']); //on récupère dans l'url la variable cat
|
||||
switch($cat) {//1er switch
|
||||
case "config":
|
||||
echo'<h1>Configuration du forum</h1>';
|
||||
//On récupère les valeurs et le nom de chaque entrée de la table
|
||||
$query=$db->query('SELECT config_nom, config_valeur FROM forum_config');
|
||||
//Avec cette boucle, on va pouvoir contrôler le résultat pour voir s'il a changé
|
||||
while($data = $query->fetch()) {
|
||||
if ($data['config_valeur'] != $_POST[$data['config_nom']]) {
|
||||
//On met ensuite à jour
|
||||
$valeur = htmlspecialchars($_POST[$data['config_nom']]);
|
||||
$query=$db->prepare('UPDATE forum_config SET config_valeur = :valeur
|
||||
WHERE config_nom = :nom');
|
||||
$query->bindValue(':valeur', $valeur, PDO::PARAM_STR);
|
||||
$query->bindValue(':nom', $data['config_nom'],PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
}
|
||||
}
|
||||
$query->CloseCursor();
|
||||
//Et le message !
|
||||
echo'<br /><br />Les nouvelles configurations ont été mises à jour !<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour revenir à l\'administration';
|
||||
break;
|
||||
case "forum":
|
||||
//Ici forum
|
||||
$action = htmlspecialchars($_GET['action']); //On récupère la valeur de action
|
||||
switch($action) {//2ème switch
|
||||
case "creer":
|
||||
//On commence par les forums
|
||||
if ($_GET['c'] == "f") {
|
||||
$titre = $_POST['nom'];
|
||||
$desc = $_POST['desc'];
|
||||
$cat = (int) $_POST['cat'];
|
||||
$query=$db->prepare('INSERT INTO forum_forum (forum_cat_id, forum_name, forum_desc)
|
||||
VALUES (:cat, :titre, :desc)');
|
||||
$query->bindValue(':cat',$cat,PDO::PARAM_INT);
|
||||
$query->bindValue(':titre',$titre, PDO::PARAM_STR);
|
||||
$query->bindValue(':desc',$desc,PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
echo'<br /><br />Le forum a été créé !<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour revenir à l\'administration';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
//Puis par les catégories
|
||||
elseif ($_GET['c'] == "c") {
|
||||
$titre = $_POST['nom'];
|
||||
$query=$db->prepare('INSERT INTO forum_categorie (cat_nom) VALUES (:titre)');
|
||||
$query->bindValue(':titre',$titre, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
echo'<p>La catégorie a été créée !<br /> Cliquez <a href="./admin.php">ici</a>
|
||||
pour revenir à l\'administration</p>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
case "edit":
|
||||
echo'<h1>Edition d\'un forum</h1>';
|
||||
|
||||
if($_GET['e'] == "editf") {
|
||||
//Récupération d'informations
|
||||
$titre = $_POST['nom'];
|
||||
$desc = $_POST['desc'];
|
||||
$cat = (int) $_POST['depl'];
|
||||
|
||||
//Vérification
|
||||
$query=$db->prepare('SELECT COUNT(*)
|
||||
FROM forum_forum WHERE forum_id = :id');
|
||||
$query->bindValue(':id',(int) $_POST['forum_id'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$forum_existe=$query->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
if ($forum_existe == 0) erreur(ERR_FOR_EXIST);
|
||||
|
||||
|
||||
//Mise à jour
|
||||
$query=$db->prepare('UPDATE forum_forum
|
||||
SET forum_cat_id = :cat, forum_name = :name, forum_desc = :desc
|
||||
WHERE forum_id = :id');
|
||||
$query->bindValue(':cat',$cat,PDO::PARAM_INT);
|
||||
$query->bindValue(':name',$titre,PDO::PARAM_STR);
|
||||
$query->bindValue(':desc',$desc,PDO::PARAM_STR);
|
||||
$query->bindValue(':id',(int) $_POST['forum_id'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
//Message
|
||||
echo'<p>Le forum a été modifié !<br />Cliquez <a href="./admin.php">ici</a>
|
||||
pour revenir à l\'administration</p>';
|
||||
}
|
||||
elseif($_GET['e'] == "editc") {
|
||||
//Récupération d'informations
|
||||
$titre = $_POST['nom'];
|
||||
|
||||
//Vérification
|
||||
$query=$db->prepare('SELECT COUNT(*)
|
||||
FROM forum_categorie WHERE cat_id = :cat');
|
||||
$query->bindValue(':cat',(int) $_POST['cat'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$cat_existe=$query->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
if ($cat_existe == 0) erreur(ERR_CAT_EXIST);
|
||||
|
||||
//Mise à jour
|
||||
$query=$db->prepare('UPDATE forum_categorie
|
||||
SET cat_nom = :name WHERE cat_id = :cat');
|
||||
$query->bindValue(':name',$titre,PDO::PARAM_STR);
|
||||
$query->bindValue(':cat',(int) $_POST['cat'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Message
|
||||
echo'<p>La catégorie a été modifiée !<br />
|
||||
Cliquez <a href="./admin.php">ici</a>
|
||||
pour revenir à l\'administration</p>';
|
||||
|
||||
}
|
||||
elseif($_GET['e'] == "ordref") {
|
||||
//On récupère les id et l'ordre de tous les forums
|
||||
$query=$db->query('SELECT forum_id, forum_ordre FROM forum_forum');
|
||||
|
||||
//On boucle les résultats
|
||||
while($data= $query->fetch()) {
|
||||
$ordre = (int) $_POST[$data['forum_id']];
|
||||
|
||||
//Si et seulement si l'ordre est différent de l'ancien, on le met à jour
|
||||
if ($data['forum_ordre'] != $ordre) {
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_ordre = :ordre
|
||||
WHERE forum_id = :id');
|
||||
$query->bindValue(':ordre',$ordre,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$data['forum_id'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
}
|
||||
$query->CloseCursor();
|
||||
//Message
|
||||
echo'<p>L\'ordre a été modifié !<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour revenir à l\'administration</p>';
|
||||
}
|
||||
elseif($_GET['e'] == "ordrec") {
|
||||
|
||||
//On récupère les id et les ordres de toutes les catégories
|
||||
$query=$db->query('SELECT cat_id, cat_ordre FROM forum_categorie');
|
||||
|
||||
//On boucle le tout
|
||||
while($data = $query->fetch()) {
|
||||
$ordre = (int) $_POST[$data['cat_id']];
|
||||
|
||||
//On met à jour si l'ordre a changé
|
||||
if($data['cat_ordre'] != $ordre) {
|
||||
$query=$db->prepare('UPDATE forum_categorie SET cat_ordre = :ordre
|
||||
WHERE cat_id = :id');
|
||||
$query->bindValue(':ordre',$ordre,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$data['cat_id'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
}
|
||||
echo'<p>L\'ordre a été modifié !<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour revenir à l\'administration</p>';
|
||||
}
|
||||
break;
|
||||
case "messageauto":
|
||||
$c = htmlspecialchars($_GET['c']);
|
||||
switch($c) {
|
||||
case "new":
|
||||
$mess = $_POST['message'];
|
||||
$titre = $_POST['titre'];
|
||||
$query=$db->prepare('INSERT INTO forum_automess (automess_id, automess_mess, automess_titre) VALUES (NULL, :mess, :titre)');
|
||||
$query-> bindValue(':mess', $mess, PDO::PARAM_STR);
|
||||
$query-> bindValue(':titre', $titre, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
echo'<p>Le message automatique a été ajouté.</p>';
|
||||
break;
|
||||
case "edit":
|
||||
$mess = isset($_POST['message']);
|
||||
$titre = isset($_POST['titre']);
|
||||
$query=$db->prepare('UPDATE forum_automess SET automess_id=:id,automess_mess=:mess,automess_titre=:titre WHERE automess_id = :id');
|
||||
$query->bindValue(':id',$_POST['automess_id'],PDO::PARAM_INT);
|
||||
$query->bindValue(':mess',$_POST['message'],PDO::PARAM_STR);
|
||||
$query->bindValue(':titre',$_POST['titre'],PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
echo'<h1>Modification</h1>';
|
||||
echo'Le message automatique: '.$_POST['titre'].' a été modifié.';
|
||||
echo'<br/><br/>Cliquez <a href="admin.php">ici</a> pour revenir à l\'administration';
|
||||
$query->CloseCursor();
|
||||
break;
|
||||
case "del":
|
||||
$query=$db->prepare('DELETE FROM forum_automess WHERE automess_id = :id');
|
||||
$query->bindValue(':id',$_GET['m'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
echo'<p>Le message a bien été supprimé.</p>';
|
||||
echo'Cliquez <a href="admin.php">ici</a> pour revenir à l\'administration';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "droits":
|
||||
//Récupération d'informations
|
||||
$auth_view = (int) $_POST['auth_view'];
|
||||
$auth_post = (int) $_POST['auth_post'];
|
||||
$auth_topic = (int) $_POST['auth_topic'];
|
||||
$auth_annonce = (int) $_POST['auth_annonce'];
|
||||
$auth_modo = (int) $_POST['auth_modo'];
|
||||
|
||||
//Mise à jour
|
||||
$query=$db->prepare('UPDATE forum_forum
|
||||
SET auth_view = :view, auth_post = :post, auth_topic = :topic,
|
||||
auth_annonce = :annonce, auth_modo = :modo WHERE forum_id = :id');
|
||||
$query->bindValue(':view',$auth_view,PDO::PARAM_INT);
|
||||
$query->bindValue(':post',$auth_post,PDO::PARAM_INT);
|
||||
$query->bindValue(':topic',$auth_topic,PDO::PARAM_INT);
|
||||
$query->bindValue(':annonce',$auth_annonce,PDO::PARAM_INT);
|
||||
$query->bindValue(':modo',$auth_modo,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',(int) $_POST['forum_id'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Message
|
||||
echo'<p>Les droits ont été modifiés !<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour revenir à l\'administration</p>';
|
||||
break;
|
||||
} //Fin du switch
|
||||
break;
|
||||
|
||||
case"membres":
|
||||
$action = htmlspecialchars($_GET['action']); //On récupère la valeur de action
|
||||
switch($action) {//2ème switch
|
||||
case"edit":
|
||||
//On déclare les variables
|
||||
$pseudo_erreur1 = NULL;
|
||||
$email_erreur1 = NULL;
|
||||
$email_erreur2 = NULL;
|
||||
$twitch_erreur = NULL;
|
||||
$signature_erreur = NULL;
|
||||
$avatar_erreur = NULL;
|
||||
$avatar_erreur1 = NULL;
|
||||
$avatar_erreur2 = NULL;
|
||||
$avatar_erreur3 = NULL;
|
||||
|
||||
//Encore et toujours notre belle variable $i :p
|
||||
$i = 0;
|
||||
$pseudo = $_POST['pseudo'];
|
||||
$temps = time();
|
||||
$signature = $_POST['signature'];
|
||||
$email = $_POST['email'];
|
||||
$twitch = $_POST['twitch'];
|
||||
$website = $_POST['website'];
|
||||
$localisation = $_POST['localisation'];
|
||||
|
||||
//Vérification de l'adresse email
|
||||
//Il faut que l'adresse email n'ait jamais été utilisée (sauf si elle n'a pas été modifiée)
|
||||
|
||||
//On commence donc par récupérer le mail
|
||||
$query=$db->prepare('SELECT membre_email FROM forum_membres WHERE membre_id =:id');
|
||||
$query->bindValue(':id',$_POST['idori'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
if (strtolower($data['membre_email']) != strtolower($email))
|
||||
{
|
||||
//Il faut que l'adresse email n'ait jamais été utilisée
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_email =:mail');
|
||||
$query->bindValue(':mail',$email,PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$mail_free=($query->fetchColumn()==0)?1:0;
|
||||
$query->CloseCursor();
|
||||
if(!$mail_free)
|
||||
{
|
||||
$email_erreur1 = "Votre adresse email est déjà utilisé par un membre";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//On vérifie la forme maintenant
|
||||
if (!preg_match("#^[a-z0-9A-Z._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $email) || empty($email))
|
||||
{
|
||||
$email_erreur2 = "Votre nouvelle adresse E-Mail n'a pas un format valide";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
//Vérification de l'avatar
|
||||
|
||||
if (!empty($_FILES['avatar']['size']))
|
||||
{
|
||||
//On définit les variables :
|
||||
$maxsize = 30072; //Poid de l'image
|
||||
$maxwidth = 100; //Largeur de l'image
|
||||
$maxheight = 100; //Longueur de l'image
|
||||
//Liste des extensions valides
|
||||
$extensions_valides = array( 'jpg' , 'jpeg' , 'png' , 'png', 'bmp' );
|
||||
|
||||
if ($_FILES['avatar']['error'] > 0)
|
||||
{
|
||||
$avatar_erreur = "Erreur lors du tranfsert de l'avatar : ";
|
||||
}
|
||||
if ($_FILES['avatar']['size'] > $maxsize)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur1 = "Le fichier est trop gros :
|
||||
(<strong>".$_FILES['avatar']['size']." Octets</strong>
|
||||
contre <strong>".$maxsize." Octets</strong>)";
|
||||
}
|
||||
|
||||
$image_sizes = getimagesize($_FILES['avatar']['tmp_name']);
|
||||
if ($image_sizes[0] > $maxwidth OR $image_sizes[1] > $maxheight)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur2 = "Image trop large ou trop longue :
|
||||
(<strong>".$image_sizes[0]."x".$image_sizes[1]."</strong> contre
|
||||
<strong>".$maxwidth."x".$maxheight."</strong>)";
|
||||
}
|
||||
|
||||
$extension_upload = strtolower(substr( strrchr($_FILES['avatar']['name'], '.') ,1));
|
||||
if (!in_array($extension_upload,$extensions_valides) )
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur3 = "Extension de l'avatar incorrecte";
|
||||
}
|
||||
}
|
||||
|
||||
if ($i == 0) // Si $i est vide, il n'y a pas d'erreur
|
||||
{
|
||||
if (!empty($_FILES['avatar']['size']))
|
||||
{
|
||||
$nomavatar=move_avatar($_FILES['avatar']);
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_avatar = :avatar
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':avatar',$nomavatar,PDO::PARAM_STR);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
//Une nouveauté ici : on peut choisis de supprimer l'avatar
|
||||
if (isset($_POST['delete']))
|
||||
{
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_avatar=0 WHERE membre_id = :id');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
//Le pseudo doit être unique !
|
||||
//Il faut donc vérifier s'il a été modifié, si c'est le cas, on vérifie bien
|
||||
//l'unicité
|
||||
$query=$db->prepare('SELECT membre_pseudo FROM forum_membres WHERE membre_id =:id');
|
||||
$query->bindValue(':id',$_POST['idori'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data1=$query-> fetch();
|
||||
if (strtolower($data1['membre_pseudo']) != $pseudo) {
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_pseudo =:pseudo');
|
||||
$query->execute(array('pseudo'=>$pseudo));
|
||||
$pseudo_free=($query->fetchColumn()==0)?1:0;
|
||||
if(!$pseudo_free)
|
||||
{
|
||||
$pseudo_erreur1 = "Votre pseudo est déjà utilisé par un membre";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$query->CloseCursor();
|
||||
|
||||
//Vérification de la signature
|
||||
if (strlen($signature) > 200) {
|
||||
$signature_erreur = "Votre nouvelle signature est trop longue";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
echo'<h1>Modification terminée</h1>';
|
||||
echo'<p>Votre profil a été modifié avec succès !</p>';
|
||||
echo'<p>Cliquez <a href="./index.php">ici</a>
|
||||
pour revenir à la page d\'accueil</p>';
|
||||
|
||||
//On modifie la table
|
||||
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_email=:mail, membre_twitch=:twitch, membre_siteweb=:website,
|
||||
membre_signature=:sign, membre_localisation=:loc, membre_pseudo=:pseudo
|
||||
WHERE membre_id=:id');
|
||||
$query->bindValue(':mail',$email,PDO::PARAM_STR);
|
||||
$query->bindValue(':pseudo',$pseudo,PDO::PARAM_STR);
|
||||
$query->bindValue(':twitch',$twitch,PDO::PARAM_STR);
|
||||
$query->bindValue(':website',$website,PDO::PARAM_STR);
|
||||
$query->bindValue(':sign',$signature,PDO::PARAM_STR);
|
||||
$query->bindValue(':loc',$localisation,PDO::PARAM_STR);
|
||||
$query->bindValue(':id',$_POST['idori'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<h1>Modification interrompue</h1>';
|
||||
echo'<p>Une ou plusieurs erreurs se sont produites pendant la modification du profil</p>';
|
||||
echo'<p>'.$i.' erreur(s)</p>';
|
||||
echo'<p>'.$pseudo_erreur1.'</p>';
|
||||
echo'<p>oui'.$_POST['idori'].'</p>';
|
||||
echo'<p>'.$email_erreur1.'</p>';
|
||||
echo'<p>'.$email_erreur2.'</p>';
|
||||
echo'<p>'.$twitch_erreur.'</p>';
|
||||
echo'<p>'.$signature_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur1.'</p>';
|
||||
echo'<p>'.$avatar_erreur2.'</p>';
|
||||
echo'<p>'.$avatar_erreur3.'</p>';
|
||||
echo'<p> Cliquez <a href="./admin.php?cat=membres&action=edit">ici</a> pour recommencer</p>';
|
||||
}
|
||||
break;
|
||||
case "droits":
|
||||
$membre =$_POST['pseudo'];
|
||||
$rang = (int) $_POST['droits'];
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_rang = :rang
|
||||
WHERE LOWER(membre_pseudo) = :pseudo');
|
||||
$query->bindValue(':rang',$rang,PDO::PARAM_INT);
|
||||
$query->bindValue(':pseudo',strtolower($membre), PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
echo'<p>Le niveau du membre a été modifié !<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour revenir à l\'administration</p>';
|
||||
break;
|
||||
case "ban":
|
||||
//Bannissement dans un premier temps
|
||||
//Si jamais on n'a pas laissé vide le champ pour le pseudo
|
||||
if (isset($_POST['membre']) AND !empty($_POST['membre']))
|
||||
{
|
||||
$membre = $_POST['membre'];
|
||||
$query=$db->prepare('SELECT membre_id
|
||||
FROM forum_membres WHERE LOWER(membre_pseudo) = :pseudo');
|
||||
$query->bindValue(':pseudo',strtolower($membre), PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
//Si le membre existe
|
||||
if ($data = $query->fetch())
|
||||
{
|
||||
//On le bannit
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_rang = 0
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':id',$data['membre_id'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
echo'<br /><br />
|
||||
Le membre '.stripslashes(htmlspecialchars($membre)).' a bien été banni !<br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<p>Désolé, le membre '.stripslashes(htmlspecialchars($membre)).' n existe pas !
|
||||
<br />
|
||||
Cliquez <a href="./admin.php?cat=membres&action=ban">ici</a>
|
||||
pour réessayer</p>';
|
||||
}
|
||||
}
|
||||
//Debannissement ici
|
||||
$query = $db->query('SELECT membre_id FROM forum_membres
|
||||
WHERE membre_rang = 0');
|
||||
//Si on veut débannir au moins un membre
|
||||
if ($query->rowCount() > 0)
|
||||
{
|
||||
$i=0;
|
||||
while($data= $query->fetch())
|
||||
{
|
||||
if(isset($_POST[$data['membre_id']]))
|
||||
{
|
||||
$i++;
|
||||
//On remet son rang à 2
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_rang = 2
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':id',$data['membre_id'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
}
|
||||
if ($i!=0)
|
||||
echo'<p>Les membres ont été débannis<br />
|
||||
Cliquez <a href="./admin.php">ici</a> pour retourner à l\'administration</p>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
5849706342132c1b613fbe2158b4fcb17055c871
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Gestion des amis";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
$action = isset($_GET['action'])?htmlspecialchars($_GET['action']):'';
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./amis.php">Gestion des amis</a>';
|
||||
if ($id==0) erreur(ERR_IS_NOT_CO);
|
||||
|
||||
//Le titre
|
||||
echo '<h1>Gestion des amis</h1>';
|
||||
switch($action)
|
||||
{
|
||||
case "add": //On veut ajouter un ami
|
||||
if (!isset($_POST['pseudo']))
|
||||
{
|
||||
echo '<form action="amis.php?action=add" method="post">
|
||||
<p><label for="pseudo">Entrez le pseudo</label>
|
||||
<input type="text" name="pseudo" id="pseudo" />
|
||||
<input type="submit" value="Envoyer" />
|
||||
</p></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pseudo_d = $_POST['pseudo'];
|
||||
//On vérifie que le pseudo renvoit bien quelque chose :o
|
||||
|
||||
$query=$db->prepare('SELECT membre_id, COUNT(*) AS nbr FROM forum_membres
|
||||
WHERE LOWER(membre_pseudo) = :pseudo GROUP BY membre_pseudo');
|
||||
$query->bindValue(':pseudo',strtolower($pseudo_d),PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$pseudo_exist = $data['nbr'];
|
||||
$i = 0;
|
||||
$id_to=$data['membre_id'];
|
||||
if(!$pseudo_exist)
|
||||
{
|
||||
echo '<p>Ce membre ne semble pas exister<br />
|
||||
Cliquez <a href="./amis.php?action=add">ici</a> pour réessayer</p>';
|
||||
$i++;
|
||||
}
|
||||
$query->CloseCursor();
|
||||
$query = $db->prepare('SELECT COUNT(*) AS nbr FROM forum_amis
|
||||
WHERE ami_from = :id AND ami_to = :id_to
|
||||
OR ami_from = :id AND ami_to = :id_to');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':id_to', $id_to, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$deja_ami=$query->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
|
||||
if ($deja_ami != 0)
|
||||
{
|
||||
echo '<p>Ce membre fait déjà parti de vos amis ou a déjà proposé son amitié :p<br />
|
||||
Cliquez <a href="./amis.php?action=add">ici</a> pour réessayer</p>';
|
||||
$i++;
|
||||
}
|
||||
if ($id_to == $id)
|
||||
{
|
||||
echo '<p>Vous ne pouvez pas vous ajouter vous même<br />
|
||||
Cliquez <a href="./amis.php?action=add">ici</a> pour réessayer</p>';
|
||||
$i++;
|
||||
}
|
||||
if ($i == 0)
|
||||
{
|
||||
$query=$db->prepare('INSERT INTO forum_amis (ami_from, ami_to, ami_confirm, ami_date)
|
||||
VALUES(:id, :id_to, :conf, :temps)');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':id_to', $id_to, PDO::PARAM_INT);
|
||||
$query->bindValue(':conf','0',PDO::PARAM_STR);
|
||||
$query->bindValue(':temps', time(), PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
echo '<p><a href="/voirprofil.php?m='.$data['membre_id'].'">'.stripslashes(htmlspecialchars($pseudo_d)).'</a>
|
||||
a bien été ajouté à vos amis, il faut toutefois qu\'il donne son accord.<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour retourner à l index du forum<br />
|
||||
Cliquez <a href="./amis.php">ici</a> pour retourner à la page de gestion des amis</p>';
|
||||
}
|
||||
}
|
||||
|
||||
case "check":
|
||||
$add = (isset($_GET['add']))?htmlspecialchars($_GET['add']):0;
|
||||
if (empty($add))
|
||||
{
|
||||
$query = $db->prepare('SELECT ami_from, ami_date, membre_pseudo FROM forum_amis
|
||||
LEFT JOIN forum_membres ON membre_id = ami_from
|
||||
WHERE ami_to = :id AND ami_confirm = :conf
|
||||
ORDER BY ami_date DESC');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':conf','0',PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
|
||||
echo '<table><tr>
|
||||
<th class="pseudo"><strong>Pseudo</strong></th>
|
||||
<th class="inscrit"><strong>Date d\'ajout</strong></th>
|
||||
<th><strong>Action</strong></th></tr>';
|
||||
|
||||
if ($query->rowCount() == 0)
|
||||
{
|
||||
echo '<td colspan="3" align="center">Vous n\'avez aucune proposition</td>';
|
||||
}
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
echo '<tr><td><a href="./voirprofil.php?m='.$data['ami_from'].'&action=consulter">'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a></td>
|
||||
<td class="inscrit">'.date('d/m/Y',$data['ami_date']).'</td>
|
||||
<td><a href="./amis.php?action=check&add=ok&m='.$data['ami_from'].'">Accepter</a> -
|
||||
<a href="./amis.php?action=delete&m='.$data['ami_from'].'">Refuser</a>
|
||||
</td></tr>';
|
||||
}
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
$membre = (int) $_GET['m'];
|
||||
$query = $db->prepare('UPDATE forum_amis SET ami_confirm = :conf
|
||||
WHERE ami_from = :membre AND ami_to = :id');
|
||||
$query->bindValue(':conf','1',PDO::PARAM_STR);
|
||||
$query->bindValue(':membre',$membre,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->closeCursor();
|
||||
echo '<p>Le membre a bien été ajouté à votre liste d\'ami<br />
|
||||
Cliquez <a href="./amis.php">ici</a> pour retourner à la liste des amis';
|
||||
}
|
||||
break;
|
||||
case "delete":
|
||||
$membre = (int) $_GET['m'];
|
||||
if (!isset($_GET['ok']))
|
||||
{
|
||||
echo '<p>Etes vous certain de vouloir supprimer ce membre ?<br />
|
||||
<a href="./amis.php?action=delete&ok=ok&m='.$membre.'">oui</a> - <a href="./amis.php">non</a></p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = $db->prepare('DELETE FROM forum_amis WHERE ami_from = :membre AND ami_to = :id');
|
||||
$query->bindValue(':membre',$membre,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->closeCursor();
|
||||
|
||||
$query = $db->prepare('DELETE FROM forum_amis WHERE ami_to = :membre AND ami_from = :id');
|
||||
$query->bindValue(':membre',$membre,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->closeCursor();
|
||||
|
||||
echo '<p>Membre correctement supprimé :D <br />
|
||||
Cliquez <a href="./amis.php">ici</a> pour retourner à la liste des amis</p>';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
$query = $db->prepare('SELECT (ami_from + ami_to - :id) AS ami_id, ami_date, membre_pseudo, online_id
|
||||
FROM forum_amis
|
||||
LEFT JOIN forum_membres ON membre_id = (ami_from + ami_to - :id)
|
||||
LEFT JOIN forum_whosonline ON online_id = membre_id
|
||||
WHERE (ami_from = :id OR ami_to = :id) AND ami_confirm = :conf ORDER BY membre_pseudo');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':conf','1',PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
|
||||
echo '<table><tr>
|
||||
<th class="pseudo"><strong>Pseudo</strong></th>
|
||||
<th class="inscrit"><strong>Date d\'ajout</strong></th>
|
||||
<th><strong>Action</strong></th>
|
||||
<th><strong>Connecté</strong></th></tr>';
|
||||
|
||||
if ($query->rowCount() == 0)
|
||||
{
|
||||
echo '<td colspan="4" align="center">Vous n\'avez aucun ami pour l\'instant</td>';
|
||||
}
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
echo '<tr><td><a href="./voirprofil.php?m='.$data['ami_id'].'&action=consulter">'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a></td>
|
||||
<td class="inscrit">'.date('d/m/Y',$data['ami_date']).'</td>
|
||||
<td><a href="./messagesprives.php?action=repondre&dest='.$data['ami_id'].'">Envoyer un MP</a><br />
|
||||
<a href="./amis.php?action=delete&m='.$data['ami_id'].'">Supprimer</a></td>';
|
||||
if (!empty($data['online_id'])) echo '<td>Oui</td>'; else echo '<td>Non</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
$query->CloseCursor();
|
||||
|
||||
//On compte le nombre de demande en cours et on met quelques liens
|
||||
$query=$db->prepare('SELECT COUNT(*) FROM forum_amis
|
||||
WHERE ami_to = :id AND ami_confirm = :conf');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':conf','0', PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$demande_ami=$query->fetchColumn();
|
||||
|
||||
//Cette ligne va permettre d'afficher 0 plutôt qu'un vide
|
||||
if (empty($demande_ami)) $demande_ami=0;
|
||||
echo '<br /><ul>
|
||||
<li><a href="./amis.php?action=add">Ajouter un ami</a></li>
|
||||
<li><a href="./amis.php?action=check">Voir les demandes d\'ajout ('.$demande_ami.')</a></li></ul>';
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</body></html>
|
||||
@@ -1 +0,0 @@
|
||||
6c4b90205ebee7399e0fb628a643d226aff7e7f0
|
||||
@@ -0,0 +1,522 @@
|
||||
*{
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration:none;
|
||||
color:#000C99;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#corps_forum {
|
||||
border: 1px solid black;
|
||||
width: 90%;
|
||||
margin-top: 50px;
|
||||
margin-left: 5%;
|
||||
margin-bottom: 10Opx;
|
||||
padding: 5px;
|
||||
background-color: #888;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
input[type="submit"]:hover {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color:#a8a6a1;
|
||||
transition:color .2s;
|
||||
}
|
||||
|
||||
input[type="reset"]:hover {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color:#a8a6a1;
|
||||
transition:color .2s;
|
||||
}
|
||||
|
||||
input[type="reset"] {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
input[type="button"] {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
input[type="button"]:hover {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color:#a8a6a1;
|
||||
transition:color .2s;
|
||||
}
|
||||
|
||||
|
||||
select {
|
||||
border: black 1px solid;
|
||||
background: #333;
|
||||
/*width: 20%;*/
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.mp_titre { width:65%; }
|
||||
|
||||
.mp_expediteur { width:10%; }
|
||||
|
||||
.mp_time { width:20%; }
|
||||
|
||||
.ico {width:8%}
|
||||
|
||||
.titre { width:61%; }
|
||||
|
||||
.nombremessages { width:2%; }
|
||||
|
||||
.nombrevu { width:4%; }
|
||||
|
||||
.nombresujets { width:2%; }
|
||||
|
||||
.auteur { width:7%; }
|
||||
|
||||
.derniermessage { width:18%; }
|
||||
|
||||
.categorie {
|
||||
width:92%;
|
||||
background-color : #555;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid black;
|
||||
background-color: #888;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
table {
|
||||
background-color: #fffff;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #555;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
label {
|
||||
display:block;
|
||||
width:170px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.vt_auteur {
|
||||
width:20%;
|
||||
background-color : #555;
|
||||
}
|
||||
|
||||
.vt_mess {
|
||||
width:75%;
|
||||
background-color : #555;
|
||||
}
|
||||
|
||||
#quote {
|
||||
width: 100%;
|
||||
background-color : rgb(220,220,220);
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-family: 'Indie Flower', cursive;
|
||||
}
|
||||
|
||||
@media screen and (min-width:1400px) {
|
||||
|
||||
#footer {
|
||||
border: 1px solid black;
|
||||
width: 90%;
|
||||
height: 50%;
|
||||
margin-top: 50px;
|
||||
margin-left: 5%;
|
||||
margin-bottom: 10Opx;
|
||||
padding: 5px;
|
||||
background-color: #888;
|
||||
}
|
||||
|
||||
#contenu {
|
||||
padding: 55px;
|
||||
}
|
||||
|
||||
.accueil {
|
||||
width: 100px;
|
||||
background-color: #ffffff;
|
||||
text-align: center;
|
||||
position:Fixed;
|
||||
z-index:100;
|
||||
margin-left:1125px;
|
||||
}
|
||||
|
||||
#menu {
|
||||
text-decoration:none;
|
||||
color:white;
|
||||
}
|
||||
|
||||
#menu:hover {
|
||||
color:#a8a6a1;
|
||||
transition:color .2s;
|
||||
}
|
||||
|
||||
.corps {
|
||||
text-align:center;
|
||||
margin-top:0px;
|
||||
max-width: 1180px;
|
||||
margin:auto;
|
||||
background-color:white;
|
||||
z-index:10;
|
||||
}
|
||||
|
||||
.titre1 {
|
||||
font-family: 'Yrsa', serif;
|
||||
font-weight: 100;
|
||||
padding-top: 30px;
|
||||
margin: 0px;
|
||||
color:#333;
|
||||
padding-bottom: 0.3em;
|
||||
font-size:4em;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-top: 0px;
|
||||
background-color:#212121;
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
padding-left:0.4em;
|
||||
padding-top:0.8em;
|
||||
padding-bottom:0.8em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.menu {
|
||||
letter-spacing: 1px;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
background-color:#333;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.menu_vertical {
|
||||
padding-left: 0px;
|
||||
margin-bottom:0px;
|
||||
}
|
||||
|
||||
.contenu {
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.bouton {
|
||||
transition:color .0s;
|
||||
}
|
||||
|
||||
#bouton {
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
height: 24px;
|
||||
width: 200px;
|
||||
background-color: #000000;
|
||||
border:none;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
#bouton:hover {
|
||||
background-color: #494949;
|
||||
font-weight:bold;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width:600px) and (max-width: 1399px){
|
||||
|
||||
#footer {
|
||||
border: 1px solid black;
|
||||
width: 99%;
|
||||
height: 30%;
|
||||
margin: auto;
|
||||
margin-top: 50px;
|
||||
padding: 5px;
|
||||
background-color: #888;
|
||||
font-size: 30px
|
||||
}
|
||||
|
||||
.footer {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
font-size: 25px
|
||||
}
|
||||
|
||||
#contenu {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.accueil {
|
||||
width: 100px;
|
||||
background-color: #212121;
|
||||
text-align: center;
|
||||
z-index:100;
|
||||
float: right;
|
||||
margin-top:1%;
|
||||
}
|
||||
|
||||
#accueil {
|
||||
color:white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#menu {
|
||||
text-decoration:none;
|
||||
color:white;
|
||||
}
|
||||
|
||||
#menu:hover {
|
||||
color:#a8a6a1;
|
||||
transition:color .2s;
|
||||
}
|
||||
|
||||
.corps {
|
||||
text-align:center;
|
||||
width: 90%;
|
||||
margin-top:0px;
|
||||
max-width: 1180px;
|
||||
margin:auto;
|
||||
background-color:white;
|
||||
z-index:10;
|
||||
}
|
||||
|
||||
.titre1 {
|
||||
font-family: 'Yrsa', serif;
|
||||
font-weight: 100;
|
||||
padding-top: 30px;
|
||||
margin: 0px;
|
||||
color:#333;
|
||||
padding-bottom: 0.3em;
|
||||
font-size:4em;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-top: 0px;
|
||||
background-color:#212121;
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
padding-left:0.4em;
|
||||
padding-top:0.8em;
|
||||
padding-bottom:0.8em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.menu {
|
||||
letter-spacing: 1px;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
background-color:#333;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.contenu {
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.bouton {
|
||||
transition:color .0s;
|
||||
}
|
||||
|
||||
#bouton {
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
height: 24px;
|
||||
width: 200px;
|
||||
background-color: #000000;
|
||||
border:none;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
#bouton:hover {
|
||||
background-color: #494949;
|
||||
font-weight:bold;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width:0px) and (max-width: 600px){
|
||||
|
||||
.derniermessage {
|
||||
width:18%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#footer {
|
||||
display: none;
|
||||
border: 1px solid black;
|
||||
width: 99%;
|
||||
height: 30%;
|
||||
margin: auto;
|
||||
margin-top: 50px;
|
||||
padding: 5px;
|
||||
background-color: #888;
|
||||
font-size: 30px
|
||||
}
|
||||
|
||||
.footer {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
font-size: 25px
|
||||
}
|
||||
|
||||
#contenu {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.accueil {
|
||||
width: 100px;
|
||||
background-color: #212121;
|
||||
text-align: center;
|
||||
z-index:100;
|
||||
float: right;
|
||||
margin-top:1%;
|
||||
}
|
||||
|
||||
#accueil {
|
||||
color:white;
|
||||
}
|
||||
|
||||
#menu {
|
||||
color:white;
|
||||
}
|
||||
|
||||
#menu:hover {
|
||||
color:#a8a6a1;
|
||||
transition:color .2s;
|
||||
}
|
||||
|
||||
.corps {
|
||||
text-align:center;
|
||||
width: 90%;
|
||||
margin-top:0px;
|
||||
max-width: 1180px;
|
||||
margin:auto;
|
||||
background-color:white;
|
||||
z-index:10;
|
||||
}
|
||||
|
||||
.titre1 {
|
||||
font-family: 'Yrsa', serif;
|
||||
font-weight: 100;
|
||||
padding-top: 30px;
|
||||
margin: 0px;
|
||||
color:#333;
|
||||
padding-bottom: 0.3em;
|
||||
font-size:2.5em;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-top: 0px;
|
||||
background-color:#212121;
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
padding-left:0.4em;
|
||||
padding-top:0.8em;
|
||||
padding-bottom:0.8em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.inscrit {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu {
|
||||
letter-spacing: 1px;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
background-color:#333;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.contenu {
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.bouton {
|
||||
transition:color .0s;
|
||||
}
|
||||
|
||||
.nombrevu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#bouton {
|
||||
font-family: 'Source Sans Pro', sans-serif;
|
||||
height: 24px;
|
||||
width: 200px;
|
||||
background-color: #000000;
|
||||
border:none;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
#bouton:hover {
|
||||
background-color: #494949;
|
||||
font-weight:bold;
|
||||
}
|
||||
.nombremessages {
|
||||
width:2%;
|
||||
display: none;
|
||||
}
|
||||
.nombresujets {
|
||||
width:2%;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
bd3ce016e6b2dec2a24522431bf10252a2054ebb
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require '/var/www/phpmailer/src/Exception.php';
|
||||
require '/var/www/phpmailer/src/PHPMailer.php';
|
||||
require '/var/www/phpmailer/src/SMTP.php';
|
||||
|
||||
function erreur($err='') {
|
||||
$mess=($err!='')? $err:'Une erreur inconnue s\'est produite';
|
||||
exit('<p>'.$mess.'</p>
|
||||
<p>Cliquez <a href="./index.php">ici</a> pour revenir à la page d\'accueil</p></div></body></html>');
|
||||
}
|
||||
|
||||
function move_avatar($avatar) {
|
||||
$extension_upload = strtolower(substr( strrchr($avatar['name'], '.') ,1));
|
||||
$name = time();
|
||||
$nomavatar = str_replace(' ','',$name).".".$extension_upload;
|
||||
$name = "./images/avatars/".str_replace(' ','',$name).".".$extension_upload;
|
||||
move_uploaded_file($avatar['tmp_name'],$name);
|
||||
return $nomavatar;
|
||||
}
|
||||
|
||||
function verif_auth($auth_necessaire) {
|
||||
$level=(isset($_SESSION['level']))?$_SESSION['level']:1;
|
||||
return ($auth_necessaire <= intval($level));
|
||||
}
|
||||
|
||||
//Fonction listant les pages
|
||||
function get_list_page($page, $nb_page, $link, $nb = 2){
|
||||
$list_page = array();
|
||||
for ($i=1; $i <= $nb_page; $i++){
|
||||
if (($i < $nb) OR ($i > $nb_page - $nb) OR (($i < $page + $nb) AND ($i > $page -$nb)))
|
||||
$list_page[] = ($i==$page)?'<strong>'.$i.'</strong>':'<a href="'.$link.'&page='.$i.'">'.$i.'</a>';
|
||||
else{
|
||||
if ($i >= $nb AND $i <= $page - $nb)
|
||||
$i = $page - $nb;
|
||||
elseif ($i >= $page + $nb AND $i <= $nb_page - $nb)
|
||||
$i = $nb_page - $nb;
|
||||
$list_page[] = '...';
|
||||
}
|
||||
}
|
||||
$print= implode('-', $list_page);
|
||||
return $print;
|
||||
}
|
||||
|
||||
function getrandom($taille) {
|
||||
$str = "123456789azertyuiopqsdfghjklmwxcvbn";
|
||||
$randstr = substr(str_shuffle($str), 0, $taille);
|
||||
return $randstr;
|
||||
}
|
||||
|
||||
function verifemail($uid, $email, $pseudo) {
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->SMTPDebug = 0;
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'smtp.ionos.fr';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = 'botmail@mail.nessar.fr';
|
||||
$mail->Password = '**REMOVED**';
|
||||
$mail->SMTPSecure = 'ssl';
|
||||
$mail->Port = 465;
|
||||
|
||||
$mail->setFrom('botmail@mail.nessar.fr', 'nessar.fr');
|
||||
$mail->addAddress($email, $pseudo);
|
||||
$mail->addReplyTo('nessar@mail.nessar.fr', 'Information');
|
||||
$mail->Subject = 'Verification de l\'E-mail';
|
||||
$mail->Body = '<!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" />
|
||||
<title>Verifiez votre E-mail</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="padding: 10px 0 30px 0;">
|
||||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border: 1px solid #cccccc; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#70bbd9" style="padding: 40px 0 30px 0; color: #153643; font-size: 28px; font-weight: bold; font-family: Arial, sans-serif;">
|
||||
<img src="http://ktfaction.fr/image/h1.gif" alt="Verifiez votre E-mail" width="300" height="230" style="display: block;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="color: #153643; font-family: Arial, sans-serif; font-size: 24px;">
|
||||
<b>Verifiez votre E-mail</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 20px 0 30px 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;">
|
||||
Cet E-mail vous a été envoyé car votre adresse E-mail a été renseigné sur ce site: <b><a style ="color: black;" href="http://ktfaction.fr">ktfaction.fr</a></b>, merci de l\'interet porté a mon site ! Pour verifer votre E-mail, cliquez sur ce <b><a style ="color: black;"href="https://ktfaction.fr/forum/verifemail.php?uid='.$uid.'">lien</a></b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#ee4c50" style="padding: 30px 30px 30px 30px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;" width="75%">
|
||||
® Nessar, France 2019<br/>
|
||||
</td>
|
||||
<td align="right" width="25%">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="font-family: Arial, sans-serif; font-size: 12px; font-weight: bold;">
|
||||
<a href="http://www.twitter.com/nessarhd" style="color: #ffffff;">
|
||||
<img src="http://ktfaction.fr/image/tw.gif" alt="Twitter" width="38" height="38" style="display: block;" border="0" />
|
||||
</a>
|
||||
</td>
|
||||
<td style="font-size: 0; line-height: 0;" width="20"> </td>
|
||||
<td style="font-family: Arial, sans-serif; font-size: 12px; font-weight: bold;">
|
||||
<a href="http://twitch.tv/nessarhd" style="color: #ffffff;">
|
||||
<img src="http://ktfaction.fr/image/fb.gif" alt="Twitch" width="38" height="38" style="display: block;" border="0" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>';
|
||||
$mail->AltBody = 'Cliquez sur ce lien pour verifier votre E-mail: http://ktfaction.fr/forum/verifemail.php?uid='.$uid.'';
|
||||
$mail->send();
|
||||
}
|
||||
|
||||
|
||||
function emailnotif($topic, $email, $pseudo) {
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->SMTPDebug = 0;
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'smtp.ionos.fr';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = 'botmail@mail.nessar.fr';
|
||||
$mail->Password = '**REMOVED**';
|
||||
$mail->SMTPSecure = 'ssl';
|
||||
$mail->Port = 465;
|
||||
|
||||
$mail->setFrom('botmail@mail.nessar.fr', 'nessar.fr');
|
||||
$mail->addAddress($email, $pseudo);
|
||||
$mail->addReplyTo('nessar@mail.nessar.fr', 'Information');
|
||||
$mail->Subject = 'Il y a du nouveau sur le forum !';
|
||||
$mail->Body = '<!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" />
|
||||
<title>Il y a du nouveau sur le forum !</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="padding: 10px 0 30px 0;">
|
||||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border: 1px solid #cccccc; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#70bbd9" style="padding: 40px 0 30px 0; color: #153643; font-size: 28px; font-weight: bold; font-family: Arial, sans-serif;">
|
||||
<img src="http://ktfaction.fr/image/h2.gif" alt="Nouveau message !" width="300" height="230" style="display: block;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="color: #153643; font-family: Arial, sans-serif; font-size: 24px;">
|
||||
<b>Il y a du nouveau sur le forum !</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 20px 0 30px 0; color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;">
|
||||
Bonjour '.$pseudo.', cet E-mail vous a été envoyé car vous êtes abonné a <b><a style ="color: black;" href="http://ktfaction.fr">ktfaction.fr</a></b>, merci de l\'interet porté a mon site ! Pour voir de quoi il s\'agit, cliquez sur ce <b><a style ="color: black;"href="http://ktfaction.fr/forum/voirtopic.php?t='.$topic.'">lien</a></b>. Merci et a bientot !
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#ee4c50" style="padding: 30px 30px 30px 30px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;" width="75%">
|
||||
® Nessar, France 2019<br/>
|
||||
</td>
|
||||
<td align="right" width="25%">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="font-family: Arial, sans-serif; font-size: 12px; font-weight: bold;">
|
||||
<a href="http://www.twitter.com/nessarhd" style="color: #ffffff;">
|
||||
<img src="http://ktfaction.fr/image/tw.gif" alt="Twitter" width="38" height="38" style="display: block;" border="0" />
|
||||
</a>
|
||||
</td>
|
||||
<td style="font-size: 0; line-height: 0;" width="20"> </td>
|
||||
<td style="font-family: Arial, sans-serif; font-size: 12px; font-weight: bold;">
|
||||
<a href="http://twitch.tv/nessarhd" style="color: #ffffff;">
|
||||
<img src="http://ktfaction.fr/image/fb.gif" alt="Twitch" width="38" height="38" style="display: block;" border="0" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td style="color: #AF2F33; font-family: Arial, sans-serif; font-size: 10px;" width="75%">
|
||||
Pour vous désinscrire cliquez <a style="color:#AF2F33" href="http://ktfaction.fr/forum/notifemail.php?action=delete&all=1&t='.$topic.'">ici</a><br/>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>';
|
||||
$mail->AltBody = 'Il y a du nouveau sur le forum ! Cliquez sur ce lien pour aller voir: http://ktfaction.fr/forum/voirtopic.php?t='.$topic.' . Pour vous désinscrire cliquez sur ce lien http://ktfaction.fr/forum/notifemail.php?action=delete&all=1&t='.$topic;
|
||||
$mail->send();
|
||||
}
|
||||
?>
|
||||
@@ -1 +0,0 @@
|
||||
ac929438e3184b3828c28fc4e3a8d82d6f82eae6
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
//Cette fonction doit être appelée avant tout code html
|
||||
session_start();
|
||||
|
||||
//On donne ensuite un titre à la page, puis on appelle notre fichier debut.php
|
||||
$titre = "Index du forum";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
echo'<i>Vous êtes ici : </i><a href ="./index.php">Index du forum</a>';
|
||||
|
||||
if ($id != 0) {
|
||||
$query=$db->prepare('SELECT COUNT(*) FROM `forum_email` WHERE `membre_id` = :id AND `forum_all` = 1');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$forumall = $query->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
if ($forumall > 0) {?>
|
||||
<a href="./notifemail.php?action=delete&all=1"><img src="./images/alarm.png" alt="go" style="float:right;"/></a><?php
|
||||
}
|
||||
else {?>
|
||||
<a href="./notifemail.php?action=add&all=1"><img src="./images/no-alarm.png" alt="go" style="float:right;"/></a><?php
|
||||
}
|
||||
}?>
|
||||
<h1>Forum</h1>
|
||||
<?php
|
||||
//Initialisation de deux variables
|
||||
$totaldesmessages = 0;
|
||||
$categorie = NULL;
|
||||
|
||||
//Cette requête permet d'obtenir tout sur le forum
|
||||
$query=$db->prepare('SELECT cat_id, cat_nom,
|
||||
forum_forum.forum_id, forum_name, forum_desc, forum_post, forum_topic, auth_view, forum_topic.topic_id, forum_topic.topic_post, post_id, post_time, post_createur, membre_pseudo,
|
||||
membre_id
|
||||
FROM forum_categorie
|
||||
LEFT JOIN forum_forum ON forum_categorie.cat_id = forum_forum.forum_cat_id
|
||||
LEFT JOIN forum_post ON forum_post.post_id = forum_forum.forum_last_post_id
|
||||
LEFT JOIN forum_topic ON forum_topic.topic_id = forum_post.topic_id
|
||||
LEFT JOIN forum_membres ON forum_membres.membre_id = forum_post.post_createur
|
||||
WHERE auth_view <= :lvl
|
||||
ORDER BY cat_ordre, forum_ordre DESC');
|
||||
$query->bindValue(':lvl',$lvl,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
?>
|
||||
<table>
|
||||
<?php
|
||||
//Début de la boucle
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
//On affiche chaque catégorie
|
||||
if( $categorie != $data['cat_id'] )
|
||||
{
|
||||
//Si c'est une nouvelle catégorie on l'affiche
|
||||
|
||||
$categorie = $data['cat_id'];
|
||||
?>
|
||||
<tr>
|
||||
<th class="ico"></th>
|
||||
<th class="titre"><strong><?php echo stripslashes(htmlspecialchars($data['cat_nom'])); ?>
|
||||
</strong></th>
|
||||
<th class="nombremessages"><strong>Sujets</strong></th>
|
||||
<th class="nombresujets"><strong>Messages</strong></th>
|
||||
<th class="derniermessage"><strong>Dernier message</strong></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
if (verif_auth($data['auth_view'])) {
|
||||
//Affichage des forums
|
||||
//Ici, on met le contenu de chaque catégorie
|
||||
// Ce super echo de la mort affiche tous
|
||||
// les forums en détail : description, nombre de réponses etc...
|
||||
|
||||
echo'<tr><td><center><img src="./images/message.png" alt="message" /></center></td>
|
||||
<td class="titre"><strong>
|
||||
<a href="./voirforum.php?f='.$data['forum_id'].'">
|
||||
'.stripslashes(htmlspecialchars($data['forum_name'])).'</a></strong>
|
||||
<br />'.nl2br(stripslashes(htmlspecialchars($data['forum_desc']))).'</td>
|
||||
<td class="nombresujets">'.$data['forum_topic'].'</td>
|
||||
<td class="nombremessages">'.$data['forum_post'].'</td>';
|
||||
|
||||
// Deux cas possibles :
|
||||
// Soit il y a un nouveau message, soit le forum est vide
|
||||
if (!empty($data['forum_post'])) {
|
||||
//Selection dernier message
|
||||
$nombreDeMessagesParPage = 15;
|
||||
$nbr_post = $data['topic_post'] +1;
|
||||
$page = ceil($nbr_post / $nombreDeMessagesParPage);
|
||||
|
||||
echo'<td class="derniermessage">
|
||||
'.date('H\hi \l\e d/m/Y',$data['post_time']).'<br />
|
||||
<a href="./voirprofil.php?m='.stripslashes(htmlspecialchars($data['membre_id'])).'&action=consulter">'.$data['membre_pseudo'].' </a>
|
||||
<a href="./voirtopic.php?t='.$data['topic_id'].'&page='.$page.'#p_'.$data['post_id'].'">
|
||||
<img src="./images/ok.png" alt="go" style="width: 16px" /></a></td></tr>';
|
||||
|
||||
}
|
||||
else {
|
||||
echo'<td class="nombremessages">Pas de message</td></tr>';
|
||||
}
|
||||
}
|
||||
//Cette variable stock le nombre de messages, on la met à jour
|
||||
$totaldesmessages += $data['forum_post'];
|
||||
|
||||
//On ferme notre boucle et nos balises
|
||||
} //fin de la boucle
|
||||
$query->CloseCursor();
|
||||
echo '</table></div>';
|
||||
|
||||
//Le pied de page ici :
|
||||
echo'<div id="footer"><h2 class="footer" style="margin-top: 0px">Qui est en ligne ?</h2>';
|
||||
|
||||
//On compte les membres
|
||||
$TotalDesMembres = $db->query('SELECT COUNT(*) FROM forum_membres')->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
$query = $db->query('SELECT membre_pseudo, membre_id FROM forum_membres ORDER BY membre_id DESC LIMIT 0, 1');
|
||||
$data = $query->fetch();
|
||||
$derniermembre = stripslashes(htmlspecialchars($data['membre_pseudo']));
|
||||
|
||||
|
||||
echo'<p class="footer">Le total des messages du forum est <strong>'.$totaldesmessages.'</strong>.<br />';
|
||||
echo'Le site et le forum comptent <strong>'.$TotalDesMembres.'</strong> membres.<br />';
|
||||
echo'Le dernier membre est <a href="./voirprofil.php?m='.$data['membre_id'].'&action=consulter">'.$derniermembre.'</a>.</p>';
|
||||
$query->CloseCursor();
|
||||
//Initialisation de la variable
|
||||
$count_online = 0;
|
||||
|
||||
//Décompte des visiteurs
|
||||
$count_visiteurs=$db->query('SELECT COUNT(*) AS nbr_visiteurs FROM forum_whosonline WHERE online_id = 0')->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Décompte des membres
|
||||
$texte_a_afficher = "<br />Liste des personnes en ligne : ";
|
||||
$time_max = time() - (60 * 5);
|
||||
$query=$db->prepare('SELECT membre_id, membre_pseudo
|
||||
FROM forum_whosonline
|
||||
LEFT JOIN forum_membres ON online_id = membre_id
|
||||
WHERE online_time > :timemax AND online_id <> 0');
|
||||
$query->bindValue(':timemax',$time_max, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$count_membres=0;
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
$count_membres ++;
|
||||
$texte_a_afficher .= '<a class="footer" href="./voirprofil.php?m='.$data['membre_id'].'&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a> ,';
|
||||
}
|
||||
|
||||
$texte_a_afficher = substr($texte_a_afficher, 0, -1);
|
||||
$count_online = $count_visiteurs + $count_membres;
|
||||
echo'<p class="footer">Vous pouvez voir la liste complète des membres: <a href="./memberlist.php">ICI</a><br/>';
|
||||
echo 'Il y a '.$count_online.' connectés ('.$count_membres.' membres et '.$count_visiteurs.' invités)';
|
||||
echo $texte_a_afficher.'</p>';
|
||||
$query->CloseCursor();
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
0612cc3a5c77fd9ff4896c056a28307d0b7f6e3d
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Messages Privés";
|
||||
$balises = true;
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
include("includes/bbcode.php");
|
||||
include("includes/menu.php");
|
||||
|
||||
$action = (isset($_GET['action']))?htmlspecialchars($_GET['action']):'';
|
||||
|
||||
switch($action) { //On switch sur $action
|
||||
case "consulter": //Si on veut lire un message
|
||||
|
||||
echo'<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./messagesprives.php">Messagerie privée</a> --> Consulter un message</p>';
|
||||
$id_mess = (int) $_GET['id']; //On récupère la valeur de l'id
|
||||
echo '<h1>Consulter un message</h1><br /><br />';
|
||||
|
||||
//La requête nous permet d'obtenir les infos sur ce message :
|
||||
$query = $db->prepare('SELECT mp_expediteur, mp_receveur, mp_titre,
|
||||
mp_time, mp_text, mp_lu, membre_id, membre_pseudo, membre_avatar,
|
||||
membre_localisation, membre_inscrit, membre_post, membre_signature
|
||||
FROM forum_mp
|
||||
LEFT JOIN forum_membres ON membre_id = mp_expediteur
|
||||
WHERE mp_id = :id');
|
||||
$query->bindValue(':id',$id_mess,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
// Attention ! Seul le receveur du mp peut le lire !
|
||||
if ($id != $data['mp_receveur']) erreur(ERR_WRONG_USER);
|
||||
|
||||
//bouton de réponse
|
||||
echo'<p><a href="./messagesprives.php?action=repondre&dest='.$data['mp_expediteur'].'">
|
||||
<img src="./images/answer.png" alt="Répondre"
|
||||
title="Répondre à ce message" /></a></p>';
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<th class="vt_auteur"><strong>Auteur</strong></th>
|
||||
<th class="vt_mess"><strong>Message</strong></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo'<strong>
|
||||
<a href="./voirprofil.php?m='.$data['membre_id'].'&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a></strong></td>
|
||||
<td>Posté à '.date('H\hi \l\e d m Y',$data['mp_time']).'</td>';
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
//Ici des infos sur le membre qui a envoyé le mp
|
||||
echo'<p><img src="./images/avatars/'.$data['membre_avatar'].'" alt="" />
|
||||
<br />Membre inscrit le '.date('d/m/Y',$data['membre_inscrit']).'
|
||||
<br />Messages : '.$data['membre_post'].'
|
||||
<br />Localisation : '.stripslashes(htmlspecialchars($data['membre_localisation'])).'</p>
|
||||
</td><td>';
|
||||
|
||||
echo code(nl2br(stripslashes(htmlspecialchars($data['mp_text'])))).'
|
||||
<hr />'.code(nl2br(stripslashes(htmlspecialchars($data['membre_signature'])))).'
|
||||
</td></tr></table>';
|
||||
if ($data['mp_lu'] == 0) //Si le message n'a jamais été lu
|
||||
{
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('UPDATE forum_mp
|
||||
SET mp_lu = :lu
|
||||
WHERE mp_id= :id');
|
||||
$query->bindValue(':id',$id_mess, PDO::PARAM_INT);
|
||||
$query->bindValue(':lu','1', PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
break; //La fin !
|
||||
case "nouveau": //Nouveau mp
|
||||
|
||||
echo'<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./messagesprives.php">Messagerie privée</a> --> Ecrire un message</p>';
|
||||
echo '<h1>Nouveau message privé</h1><br /><br />';
|
||||
?>
|
||||
<form method="post" action="postok.php?action=nouveaump" name="formulaire">
|
||||
<p>
|
||||
<label for="to">Envoyer à : </label>
|
||||
<input type="text" size="30" id="to" name="to" />
|
||||
<br />
|
||||
<label for="titre">Titre : </label>
|
||||
<input style="width: 98%" type="text" size="80" id="titre" name="titre" />
|
||||
<br /><br />
|
||||
<?php include("includes/text.php") ?>
|
||||
<fieldset><legend>Message</legend>
|
||||
<textarea style="width: 98%" cols="80" rows="8" id="message" name="message"></textarea>
|
||||
</fieldset>
|
||||
<br />
|
||||
<input type="submit" name="submit" value="Envoyer" />
|
||||
<input type="reset" name="Effacer" value="Effacer" /></p>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
case "repondre": //On veut répondre
|
||||
echo'<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./messagesprives.php">Messagerie privée</a> --> Ecrire un message</p>';
|
||||
echo '<h1>Répondre à un message privé</h1><br /><br />';
|
||||
|
||||
$dest = (int) $_GET['dest'];
|
||||
?>
|
||||
<form method="post" action="postok.php?action=repondremp&dest=<?php echo $dest ?>" name="formulaire">
|
||||
<p>
|
||||
<label for="titre">Titre : </label><input style="width: 98%" type="text" size="80" id="titre" name="titre" />
|
||||
<br /><br />
|
||||
<input type="button" id="gras" name="gras" value="Gras" onClick="javascript:bbcode('[g]', '[/g]');return(false)" />
|
||||
<input type="button" id="italic" name="italic" value="Italic" onClick="javascript:bbcode('[i]', '[/i]');return(false)" />
|
||||
<input type="button" id="souligné" name="souligné" value="Souligné" onClick="javascript:bbcode('[s]', '[/s]');return(false)" />
|
||||
<input type="button" id="lien" name="lien" value="Lien" onClick="javascript:bbcode('[url]', '[/url]');return(false)" />
|
||||
<br /><br />
|
||||
<?php include("includes/text.php") ?>
|
||||
<br /><br />
|
||||
<fieldset><legend>Message</legend>
|
||||
<textarea style="width: 98%" cols="80" rows="8" id="message" name="message"></textarea>
|
||||
</fieldset>
|
||||
<br />
|
||||
<input type="submit" name="submit" value="Envoyer" />
|
||||
<input type="reset" name="Effacer" value="Effacer"/>
|
||||
</p></form>
|
||||
<?php
|
||||
break;
|
||||
case "supprimer":
|
||||
|
||||
//On récupère la valeur de l'id
|
||||
$id_mess = (int) $_GET['id'];
|
||||
//Il faut vérifier que le membre est bien celui qui a reçu le message
|
||||
$query=$db->prepare('SELECT mp_receveur
|
||||
FROM forum_mp WHERE mp_id = :id');
|
||||
$query->bindValue(':id',$id_mess,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
//Sinon la sanction est terrible :p
|
||||
if ($id != $data['mp_receveur']) erreur(ERR_WRONG_USER);
|
||||
$query->CloseCursor();
|
||||
|
||||
//2 cas pour cette partie : on est sûr de supprimer ou alors on ne l'est pas
|
||||
$sur = (int) $_GET['sur'];
|
||||
//Pas encore certain
|
||||
if ($sur == 0)
|
||||
{
|
||||
echo'<p>Etes-vous certain de vouloir supprimer ce message ?<br />
|
||||
<a href="./messagesprives.php?action=supprimer&id='.$id_mess.'&sur=1">
|
||||
Oui</a> - <a href="./messagesprives.php">Non</a></p>';
|
||||
}
|
||||
//Certain
|
||||
else
|
||||
{
|
||||
$query=$db->prepare('DELETE from forum_mp WHERE mp_id = :id');
|
||||
$query->bindValue(':id',$id_mess,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
echo'<p>Le message a bien été supprimé.<br />
|
||||
Cliquez <a href="./messagesprives.php">ici</a> pour revenir à la boite
|
||||
de messagerie.</p>';
|
||||
}
|
||||
|
||||
break;
|
||||
//Si rien n'est demandé ou s'il y a une erreur dans l'url
|
||||
//On affiche la boite de mp.
|
||||
default;
|
||||
|
||||
echo'<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> <a href="./messagesprives.php">Messagerie privée</a>';
|
||||
echo '<h1>Messagerie Privée</h1>';
|
||||
|
||||
$query=$db->prepare('SELECT mp_lu, mp_id, mp_expediteur, mp_titre, mp_time, membre_id, membre_pseudo
|
||||
FROM forum_mp
|
||||
LEFT JOIN forum_membres ON forum_mp.mp_expediteur = forum_membres.membre_id
|
||||
WHERE mp_receveur = :id ORDER BY mp_id DESC');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
echo'<p><a href="./messagesprives.php?action=nouveau">
|
||||
<img src="./images/new.png" alt="Nouveau" title="Nouveau message" />
|
||||
</a></p>';
|
||||
if ($query->rowCount()>0)
|
||||
{
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="mp_titre"><strong>Titre</strong></th>
|
||||
<th class="mp_expediteur"><strong>Expéditeur</strong></th>
|
||||
<th class="mp_time"><strong>Date</strong></th>
|
||||
<th><strong>Action</strong></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
//On boucle et on remplit le tableau
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
echo'<tr>';
|
||||
//Mp jamais lu, on affiche l'icone en question
|
||||
if($data['mp_lu'] == 0)
|
||||
{
|
||||
echo'<td><img src="./images/nonlu.png" alt="Non lu" /></td>';
|
||||
}
|
||||
else //sinon une autre icone
|
||||
{
|
||||
echo'<td><img src="./images/lu.png" alt="Déja lu" /></td>';
|
||||
}
|
||||
echo'<td id="mp_titre">
|
||||
<a href="./messagesprives.php?action=consulter&id='.$data['mp_id'].'">
|
||||
'.stripslashes(htmlspecialchars($data['mp_titre'])).'</a></td>
|
||||
<td id="mp_expediteur">
|
||||
<a href="./voirprofil.php?action=consulter&m='.$data['membre_id'].'">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a></td>
|
||||
<td id="mp_time">'.date('H\hi \l\e d m Y',$data['mp_time']).'</td>
|
||||
<td>
|
||||
<a href="./messagesprives.php?action=supprimer&id='.$data['mp_id'].'&sur=0">supprimer</a></td></tr>';
|
||||
} //Fin de la boucle
|
||||
$query->CloseCursor();
|
||||
echo '</table>';
|
||||
|
||||
} //Fin du if
|
||||
else
|
||||
{
|
||||
echo'<p>Vous n\'avez aucun message privé pour l\'instant, cliquez
|
||||
<a href="./index.php">ici</a> pour revenir à la page d index</p>';
|
||||
}
|
||||
} //Fin du switch
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
791f968035a9befe75081affcfe5159c7ee7f4fc
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Poster";
|
||||
$balises = true;
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
//Qu'est ce qu'on veut faire ? poster, répondre ou éditer ?
|
||||
$action = (isset($_GET['action']))?htmlspecialchars($_GET['action']):'';
|
||||
|
||||
//Il faut être connecté pour poster !
|
||||
if ($id==0) erreur(ERR_IS_NOT_CO);
|
||||
|
||||
//Si on veut poster un nouveau topic, la variable f se trouve dans l'url,
|
||||
//On récupère certaines valeurs
|
||||
if (isset($_GET['f']))
|
||||
{
|
||||
$forum = (int) $_GET['f'];
|
||||
$query= $db->prepare('SELECT forum_name, auth_view, auth_post, auth_topic, auth_annonce, auth_modo
|
||||
FROM forum_forum WHERE forum_id =:forum');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> -->
|
||||
<a href="./voirforum.php?f='.$_GET['f'].'">'.stripslashes(htmlspecialchars($data['forum_name'])).'</a>
|
||||
--> Nouveau topic</p>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Sinon c'est un nouveau message, on a la variable t et
|
||||
//On récupère f grâce à une requête
|
||||
elseif (isset($_GET['t']))
|
||||
{
|
||||
$topic = (int) $_GET['t'];
|
||||
$query=$db->prepare('SELECT topic_titre, forum_topic.forum_id,
|
||||
forum_name, auth_view, auth_post, auth_topic, auth_annonce, auth_modo
|
||||
FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = forum_topic.forum_id
|
||||
WHERE topic_id =:topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$forum = $data['forum_id'];
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> -->
|
||||
<a href="./voirforum.php?f='.$data['forum_id'].'">'.stripslashes(htmlspecialchars($data['forum_name'])).'</a>
|
||||
--> <a href="./voirtopic.php?t='.$topic.'">'.stripslashes(htmlspecialchars($data['topic_titre'])).'</a>
|
||||
--> Répondre</p>';
|
||||
}
|
||||
|
||||
//Enfin sinon c'est au sujet de la modération(on verra plus tard en détail)
|
||||
//On ne connait que le post, il faut chercher le reste
|
||||
elseif (isset ($_GET['p']))
|
||||
{
|
||||
$post = (int) $_GET['p'];
|
||||
$query=$db->prepare('SELECT post_createur, forum_post.topic_id, topic_titre, forum_topic.forum_id,
|
||||
forum_name, auth_view, auth_post, auth_topic, auth_annonce, auth_modo
|
||||
FROM forum_post
|
||||
LEFT JOIN forum_topic ON forum_topic.topic_id = forum_post.topic_id
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = forum_topic.forum_id
|
||||
WHERE forum_post.post_id =:post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
$topic = $data['topic_id'];
|
||||
$forum = $data['forum_id'];
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> -->
|
||||
<a href="./voirforum.php?f='.$data['forum_id'].'">'.stripslashes(htmlspecialchars($data['forum_name'])).'</a>
|
||||
--> <a href="./voirtopic.php?t='.$topic.'">'.stripslashes(htmlspecialchars($data['topic_titre'])).'</a>
|
||||
--> Modérer un message</p>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
if (!verif_auth($data['auth_view'])) erreur(ERR_AUTH_VIEW);
|
||||
|
||||
switch($action) {
|
||||
|
||||
case "delete": //Si on veut supprimer le post
|
||||
//On récupère la valeur de p
|
||||
$post = (int) $_GET['p'];
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici
|
||||
echo'<h1>Suppression</h1>';
|
||||
$query=$db->prepare('SELECT post_createur, auth_modo
|
||||
FROM forum_post
|
||||
LEFT JOIN forum_forum ON forum_post.post_forum_id = forum_forum.forum_id
|
||||
WHERE post_id= :post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
|
||||
if (!verif_auth($data['auth_modo']) && $data['post_createur'] != $id)
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_DELETE);
|
||||
}
|
||||
else //Sinon ça roule et on affiche la suite
|
||||
{
|
||||
echo'<p>Êtes vous certains de vouloir supprimer ce post ?</p>';
|
||||
echo'<p><a href="./postok.php?action=delete&p='.$post.'">Oui</a> ou <a href="./index.php">Non</a></p>';
|
||||
}
|
||||
$query->CloseCursor();
|
||||
break;
|
||||
|
||||
case "edit": //Si on veut éditer le post
|
||||
//On récupère la valeur de p
|
||||
$post = (int) $_GET['p'];
|
||||
echo'<h1>Edition</h1>';
|
||||
|
||||
//On lance enfin notre requête
|
||||
|
||||
$query=$db->prepare('SELECT post_createur, post_texte, auth_modo FROM forum_post
|
||||
LEFT JOIN forum_forum ON forum_post.post_forum_id = forum_forum.forum_id
|
||||
WHERE post_id=:post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
$text_edit = $data['post_texte']; //On récupère le message
|
||||
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici (soit le créateur soit un modo/admin)
|
||||
if (!verif_auth($data['auth_modo']) && $data['post_createur'] != $id)
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_EDIT);
|
||||
}
|
||||
else //Sinon ça roule et on affiche la suite
|
||||
{
|
||||
//Le formulaire de postage
|
||||
?><form method="post" action="postok.php?action=edit&p=<?php echo $post ?>" name="formulaire"><?php
|
||||
include("./includes/text.php")
|
||||
?>
|
||||
<fieldset><legend>Message</legend><textarea cols="80" rows="8" id="message" name="message"><?php echo $text_edit ?>
|
||||
</textarea>
|
||||
</fieldset>
|
||||
<p>
|
||||
<input type="submit" name="submit" value="Editer !" />
|
||||
<input type="reset" name = "Effacer" value = "Effacer"/></p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
}
|
||||
break; //Fin de ce cas :o
|
||||
|
||||
case "repondre": //Premier cas on souhaite répondre
|
||||
if (!verif_auth($data['auth_post'])) erreur(ERR_AUTH_POST);
|
||||
|
||||
?>
|
||||
<h1>Poster une réponse</h1>
|
||||
|
||||
<form method="post" action="postok.php?action=repondre&t=<?php echo $topic ?>" name="formulaire">
|
||||
<?php include("includes/text.php") ?>
|
||||
<fieldset><legend>Message</legend><textarea cols="80" rows="8" id="message" name="message">
|
||||
</textarea>
|
||||
</fieldset>
|
||||
<p>
|
||||
<input type="submit" name="submit" value="Répondre !" />
|
||||
<input type="reset" name = "Effacer" value = "Effacer"/></p>
|
||||
</form>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case "nouveautopic":
|
||||
if (!verif_auth($data['auth_topic'])) erreur(ERR_AUTH_TOPIC);
|
||||
|
||||
?>
|
||||
|
||||
<h1>Nouveau topic</h1>
|
||||
<form method="post" action="postok.php?action=nouveautopic&f=<?php echo $forum ?>" name="formulaire">
|
||||
|
||||
<fieldset><legend>Titre</legend>
|
||||
<input style="width: 98%" type="text" size="80" id="titre" name="titre" /></fieldset>
|
||||
<?php include("includes/text.php") ?>
|
||||
<fieldset><legend>Message</legend>
|
||||
<textarea style="width: 98%" cols=80 rows=8 id="message" name="message"></textarea>
|
||||
<br />
|
||||
|
||||
<?php
|
||||
if (verif_auth($data['auth_annonce'])) {
|
||||
?>
|
||||
<label><input type="radio" name="mess" value="Annonce" />Annonce</label>
|
||||
<label><input type="radio" name="mess" value="Message" checked/>Topic</label>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
echo'<input type="radio" name="mess" value="Message" checked/>Topic<br/>';
|
||||
}
|
||||
?>
|
||||
<br/>
|
||||
<input type="submit" name="submit" value="Envoyer" />
|
||||
<input type="reset" name ="Effacer" value ="Effacer" />
|
||||
</form></p>
|
||||
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
//D'autres cas viendront s'ajouter ici par la suite
|
||||
|
||||
default: //Si jamais c'est aucun de ceux là c'est qu'il y a eu un problème :o
|
||||
echo'<p>Cette action est impossible</p>';
|
||||
} //Fin du switch
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
f9f346b99adce0392bf0dce99ac31be72b785d0f
|
||||
@@ -0,0 +1,881 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Poster";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
//On récupère la valeur de la variable action
|
||||
$action = (isset($_GET['action']))?htmlspecialchars($_GET['action']):'';
|
||||
|
||||
// Si le membre n'est pas connecté, il est arrivé ici par erreur
|
||||
if ($id==0) erreur(ERR_IS_NOT_CO);
|
||||
|
||||
switch($action) {
|
||||
|
||||
case "delete": //Si on veut supprimer le post
|
||||
//On récupère la valeur de p
|
||||
$post = (int) $_GET['p'];
|
||||
$query=$db->prepare('SELECT post_createur, post_texte, forum_id, topic_id, auth_modo
|
||||
FROM forum_post
|
||||
LEFT JOIN forum_forum ON forum_post.post_forum_id = forum_forum.forum_id
|
||||
WHERE post_id=:post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$topic = $data['topic_id'];
|
||||
$forum = $data['forum_id'];
|
||||
$poster = $data['post_createur'];
|
||||
|
||||
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici
|
||||
//(soit le créateur soit un modo/admin)
|
||||
if (!verif_auth($data['auth_modo']) && $poster != $id)
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_DELETE);
|
||||
}
|
||||
else //Sinon ça roule et on continue
|
||||
{
|
||||
|
||||
//Ici on vérifie plusieurs choses :
|
||||
//est-ce un premier post ? Dernier post ou post classique ?
|
||||
|
||||
$query = $db->prepare('SELECT topic_first_post, topic_last_post FROM forum_topic
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data_post=$query->fetch();
|
||||
|
||||
|
||||
|
||||
//On distingue maintenant les cas
|
||||
if ($data_post['topic_first_post']==$post) //Si le message est le premier
|
||||
{
|
||||
|
||||
//Les autorisations ont changé !
|
||||
//Normal, seul un modo peut décider de supprimer tout un topic
|
||||
if (!verif_auth($data['auth_modo']))
|
||||
{
|
||||
erreur('ERR_AUTH_DELETE_TOPIC');
|
||||
}
|
||||
|
||||
//Il faut s'assurer que ce n'est pas une erreur
|
||||
|
||||
echo'<p>Vous avez choisi de supprimer un post.
|
||||
Cependant ce post est le premier du topic. Voulez vous supprimer le topic ? <br />
|
||||
<a href="./postok.php?action=delete_topic&t='.$topic.'">oui</a> - <a href="./voirtopic.php?t='.$topic.'">non</a>
|
||||
</p>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
elseif ($data_post['topic_last_post']==$post) //Si le message est le dernier
|
||||
{
|
||||
|
||||
//On supprime le post
|
||||
$query=$db->prepare('DELETE FROM forum_post WHERE post_id = :post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On modifie la valeur de topic_last_post pour cela on
|
||||
//récupère l'id du plus récent message de ce topic
|
||||
$query=$db->prepare('SELECT post_id FROM forum_post WHERE topic_id = :topic
|
||||
ORDER BY post_id DESC LIMIT 0,1');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$last_post_topic=$data['post_id'];
|
||||
$query->CloseCursor();
|
||||
|
||||
//On fait de même pour forum_last_post_id
|
||||
$query=$db->prepare('SELECT post_id FROM forum_post WHERE post_forum_id = :forum
|
||||
ORDER BY post_id DESC LIMIT 0,1');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$last_post_forum=$data['post_id'];
|
||||
$query->CloseCursor();
|
||||
|
||||
//On met à jour la valeur de topic_last_post
|
||||
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_last_post = :last
|
||||
WHERE topic_last_post = :post');
|
||||
$query->bindValue(':last',$last_post_topic,PDO::PARAM_INT);
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève 1 au nombre de messages du forum et on met à
|
||||
//jour forum_last_post
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post - 1, forum_last_post_id = :last
|
||||
WHERE forum_id = :forum');
|
||||
$query->bindValue(':last',$last_post_forum,PDO::PARAM_INT);
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève 1 au nombre de messages du topic
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_post = topic_post - 1
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève 1 au nombre de messages du membre
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_post = membre_post - 1
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':id',$poster,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Enfin le message
|
||||
echo'<p>Le message a bien été supprimé !<br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'">ici</a> pour retourner au topic<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum</p>';
|
||||
|
||||
}
|
||||
else // Si c'est un post classique
|
||||
{
|
||||
|
||||
//On supprime le post
|
||||
$query=$db->prepare('DELETE FROM forum_post WHERE post_id = :post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève 1 au nombre de messages du forum
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post - 1 WHERE forum_id = :forum');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève 1 au nombre de messages du topic
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_post = topic_post - 1
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève 1 au nombre de messages du membre
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_post = membre_post - 1
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':id',$data['post_createur'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Enfin le message
|
||||
echo'<p>Le message a bien été supprimé !<br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'">ici</a> pour retourner au topic<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum</p>';
|
||||
}
|
||||
|
||||
} //Fin du else
|
||||
break;
|
||||
|
||||
case "delete_topic":
|
||||
$topic = (int) $_GET['t'];
|
||||
$query=$db->prepare('SELECT forum_topic.forum_id, auth_modo
|
||||
FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_topic.forum_id = forum_forum.forum_id
|
||||
WHERE topic_id=:topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$forum = $data['forum_id'];
|
||||
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici
|
||||
//c'est-à-dire si c'est un modo / admin
|
||||
|
||||
if (!verif_auth($data['auth_modo']))
|
||||
{
|
||||
erreur('ERR_AUTH_DELETE_TOPIC');
|
||||
}
|
||||
else //Sinon ça roule et on continue
|
||||
{
|
||||
$query->CloseCursor();
|
||||
|
||||
//On compte le nombre de post du topic
|
||||
$query=$db->prepare('SELECT topic_post FROM forum_topic WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$nombrepost = $data['topic_post'] + 1;
|
||||
$query->CloseCursor();
|
||||
|
||||
//On supprime le topic
|
||||
$query=$db->prepare('DELETE FROM forum_topic
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On enlève le nombre de post posté par chaque membre dans le topic
|
||||
$query=$db->prepare('SELECT post_createur, COUNT(*) AS nombre_mess FROM forum_post
|
||||
WHERE topic_id = :topic GROUP BY post_createur');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
while($data = $query->fetch())
|
||||
{
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_post = membre_post - :mess
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':mess',$data['nombre_mess'],PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$data['post_createur'],PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
$query->CloseCursor();
|
||||
//Et on supprime les posts !
|
||||
$query=$db->prepare('DELETE FROM forum_post WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Dernière chose, on récupère le dernier post du forum
|
||||
$query=$db->prepare('SELECT post_id FROM forum_post
|
||||
WHERE post_forum_id = :forum ORDER BY post_id DESC LIMIT 0,1');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$last=(isset($data['post_id']))?$data['post_id']:0;
|
||||
|
||||
//Ensuite on modifie certaines valeurs :
|
||||
$query=$db->prepare('UPDATE forum_forum
|
||||
SET forum_topic = forum_topic - 1, forum_post = forum_post - :nbr, forum_last_post_id = :id
|
||||
WHERE forum_id = :forum');
|
||||
$query->bindValue(':nbr',$nombrepost,PDO::PARAM_INT);
|
||||
$query->bindValue(':id',$last,PDO::PARAM_INT);
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Enfin le message
|
||||
echo'<p>Le topic a bien été supprimé !<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum</p>';
|
||||
|
||||
} //Fin du else
|
||||
break;
|
||||
|
||||
case "lock": //Si on veut verrouiller le topic
|
||||
//On récupère la valeur de t
|
||||
$topic = (int) $_GET['t'];
|
||||
$query = $db->prepare('SELECT forum_topic.forum_id, auth_modo FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = forum_topic.forum_id
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici
|
||||
if (!verif_auth($data['auth_modo']))
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_VERR);
|
||||
}
|
||||
else //Sinon ça roule et on continue
|
||||
{
|
||||
//On met à jour la valeur de topic_locked
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_locked = :lock WHERE topic_id = :topic');
|
||||
$query->bindValue(':lock',1,PDO::PARAM_STR);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
echo'<p>Le topic a bien été verrouillé ! <br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'">ici</a> pour retourner au topic<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum</p>';
|
||||
}
|
||||
break;
|
||||
|
||||
case "unlock": //Si on veut déverrouiller le topic
|
||||
//On récupère la valeur de t
|
||||
$topic = (int) $_GET['t'];
|
||||
$query = $db->prepare('SELECT forum_topic.forum_id, auth_modo FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = forum_topic.forum_id
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici
|
||||
if (!verif_auth($data['auth_modo']))
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_VERR);
|
||||
}
|
||||
else //Sinon ça roule et on continue
|
||||
{
|
||||
//On met à jour la valeur de topic_locked
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_locked = :lock WHERE topic_id = :topic');
|
||||
$query->bindValue(':lock',0,PDO::PARAM_STR);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
echo'<p>Le topic a bien été déverrouillé !<br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'">ici</a> pour retourner au topic<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum</p>';
|
||||
}
|
||||
break;
|
||||
|
||||
case "edit": //Si on veut éditer le post
|
||||
//On récupère la valeur de p
|
||||
$post = (int) $_GET['p'];
|
||||
|
||||
//On récupère le message
|
||||
$message = $_POST['message'];
|
||||
|
||||
//Ensuite on vérifie que le membre a le droit d'être ici (soit le créateur soit un modo/admin)
|
||||
$query=$db->prepare('SELECT post_createur, post_texte, post_time, topic_id, auth_modo
|
||||
FROM forum_post
|
||||
LEFT JOIN forum_forum ON forum_post.post_forum_id = forum_forum.forum_id
|
||||
WHERE post_id=:post');
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data1 = $query->fetch();
|
||||
$topic = $data1['topic_id'];
|
||||
|
||||
//On récupère la place du message dans le topic (pour le lien)
|
||||
$query = $db->prepare('SELECT COUNT(*) AS nbr FROM forum_post
|
||||
WHERE topic_id = :topic AND post_time < '.$data1['post_time']);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data2=$query->fetch();
|
||||
|
||||
if (!verif_auth($data1['auth_modo'])&& $data1['post_createur'] != $id)
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_EDIT);
|
||||
}
|
||||
else //Sinon ça roule et on continue
|
||||
{
|
||||
$query=$db->prepare('UPDATE forum_post SET post_texte = :message WHERE post_id = :post');
|
||||
$query->bindValue(':message',$message,PDO::PARAM_STR);
|
||||
$query->bindValue(':post',$post,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$nombreDeMessagesParPage = 15;
|
||||
$nbr_post = $data2['nbr']+1;
|
||||
$page = ceil($nbr_post / $nombreDeMessagesParPage);
|
||||
echo'<p>Votre message a bien été édité!<br /><br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum<br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'&page='.$page.'#p_'.$post.'">ici</a> pour le voir</p>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
//Premier cas : nouveau topic
|
||||
case "nouveautopic":
|
||||
$query=$db->prepare('SELECT auth_annonce, auth_topic FORM forum_forum WHERE forum_id = '.$_GET['f'].'');
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
if (!verif_auth($data['auth_topic'])) erreur(ERR_AUTH_TOPIC);
|
||||
if (!verif_auth($data['auth_annonce']) && isset($_POST['mess'])) {
|
||||
exit('</div></body></html>');
|
||||
}
|
||||
$query->CloseCursor();
|
||||
|
||||
//On passe le message dans une série de fonction
|
||||
$message = $_POST['message'];
|
||||
$mess = $_POST['mess'];
|
||||
|
||||
//Pareil pour le titre
|
||||
$titre = $_POST['titre'];
|
||||
|
||||
//ici seulement, maintenant qu'on est sur qu'elle existe, on récupère la valeur de la variable f
|
||||
$forum = (int) $_GET['f'];
|
||||
$temps = time();
|
||||
|
||||
if (empty($message) || empty($titre))
|
||||
{
|
||||
echo'<p>Votre message ou votre titre est vide,
|
||||
cliquez <a href="./poster.php?action=nouveautopic&f='.$forum.'">ici</a> pour recommencer</p>';
|
||||
}
|
||||
else //Si jamais le message n'est pas vide
|
||||
{
|
||||
//On entre le topic dans la base de donnée en laissant
|
||||
//le champ topic_last_post à 0
|
||||
$query=$db->prepare('INSERT INTO forum_topic
|
||||
(forum_id, topic_titre, topic_createur, topic_vu, topic_time, topic_genre)
|
||||
VALUES(:forum, :titre, :id, 1, :temps, :mess)');
|
||||
$query->bindValue(':forum', $forum, PDO::PARAM_INT);
|
||||
$query->bindValue(':titre', $titre, PDO::PARAM_STR);
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->bindValue(':temps', $temps, PDO::PARAM_INT);
|
||||
$query->bindValue(':mess', $mess, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
|
||||
|
||||
$nouveautopic = $db->lastInsertId(); //Notre fameuse fonction !
|
||||
$query->CloseCursor();
|
||||
|
||||
//Puis on entre le message
|
||||
$query=$db->prepare('INSERT INTO forum_post
|
||||
(post_createur, post_texte, post_time, topic_id, post_forum_id)
|
||||
VALUES (:id, :mess, :temps, :nouveautopic, :forum)');
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->bindValue(':mess', $message, PDO::PARAM_STR);
|
||||
$query->bindValue(':temps', $temps,PDO::PARAM_INT);
|
||||
$query->bindValue(':nouveautopic', (int) $nouveautopic, PDO::PARAM_INT);
|
||||
$query->bindValue(':forum', $forum, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
|
||||
$nouveaupost = $db->lastInsertId(); //Encore notre fameuse fonction !
|
||||
$query->CloseCursor();
|
||||
|
||||
$query=$db->prepare('SELECT membre_id FROM forum_email WHERE forum_all = 1');
|
||||
$query->execute();
|
||||
$data=$query->fetchAll();
|
||||
$query->CloseCursor();
|
||||
foreach ($data as $i => $value) {
|
||||
$query=$db->prepare('SELECT membre_email, membre_pseudo FROM forum_membres WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $data[$i]['membre_id'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data2=$query->fetch();
|
||||
$query->CloseCursor();
|
||||
emailnotif($nouveautopic, $data2['membre_email'], $data2['membre_pseudo']);
|
||||
unset($data["membre_id"][$i]);
|
||||
}
|
||||
|
||||
$query=$db->prepare('SELECT membre_id FROM forum_email WHERE topic_id = :id');
|
||||
$query->bindValue(':id', $nouveautopic, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetchAll();
|
||||
$query->CloseCursor();
|
||||
foreach ($data as $i => $value) {
|
||||
$query=$db->prepare('SELECT membre_email, membre_pseudo FROM forum_membres WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $data[$i]['membre_id'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data2=$query->fetch();
|
||||
$query->CloseCursor();
|
||||
emailnotif($nouveautopic, $data2['membre_email'], $data2['membre_pseudo']);
|
||||
unset($data["membre_id"][$i]);
|
||||
}
|
||||
|
||||
//Ici on update comme prévu la valeur de topic_last_post et de topic_first_post
|
||||
$query=$db->prepare('UPDATE forum_topic
|
||||
SET topic_last_post = :nouveaupost,
|
||||
topic_first_post = :nouveaupost
|
||||
WHERE topic_id = :nouveautopic');
|
||||
$query->bindValue(':nouveaupost', (int) $nouveaupost, PDO::PARAM_INT);
|
||||
$query->bindValue(':nouveautopic', (int) $nouveautopic, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Enfin on met à jour les tables forum_forum et forum_membres
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post + 1 ,forum_topic = forum_topic + 1,
|
||||
forum_last_post_id = :nouveaupost
|
||||
WHERE forum_id = :forum');
|
||||
$query->bindValue(':nouveaupost', (int) $nouveaupost, PDO::PARAM_INT);
|
||||
$query->bindValue(':forum', (int) $forum, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_post = membre_post + 1 WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Et un petit message
|
||||
echo'<p>Votre message a bien été ajouté!<br /><br />Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum<br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$nouveautopic.'">ici</a> pour le voir</p>';
|
||||
}
|
||||
break; //Houra !
|
||||
|
||||
//Deuxième cas : répondre
|
||||
case "repondre":
|
||||
$topic = (int) $_GET['t'];
|
||||
$query=$db->prepare('SELECT forum_id, topic_post FROM forum_topic WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic', $topic, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$topic_post = $data['topic_post'];
|
||||
$forum = $data['forum_id'];
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('SELECT topic_locked, auth_post FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = :forum
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
if ($data['topic_locked'] != 0)
|
||||
{
|
||||
erreur(ERR_TOPIC_VERR); //A vous d'afficher un message du genre : le topic est verrouillé qu'est ce que tu fous là !?
|
||||
}
|
||||
$query->CloseCursor();
|
||||
$message = $_POST['message'];
|
||||
|
||||
//ici seulement, maintenant qu'on est sur qu'elle existe, on récupère la valeur de la variable t
|
||||
$topic = (int) $_GET['t'];
|
||||
$temps = time();
|
||||
|
||||
if (empty($message))
|
||||
{
|
||||
echo'<p>Votre message est vide, cliquez <a href="./poster.php?action=repondre&t='.$topic.'">ici</a> pour recommencer</p>';
|
||||
}
|
||||
else //Sinon, si le message n'est pas vide
|
||||
{
|
||||
//Puis on entre le message
|
||||
$query=$db->prepare('INSERT INTO forum_post
|
||||
(post_createur, post_texte, post_time, topic_id, post_forum_id)
|
||||
VALUES(:id,:mess,:temps,:topic,:forum)');
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->bindValue(':mess', $message, PDO::PARAM_STR);
|
||||
$query->bindValue(':temps', $temps, PDO::PARAM_INT);
|
||||
$query->bindValue(':topic', $topic, PDO::PARAM_INT);
|
||||
$query->bindValue(':forum', $forum, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
$nouveaupost = $db->lastInsertId();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On change un peu la table forum_topic
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_post = topic_post + 1, topic_last_post = :nouveaupost WHERE topic_id =:topic');
|
||||
$query->bindValue(':nouveaupost', (int) $nouveaupost, PDO::PARAM_INT);
|
||||
$query->bindValue(':topic', (int) $topic, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Puis même combat sur les 2 autres tables
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post + 1 , forum_last_post_id = :nouveaupost WHERE forum_id = :forum');
|
||||
$query->bindValue(':nouveaupost', (int) $nouveaupost, PDO::PARAM_INT);
|
||||
$query->bindValue(':forum', (int) $forum, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_post = membre_post + 1 WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Et un petit message
|
||||
$nombreDeMessagesParPage = 15;
|
||||
$nbr_post = $topic_post+1;
|
||||
$page = ceil($nbr_post / $nombreDeMessagesParPage);
|
||||
echo'<p>Votre message a bien été ajouté!<br /><br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum<br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'&page='.$page.'#p_'.$nouveaupost.'">ici</a> pour le voir</p>';
|
||||
|
||||
//EMAILS
|
||||
$topicemail = $topic.'&page='.$page.'#p_'.$nouveaupost;
|
||||
$query=$db->prepare('SELECT membre_id FROM forum_email WHERE forum_all = 1');
|
||||
$query->execute();
|
||||
$data=$query->fetchAll();
|
||||
$query->CloseCursor();
|
||||
foreach ($data as $i => $value) {
|
||||
$query=$db->prepare('SELECT membre_email, membre_pseudo FROM forum_membres WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $data[$i]['membre_id'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data2=$query->fetch();
|
||||
$query->CloseCursor();
|
||||
emailnotif($topicemail, $data2['membre_email'], $data2['membre_pseudo']);
|
||||
unset($data["membre_id"][$i]);
|
||||
}
|
||||
|
||||
$query=$db->prepare('SELECT membre_id FROM forum_email WHERE topic_id = :id');
|
||||
$query->bindValue(':id', $topic, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetchAll();
|
||||
$query->CloseCursor();
|
||||
foreach ($data as $i => $value) {
|
||||
$query=$db->prepare('SELECT membre_email, membre_pseudo FROM forum_membres WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $data[$i]['membre_id'], PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data2=$query->fetch();
|
||||
$query->CloseCursor();
|
||||
emailnotif($topicemail, $data2['membre_email'], $data2['membre_pseudo']);
|
||||
unset($data["membre_id"][$i]);
|
||||
}
|
||||
}//Fin du else
|
||||
break;
|
||||
|
||||
case "deplacer":
|
||||
|
||||
$topic = (int) $_GET['t'];
|
||||
$query= $db->prepare('SELECT forum_topic.forum_id, auth_modo
|
||||
FROM forum_topic
|
||||
LEFT JOIN forum_forum
|
||||
ON forum_forum.forum_id = forum_topic.forum_id
|
||||
WHERE topic_id =:topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
if (!verif_auth($data['auth_modo']))
|
||||
{
|
||||
// Si cette condition n'est pas remplie ça va barder :o
|
||||
erreur(ERR_AUTH_MOVE);
|
||||
}
|
||||
else //Sinon ça roule et on continue
|
||||
{
|
||||
$query->CloseCursor();
|
||||
$destination = (int) $_POST['dest'];
|
||||
$origine = (int) $_POST['from'];
|
||||
|
||||
//On déplace le topic
|
||||
$query=$db->prepare('UPDATE forum_topic SET forum_id = :dest WHERE topic_id = :topic');
|
||||
$query->bindValue(':dest',$destination,PDO::PARAM_INT);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On déplace les posts
|
||||
$query=$db->prepare('UPDATE forum_post SET post_forum_id = :dest
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':dest',$destination,PDO::PARAM_INT);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
//On s'occupe d'ajouter / enlever les nombres de post / topic aux
|
||||
//forum d'origine et de destination
|
||||
//Pour cela on compte le nombre de post déplacé
|
||||
|
||||
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nombre_post
|
||||
FROM forum_post WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$nombrepost = $data['nombre_post'];
|
||||
$query->CloseCursor();
|
||||
|
||||
//Il faut également vérifier qu'on a pas déplacé un post qui été
|
||||
//l'ancien premier post du forum (champ forum_last_post_id)
|
||||
|
||||
$query=$db->prepare('SELECT post_id FROM forum_post WHERE post_forum_id = :desti
|
||||
ORDER BY post_id DESC LIMIT 0,1');
|
||||
$query->bindValue(':desti',$destination,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$last=(isset($data['post_id']))?$data['post_id']:0;
|
||||
$query->CloseCursor();
|
||||
|
||||
//Puis on met à jour le forum d'origine
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post - :nbr,
|
||||
forum_topic = forum_topic - 1,
|
||||
forum_last_post_id = :last
|
||||
WHERE forum_id = :ori');
|
||||
$query->bindValue(':nbr',$nombrepost,PDO::PARAM_INT);
|
||||
$query->bindValue(':ori',$origine,PDO::PARAM_INT);
|
||||
$query->bindValue(':last',$last,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Avant de mettre à jour le forum de destination il faut
|
||||
//vérifier la valeur de forum_last_post_id
|
||||
$query=$db->prepare('SELECT post_id FROM forum_post WHERE post_forum_id = :dest
|
||||
ORDER BY post_id DESC LIMIT 0,1');
|
||||
$query->bindValue(':dest',$destination,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$last_post=$data['post_id'];
|
||||
$query->CloseCursor();
|
||||
|
||||
//Et on met à jour enfin !
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post + :nbr,
|
||||
forum_topic = forum_topic + 1,
|
||||
forum_last_post_id = :last
|
||||
WHERE forum_id = :forum');
|
||||
$query->bindValue(':nbr',$nombrepost,PDO::PARAM_INT);
|
||||
$query->bindValue(':last',$last,PDO::PARAM_INT);
|
||||
$query->bindValue(':forum',$destination,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//C'est gagné ! On affiche le message
|
||||
echo'<p>Le topic a bien été déplacé <br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'">ici</a> pour revenir au topic<br />
|
||||
Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du forum</p>';
|
||||
}
|
||||
break;
|
||||
case "repondremp": //Si on veut répondre
|
||||
|
||||
//On récupère le titre et le message
|
||||
$message = $_POST['message'];
|
||||
$titre = $_POST['titre'];
|
||||
$temps = time();
|
||||
|
||||
//On récupère la valeur de l'id du destinataire
|
||||
$dest = (int) $_GET['dest'];
|
||||
|
||||
//Enfin on peut envoyer le message
|
||||
|
||||
$query=$db->prepare('INSERT INTO forum_mp
|
||||
(mp_expediteur, mp_receveur, mp_titre, mp_text, mp_time, mp_lu)
|
||||
VALUES(:id, :dest, :titre, :txt, :tps, 0)');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':dest',$dest,PDO::PARAM_INT);
|
||||
$query->bindValue(':titre',$titre,PDO::PARAM_STR);
|
||||
$query->bindValue(':txt',$message,PDO::PARAM_STR);
|
||||
$query->bindValue(':tps',$temps,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
echo'<p>Votre message a bien été envoyé!<br />
|
||||
<br />Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du
|
||||
forum<br />
|
||||
<br />Cliquez <a href="./messagesprives.php">ici</a> pour retourner
|
||||
à la messagerie</p>';
|
||||
|
||||
break;
|
||||
|
||||
case "nouveaump": //On envoie un nouveau mp
|
||||
|
||||
//On récupère le titre et le message
|
||||
$message = $_POST['message'];
|
||||
$titre = $_POST['titre'];
|
||||
$temps = time();
|
||||
$dest = $_POST['to'];
|
||||
|
||||
//On récupère la valeur de l'id du destinataire
|
||||
//Il faut déja vérifier le nom
|
||||
|
||||
$query=$db->prepare('SELECT membre_id FROM forum_membres
|
||||
WHERE LOWER(membre_pseudo) = :dest');
|
||||
$query->bindValue(':dest',strtolower($dest),PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
if($data = $query->fetch())
|
||||
{
|
||||
$query=$db->prepare('INSERT INTO forum_mp
|
||||
(mp_expediteur, mp_receveur, mp_titre, mp_text, mp_time, mp_lu)
|
||||
VALUES(:id, :dest, :titre, :txt, :tps, :lu)');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':dest',(int) $data['membre_id'],PDO::PARAM_INT);
|
||||
$query->bindValue(':titre',$titre,PDO::PARAM_STR);
|
||||
$query->bindValue(':txt',$message,PDO::PARAM_STR);
|
||||
$query->bindValue(':tps',$temps,PDO::PARAM_INT);
|
||||
$query->bindValue(':lu','0',PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
|
||||
|
||||
echo'<p>Votre message a bien été envoyé!
|
||||
<br /><br />Cliquez <a href="./index.php">ici</a> pour revenir à l\'index du
|
||||
forum<br />
|
||||
<br />Cliquez <a href="./messagesprives.php">ici</a> pour retourner à
|
||||
la messagerie</p>';
|
||||
}
|
||||
//Sinon l'utilisateur n'existe pas !
|
||||
else
|
||||
{
|
||||
echo'<p>Désolé ce membre n existe pas, veuillez vérifier et
|
||||
réessayez à nouveau.</p>';
|
||||
}
|
||||
break;
|
||||
case "supprimer":
|
||||
|
||||
//On récupère la valeur de l'id
|
||||
$id_mess = (int) $_GET['id'];
|
||||
//Il faut vérifier que le membre est bien celui qui a reçu le message
|
||||
$query=$db->prepare('SELECT mp_receveur
|
||||
FROM forum_mp WHERE mp_id = :id');
|
||||
$query->bindValue(':id',$id_mess,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
//Sinon la sanction est terrible :p
|
||||
if ($id != $data['mp_receveur']) erreur(ERR_WRONG_USER);
|
||||
$query->CloseCursor();
|
||||
|
||||
//2 cas pour cette partie : on est sûr de supprimer ou alors on ne l'est pas
|
||||
$sur = (int) $_GET['sur'];
|
||||
//Pas encore certain
|
||||
if ($sur == 0)
|
||||
{
|
||||
echo'<p>Etes-vous certain de vouloir supprimer ce message ?<br />
|
||||
<a href="./messagesprives.php?action=supprimer&id='.$id_mess.'&sur=1">
|
||||
Oui</a> - <a href="./messagesprives.php">Non</a></p>';
|
||||
}
|
||||
//Certain
|
||||
else
|
||||
{
|
||||
$query=$db->prepare('DELETE from forum_mp WHERE mp_id = :id');
|
||||
$query->bindValue(':id',$id_mess,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
echo'<p>Le message a bien été supprimé.<br />
|
||||
Cliquez <a href="./messagesprives.php">ici</a> pour revenir à la boite
|
||||
de messagerie.</p>';
|
||||
}
|
||||
|
||||
break;
|
||||
case "autorep":
|
||||
$topic = (int) $_GET['t'];
|
||||
$query=$db->prepare('SELECT forum_topic.forum_id, auth_modo
|
||||
FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = forum_topic.forum_id
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
$forum=$data['forum_id'];
|
||||
if (!verif_auth($data['auth_modo']))
|
||||
{
|
||||
erreur(ERR_AUTH_MODO);
|
||||
}
|
||||
$query->CloseCursor();
|
||||
$rep = (int) $_POST['rep'];
|
||||
$query=$db->prepare('SELECT automess_mess FROM forum_automess
|
||||
WHERE automess_id = :rep');
|
||||
$query->bindValue(':rep',$rep,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data = $query->fetch();
|
||||
$message = $data['automess_mess'];
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('INSERT INTO forum_post
|
||||
(post_createur, post_texte, post_time, topic_id, post_forum_id)
|
||||
VALUES(:id,:mess,:temps,:topic,:forum)');
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->bindValue(':mess', $message, PDO::PARAM_STR);
|
||||
$query->bindValue(':temps', time(), PDO::PARAM_INT);
|
||||
$query->bindValue(':topic', $topic, PDO::PARAM_INT);
|
||||
$query->bindValue(':forum', $forum, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
$nouveaupost = $db->lastInsertId();
|
||||
$query->CloseCursor();
|
||||
|
||||
//On change un peu la table forum_topic
|
||||
$query=$db->prepare('UPDATE forum_topic SET topic_post = topic_post + 1, topic_last_post = :nouveaupost WHERE topic_id =:topic');
|
||||
$query->bindValue(':nouveaupost', (int) $nouveaupost, PDO::PARAM_INT);
|
||||
$query->bindValue(':topic', (int) $topic, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
//Puis même combat sur les 2 autres tables
|
||||
$query=$db->prepare('UPDATE forum_forum SET forum_post = forum_post + 1 , forum_last_post_id = :nouveaupost WHERE forum_id = :forum');
|
||||
$query->bindValue(':nouveaupost', (int) $nouveaupost, PDO::PARAM_INT);
|
||||
$query->bindValue(':forum', (int) $forum, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
$query=$db->prepare('UPDATE forum_membres SET membre_post = membre_post + 1 WHERE membre_id = :id');
|
||||
$query->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('UPDATE forum_topic
|
||||
SET topic_locked = :lock
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':lock','1',PDO::PARAM_STR);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
echo '<p>La réponse automatique a bien été envoyée ! <br />
|
||||
Cliquez <a href="./voirtopic.php?t='.$topic.'">ici</a>
|
||||
pour revenir au topic<br />
|
||||
Cliquez <a href="./index.php">ici</a>
|
||||
pour revenir à l\'index du forum</p>';
|
||||
|
||||
break;
|
||||
|
||||
default;
|
||||
echo'<p>Cette action est impossible</p>';
|
||||
} //Fin du Switch
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
f953c2b56adf709d08cfd372b668a8948a6204ca
|
||||
@@ -0,0 +1,291 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Enregistrement";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
include("includes/menu.php");
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Enregistrement';
|
||||
|
||||
if ($id!=0) erreur(ERR_IS_CO);
|
||||
|
||||
//if (empty($_POST['pseudo'])) { // Si on la variable est vide, on peut considérer qu'on est sur la page de formulaire
|
||||
|
||||
$pseudo=$_POST['pseudo'];
|
||||
$signature = $_POST['signature'];
|
||||
$email = $_POST['email'];
|
||||
$twitch = $_POST['twitch'];
|
||||
$website = $_POST['website'];
|
||||
$steam = $_POST['steam'];
|
||||
$lol = $_POST['lol'];
|
||||
$r6 = $_POST['r6'];
|
||||
$localisation = $_POST['localisation'];
|
||||
$avatar = $_POST['avatar'];
|
||||
|
||||
|
||||
echo '<h1>Inscription 1/2</h1>';
|
||||
echo '<form method="post" action="registerverif.php" enctype="multipart/form-data">
|
||||
<fieldset><legend>Identifiants</legend>
|
||||
<label for="pseudo">* Pseudo :</label> <input required name="pseudo" type="text" id="pseudo" value="'.$pseudo.'"/> (le pseudo doit contenir entre 3 et 15 caractères)<br />
|
||||
<label for="password">* Mot de Passe :</label><input required type="password" name="password" id="password" /><br />
|
||||
<label for="confirm">* Confirmer le mot de passe :</label><input required type="password" name="confirm" id="confirm" />
|
||||
</fieldset>
|
||||
<fieldset><legend>Contacts</legend>
|
||||
<p style="margin-top: 0px; margin-bottom: 0px;"><label for="email">* Votre adresse Mail :</label><input required type="email" name="email" id="email" value="'.$email.'"/> Ne pas montrer l\'email ? <input type="checkbox" name="emailprive" value="on"></p>
|
||||
<label for="twitch">Votre pseudo twitch :</label><input name="twitch" id="twitch" value="'.$twitch.'"/><br />
|
||||
<label for="website">Votre site web :</label><input type="text" name="website" id="website" value="'.$website.'"/><br/>
|
||||
<label for="steam">Votre profil steam: </label><input type="text" name="steam" id="steam" value="'.$steam.'"/><br/>
|
||||
<label for="lol">Votre pseudo lol: </label><input type="text" name="lol" id="lol" value="'.$lol.'"/><br/>
|
||||
<label for="lol">Votre pseudo R6: </label><input type="text" name="r6" id="r6" value="'.$r6.'"/>
|
||||
</fieldset>
|
||||
<fieldset><legend>Informations supplémentaires</legend>
|
||||
<label for="localisation">Localisation :</label><input type="text" name="localisation" id="localisation" value="'.$localisation.'"/>
|
||||
</fieldset>
|
||||
<fieldset><legend>Profil sur le forum</legend>
|
||||
<label for="avatar" style="height: 18px;">Choisissez votre avatar :</label><input type="file" name="avatar" id="avatar" value="'.$avatar.'"/>(Taille max : 100Ko)<br />
|
||||
<label for="signature">Signature :</label><textarea cols="40" rows="4" name="signature" id="signature" value="'.$signature.'" maxlength="'.$config['sign_maxl'].'" placeholder="La signature est limitée à 200 caractères"></textarea>
|
||||
<p>Profil privé ? <input type="checkbox" name="prive" value="on"></p>
|
||||
</fieldset>
|
||||
<p>Les champs précédés d\'un * sont obligatoires</p>
|
||||
<div class="g-recaptcha" data-sitekey="6LdwmWoUAAAAANfbEyAjRfXn4ifbjMDRNZVuS557"></div>
|
||||
<p><input type="submit" value="S\'inscrire" /></p></form>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
|
||||
//} //Fin de la partie formulaire
|
||||
|
||||
/*else { //On est dans le cas traitement
|
||||
$captcha_erreur = NULL;
|
||||
$pseudo_erreur1 = NULL;
|
||||
$pseudo_erreur2 = NULL;
|
||||
$mdp_erreur = NULL;
|
||||
$email_erreur1 = NULL;
|
||||
$email_erreur2 = NULL;
|
||||
$twitch_erreur = NULL;
|
||||
$steam_erreur = NULL;
|
||||
$signature_erreur = NULL;
|
||||
$avatar_erreur = NULL;
|
||||
$avatar_erreur1 = NULL;
|
||||
$avatar_erreur2 = NULL;
|
||||
$avatar_erreur3 = NULL;
|
||||
$ip_erreur = NULL;
|
||||
$secret = "**REMOVED**";
|
||||
$response = $_POST['g-recaptcha-response'];
|
||||
$remoteip = preg_replace('/[^0-9]/', '',$_SERVER['REMOTE_ADDR']);
|
||||
|
||||
//On récupère les variables
|
||||
$i = 0;
|
||||
$temps = time();
|
||||
$prive = 0;
|
||||
$emailprive = 0;
|
||||
$pseudo=$_POST['pseudo'];
|
||||
$signature = $_POST['signature'];
|
||||
$email = $_POST['email'];
|
||||
$twitch = $_POST['twitch'];
|
||||
$website = $_POST['website'];
|
||||
$steam = $_POST['steam'];
|
||||
$lol = $_POST['lol'];
|
||||
$r6 = $_POST['r6'];
|
||||
$localisation = $_POST['localisation'];
|
||||
$pass = md5($_POST['password']);
|
||||
$confirm = md5($_POST['confirm']);
|
||||
|
||||
//verif captcha
|
||||
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret="
|
||||
. $secret
|
||||
. "&response=" . $response
|
||||
. "&remoteip=" . $remoteip ;
|
||||
|
||||
$decode = json_decode(file_get_contents($api_url), true);
|
||||
|
||||
if ($decode['success'] == true) {
|
||||
// C'est un humain
|
||||
}
|
||||
|
||||
else {
|
||||
// C'est un robot ou le code de vérification est incorrecte
|
||||
$i++;
|
||||
$captcha_erreur = "Vous n'avez pas coché le captcha.";
|
||||
}
|
||||
|
||||
//Verif steam
|
||||
if (substr($steam, -1) == "/") {
|
||||
$steam = substr($steam, 0, -1);
|
||||
}
|
||||
|
||||
//Vérification du pseudo
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_pseudo =:pseudo');
|
||||
$query->bindValue(':pseudo',$pseudo, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$pseudo_free=($query->fetchColumn()==0)?1:0;
|
||||
$query->CloseCursor();
|
||||
if(!$pseudo_free)
|
||||
{
|
||||
$pseudo_erreur1 = "Votre pseudo est déjà utilisé par un membre";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (strlen($pseudo) < $config['pseudo_minsize'] || strlen($pseudo) > $config['pseudo_maxsize'])
|
||||
{
|
||||
$pseudo_erreur2 = "Votre pseudo est soit trop grand, soit trop petit";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification du mdp
|
||||
if ($pass != $confirm || empty($confirm) || empty($pass))
|
||||
{
|
||||
$mdp_erreur = "Votre mot de passe et votre confirmation diffèrent, ou sont vides";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification de l'adresse email
|
||||
//Il faut que l'adresse email n'ait jamais été utilisée
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_email =:mail');
|
||||
$query->bindValue(':mail',$email, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$mail_free=($query->fetchColumn()==0)?1:0;
|
||||
$query->CloseCursor();
|
||||
|
||||
if(!$mail_free)
|
||||
{
|
||||
$email_erreur1 = "Votre adresse email est déjà utilisée par un membre";
|
||||
$i++;
|
||||
}
|
||||
//On vérifie la forme maintenant
|
||||
if (!preg_match("#^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}\.[a-z]{2,4}$#", $email) || empty($email))
|
||||
{
|
||||
$email_erreur2 = "Votre adresse E-Mail n'a pas un format valide";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification de la signature
|
||||
if (strlen($signature) > 200)
|
||||
{
|
||||
$signature_erreur = "Votre signature est trop longue";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification de l'avatar :
|
||||
if (!empty($_FILES['avatar']['size']))
|
||||
{
|
||||
//On définit les variables :
|
||||
$maxsize = 100024; //Poid de l'image
|
||||
$maxwidth = 100; //Largeur de l'image
|
||||
$maxheight = 100; //Longueur de l'image
|
||||
$extensions_valides = array( 'jpg' , 'jpeg' , 'png' , 'png', 'bmp', 'gif' ); //Liste des extensions valides
|
||||
|
||||
if ($_FILES['avatar']['error'] > 0)
|
||||
{
|
||||
$avatar_erreur = "Erreur lors du transfert de l'avatar : ";
|
||||
}
|
||||
if ($_FILES['avatar']['size'] > $maxsize)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur1 = "Le fichier est trop gros : (<strong>".$_FILES['avatar']['size']." Octets</strong> contre <strong>".$maxsize." Octets</strong>)";
|
||||
}
|
||||
|
||||
$image_sizes = getimagesize($_FILES['avatar']['tmp_name']);
|
||||
if ($image_sizes[0] > $maxwidth OR $image_sizes[1] > $maxheight)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur2 = "Image trop large ou trop longue :
|
||||
(<strong>".$image_sizes[0]."x".$image_sizes[1]."</strong> contre <strong>".$maxwidth."x".$maxheight."</strong>)";
|
||||
}
|
||||
|
||||
$extension_upload = strtolower(substr( strrchr($_FILES['avatar']['name'], '.') ,1));
|
||||
if (!in_array($extension_upload,$extensions_valides) )
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur3 = "Extension de l'avatar incorrecte";
|
||||
}
|
||||
}
|
||||
|
||||
//Privé ou pas
|
||||
if (isset($_POST['prive'])) {
|
||||
$prive = 1;
|
||||
}
|
||||
|
||||
//Email privé ou pas
|
||||
if (isset($_POST['emailprive'])) {
|
||||
$emailprive = 1;
|
||||
}
|
||||
|
||||
//uid
|
||||
$uid = getrandom(30);
|
||||
|
||||
if ($i==0) {
|
||||
verifemail($uid, $email, $pseudo);
|
||||
echo'<h1>Inscription terminée</h1>';
|
||||
echo'<p>Bienvenue '.stripslashes(htmlspecialchars($_POST['pseudo'])).' vous êtes maintenant inscrit sur le forum, il ne vous reste plus qu\'a confirmer votre email.</p>
|
||||
<p>Cliquez <a href="./index.php">ici</a> pour revenir à la page d\'accueil</p>';
|
||||
|
||||
//La ligne suivante sera commentée plus bas
|
||||
$nomavatar=(!empty($_FILES['avatar']['size']))?move_avatar($_FILES['avatar']):'';
|
||||
|
||||
|
||||
$query=$db->prepare('INSERT INTO forum_membres (membre_pseudo, membre_mdp, membre_email,
|
||||
membre_twitch, membre_siteweb, membre_avatar,
|
||||
membre_signature, membre_localisation, membre_inscrit,
|
||||
membre_derniere_visite, membre_prive, membre_emailprive, membre_uid, membre_steam, membre_lol, membre_r6)
|
||||
VALUES (:pseudo, :pass, :email, :twitch, :website, :nomavatar, :signature, :localisation, :temps, :temps, :prive, :emailprive, :uid, :steam, :lol, :r6)');
|
||||
$query->bindValue(':pseudo', $pseudo, PDO::PARAM_STR);
|
||||
$query->bindValue(':pass', $pass, PDO::PARAM_INT);
|
||||
$query->bindValue(':email', $email, PDO::PARAM_STR);
|
||||
$query->bindValue(':twitch', $twitch, PDO::PARAM_STR);
|
||||
$query->bindValue(':website', $website, PDO::PARAM_STR);
|
||||
$query->bindValue(':nomavatar', $nomavatar, PDO::PARAM_STR);
|
||||
$query->bindValue(':signature', $signature, PDO::PARAM_STR);
|
||||
$query->bindValue(':localisation', $localisation, PDO::PARAM_STR);
|
||||
$query->bindValue(':temps', $temps, PDO::PARAM_INT);
|
||||
$query->bindValue(':prive', $prive, PDO::PARAM_INT);
|
||||
$query->bindValue(':emailprive', $emailprive, PDO::PARAM_INT);
|
||||
$query->bindValue(':uid', $uid, PDO::PARAM_STR);
|
||||
$query->bindValue(':steam', $steam, PDO::PARAM_STR);
|
||||
$query->bindValue(':lol', $lol, PDO::PARAM_STR);
|
||||
$query->bindValue(':r6', $r6, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
|
||||
//Et on définit les variables de sessions
|
||||
// $_SESSION['pseudo'] = $pseudo;
|
||||
// $_SESSION['id'] = $db->lastInsertId(); ;
|
||||
// $_SESSION['level'] = 2;
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<h1>Inscription interrompue</h1>';
|
||||
echo'<p>Une ou plusieurs erreurs se sont produites pendant l\'incription</p>';
|
||||
echo'<p>'.$i.' erreur(s)</p>';
|
||||
echo'<p>'.$captcha_erreur.'</p>';
|
||||
echo'<p>'.$ip_erreur.'</p>';
|
||||
echo'<p>'.$pseudo_erreur1.'</p>';
|
||||
echo'<p>'.$pseudo_erreur2.'</p>';
|
||||
echo'<p>'.$mdp_erreur.'</p>';
|
||||
echo'<p>'.$email_erreur1.'</p>';
|
||||
echo'<p>'.$email_erreur2.'</p>';
|
||||
echo'<p>'.$twitch_erreur.'</p>';
|
||||
echo'<p>'.$signature_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur1.'</p>';
|
||||
echo'<p>'.$avatar_erreur2.'</p>';
|
||||
echo'<p>'.$avatar_erreur3.'</p>';
|
||||
|
||||
echo'<form method="post" action="register.php" enctype="multipart/form-data>
|
||||
<input type="hidden" name="pseudo" value="'.$pseudo.'">
|
||||
<input type="hidden" name="signature" value="'.$signature.'">
|
||||
<input type="hidden" name="email" value="'.$email.'">
|
||||
<input type="hidden" name="twitch" value="'.$twitch.'">
|
||||
<input type="hidden" name="website" value="'.$website.'">
|
||||
<input type="hidden" name="steam" value="'.$steam.'">
|
||||
<input type="hidden" name="lol" value="'.$lol.'">
|
||||
<input type="hidden" name="r6" value="'.$r6.'">
|
||||
<input type="hidden" name="localisation" value="'.$localisation.'">
|
||||
<p><input type="submit" value="Recommencer" /></p></form>';
|
||||
}
|
||||
}
|
||||
*/?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
6208ca39767796fb49b53494cc5edcead1c21310
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Enregistrement";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
include("includes/menu.php");
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Enregistrement';
|
||||
|
||||
$captcha_erreur = NULL;
|
||||
$pseudo_erreur1 = NULL;
|
||||
$pseudo_erreur2 = NULL;
|
||||
$mdp_erreur = NULL;
|
||||
$email_erreur1 = NULL;
|
||||
$email_erreur2 = NULL;
|
||||
$twitch_erreur = NULL;
|
||||
$steam_erreur = NULL;
|
||||
$signature_erreur = NULL;
|
||||
$avatar_erreur = NULL;
|
||||
$avatar_erreur1 = NULL;
|
||||
$avatar_erreur2 = NULL;
|
||||
$avatar_erreur3 = NULL;
|
||||
$ip_erreur = NULL;
|
||||
$secret = "**REMOVED**";
|
||||
$response = $_POST['g-recaptcha-response'];
|
||||
$remoteip = preg_replace('/[^0-9]/', '',$_SERVER['REMOTE_ADDR']);
|
||||
|
||||
//On récupère les variables
|
||||
$i = 0;
|
||||
$temps = time();
|
||||
$prive = 0;
|
||||
$emailprive = 0;
|
||||
$pseudo=$_POST['pseudo'];
|
||||
$signature = $_POST['signature'];
|
||||
$email = $_POST['email'];
|
||||
$twitch = $_POST['twitch'];
|
||||
$website = $_POST['website'];
|
||||
$steam = $_POST['steam'];
|
||||
$lol = $_POST['lol'];
|
||||
$r6 = $_POST['r6'];
|
||||
$localisation = $_POST['localisation'];
|
||||
$pass = md5($_POST['password']);
|
||||
$confirm = md5($_POST['confirm']);
|
||||
|
||||
//verif captcha
|
||||
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret="
|
||||
. $secret
|
||||
. "&response=" . $response
|
||||
. "&remoteip=" . $remoteip ;
|
||||
|
||||
$decode = json_decode(file_get_contents($api_url), true);
|
||||
|
||||
if ($decode['success'] == true) {
|
||||
// C'est un humain
|
||||
}
|
||||
|
||||
else {
|
||||
// C'est un robot ou le code de vérification est incorrecte
|
||||
$i++;
|
||||
$captcha_erreur = "Vous n'avez pas coché le captcha.";
|
||||
}
|
||||
|
||||
//Verif steam
|
||||
if (substr($steam, -1) == "/") {
|
||||
$steam = substr($steam, 0, -1);
|
||||
}
|
||||
|
||||
//Vérification du pseudo
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_pseudo =:pseudo');
|
||||
$query->bindValue(':pseudo',$pseudo, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$pseudo_free=($query->fetchColumn()==0)?1:0;
|
||||
$query->CloseCursor();
|
||||
if(!$pseudo_free)
|
||||
{
|
||||
$pseudo_erreur1 = "Votre pseudo est déjà utilisé par un membre";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (strlen($pseudo) < $config['pseudo_minsize'] || strlen($pseudo) > $config['pseudo_maxsize'])
|
||||
{
|
||||
$pseudo_erreur2 = "Votre pseudo est soit trop grand, soit trop petit";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification du mdp
|
||||
if ($pass != $confirm || empty($confirm) || empty($pass))
|
||||
{
|
||||
$mdp_erreur = "Votre mot de passe et votre confirmation diffèrent, ou sont vides";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification de l'adresse email
|
||||
//Il faut que l'adresse email n'ait jamais été utilisée
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_email =:mail');
|
||||
$query->bindValue(':mail',$email, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$mail_free=($query->fetchColumn()==0)?1:0;
|
||||
$query->CloseCursor();
|
||||
|
||||
if(!$mail_free)
|
||||
{
|
||||
$email_erreur1 = "Votre adresse email est déjà utilisée par un membre";
|
||||
$i++;
|
||||
}
|
||||
//On vérifie la forme maintenant
|
||||
if (!preg_match("#^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}\.[a-z]{2,4}$#", $email) || empty($email))
|
||||
{
|
||||
$email_erreur2 = "Votre adresse E-Mail n'a pas un format valide";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification de la signature
|
||||
if (strlen($signature) > 200)
|
||||
{
|
||||
$signature_erreur = "Votre signature est trop longue";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//Vérification de l'avatar :
|
||||
if (!empty($_FILES['avatar']['size']))
|
||||
{
|
||||
//On définit les variables :
|
||||
$maxsize = 100024; //Poid de l'image
|
||||
$maxwidth = 100; //Largeur de l'image
|
||||
$maxheight = 100; //Longueur de l'image
|
||||
$extensions_valides = array( 'jpg' , 'jpeg' , 'png', 'bmp', 'gif' ); //Liste des extensions valides
|
||||
|
||||
if ($_FILES['avatar']['error'] > 0)
|
||||
{
|
||||
$avatar_erreur = "Erreur lors du transfert de l'avatar : ";
|
||||
}
|
||||
if ($_FILES['avatar']['size'] > $maxsize)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur1 = "Le fichier est trop gros : (<strong>".$_FILES['avatar']['size']." Octets</strong> contre <strong>".$maxsize." Octets</strong>)";
|
||||
}
|
||||
|
||||
$image_sizes = getimagesize($_FILES['avatar']['tmp_name']);
|
||||
if ($image_sizes[0] > $maxwidth OR $image_sizes[1] > $maxheight)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur2 = "Image trop large ou trop longue :
|
||||
(<strong>".$image_sizes[0]."x".$image_sizes[1]."</strong> contre <strong>".$maxwidth."x".$maxheight."</strong>)";
|
||||
}
|
||||
|
||||
$extension_upload = strtolower(substr( strrchr($_FILES['avatar']['name'], '.') ,1));
|
||||
if (!in_array($extension_upload,$extensions_valides) )
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur3 = "Extension de l'avatar incorrecte";
|
||||
}
|
||||
}
|
||||
|
||||
//Privé ou pas
|
||||
if (isset($_POST['prive'])) {
|
||||
$prive = 1;
|
||||
}
|
||||
|
||||
//Email privé ou pas
|
||||
if (isset($_POST['emailprive'])) {
|
||||
$emailprive = 1;
|
||||
}
|
||||
|
||||
//uid
|
||||
$uid = getrandom(30);
|
||||
|
||||
if ($i==0) {
|
||||
verifemail($uid, $email, $pseudo);
|
||||
echo'<h1>Inscription terminée</h1>';
|
||||
echo'<p>Bienvenue '.stripslashes(htmlspecialchars($_POST['pseudo'])).' vous êtes maintenant inscrit sur le forum, il ne vous reste plus qu\'a confirmer votre email.</p>
|
||||
<p>Cliquez <a href="./index.php">ici</a> pour revenir à la page d\'accueil</p>';
|
||||
|
||||
//La ligne suivante sera commentée plus bas
|
||||
$nomavatar=(!empty($_FILES['avatar']['size']))?move_avatar($_FILES['avatar']):'';
|
||||
|
||||
|
||||
$query=$db->prepare('INSERT INTO forum_membres (membre_pseudo, membre_mdp, membre_email,
|
||||
membre_twitch, membre_siteweb, membre_avatar,
|
||||
membre_signature, membre_localisation, membre_inscrit,
|
||||
membre_derniere_visite, membre_prive, membre_emailprive, membre_uid, membre_steam, membre_lol, membre_r6)
|
||||
VALUES (:pseudo, :pass, :email, :twitch, :website, :nomavatar, :signature, :localisation, :temps, :temps, :prive, :emailprive, :uid, :steam, :lol, :r6)');
|
||||
$query->bindValue(':pseudo', $pseudo, PDO::PARAM_STR);
|
||||
$query->bindValue(':pass', $pass, PDO::PARAM_INT);
|
||||
$query->bindValue(':email', $email, PDO::PARAM_STR);
|
||||
$query->bindValue(':twitch', $twitch, PDO::PARAM_STR);
|
||||
$query->bindValue(':website', $website, PDO::PARAM_STR);
|
||||
$query->bindValue(':nomavatar', $nomavatar, PDO::PARAM_STR);
|
||||
$query->bindValue(':signature', $signature, PDO::PARAM_STR);
|
||||
$query->bindValue(':localisation', $localisation, PDO::PARAM_STR);
|
||||
$query->bindValue(':temps', $temps, PDO::PARAM_INT);
|
||||
$query->bindValue(':prive', $prive, PDO::PARAM_INT);
|
||||
$query->bindValue(':emailprive', $emailprive, PDO::PARAM_INT);
|
||||
$query->bindValue(':uid', $uid, PDO::PARAM_STR);
|
||||
$query->bindValue(':steam', $steam, PDO::PARAM_STR);
|
||||
$query->bindValue(':lol', $lol, PDO::PARAM_STR);
|
||||
$query->bindValue(':r6', $r6, PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
|
||||
//Et on définit les variables de sessions
|
||||
// $_SESSION['pseudo'] = $pseudo;
|
||||
// $_SESSION['id'] = $db->lastInsertId(); ;
|
||||
// $_SESSION['level'] = 2;
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else {
|
||||
echo'<h1>Inscription interrompue</h1>';
|
||||
echo'<p>Une ou plusieurs erreurs se sont produites pendant l\'incription</p>';
|
||||
echo'<p>'.$i.' erreur(s)</p>';
|
||||
echo'<p>'.$captcha_erreur.'</p>';
|
||||
echo'<p>'.$ip_erreur.'</p>';
|
||||
echo'<p>'.$pseudo_erreur1.'</p>';
|
||||
echo'<p>'.$pseudo_erreur2.'</p>';
|
||||
echo'<p>'.$mdp_erreur.'</p>';
|
||||
echo'<p>'.$email_erreur1.'</p>';
|
||||
echo'<p>'.$email_erreur2.'</p>';
|
||||
echo'<p>'.$twitch_erreur.'</p>';
|
||||
echo'<p>'.$signature_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur1.'</p>';
|
||||
echo'<p>'.$avatar_erreur2.'</p>';
|
||||
echo'<p>'.$avatar_erreur3.'</p>';
|
||||
|
||||
echo'<form method="post" action="register.php" enctype="multipart/form-data">
|
||||
<input type="hidden" name="pseudo" value="'.$pseudo.'">
|
||||
<input type="hidden" name="signature" value="'.$signature.'">
|
||||
<input type="hidden" name="email" value="'.$email.'">
|
||||
<input type="hidden" name="twitch" value="'.$twitch.'">
|
||||
<input type="hidden" name="website" value="'.$website.'">
|
||||
<input type="hidden" name="steam" value="'.$steam.'">
|
||||
<input type="hidden" name="lol" value="'.$lol.'">
|
||||
<input type="hidden" name="r6" value="'.$r6.'">
|
||||
<input type="hidden" name="localisation" value="'.$localisation.'">
|
||||
<input type="file" name="avatar" value="'.$_FILES['avatar'].'">
|
||||
<p><input type="submit" value="Recommencer" /></p></form>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
ce8b5ff04517cb1eb258c1d9fef9fd7ffad17afe
|
||||
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Voir un forum";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
//On récupère la valeur de f
|
||||
$forum = (int) $_GET['f'];
|
||||
|
||||
//A partir d'ici, on va compter le nombre de messages
|
||||
//pour n'afficher que les 25 premiers
|
||||
$query=$db->prepare('SELECT forum_name, forum_topic, auth_view, auth_topic FROM forum_forum WHERE forum_id = :forum');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
if (!verif_auth($data['auth_view']))
|
||||
{
|
||||
erreur(ERR_AUTH_VIEW);
|
||||
}
|
||||
|
||||
$totalDesMessages = $data['forum_topic'] + 1;
|
||||
$nombreDeMessagesParPage = 25;
|
||||
$nombreDePages = ceil($totalDesMessages / $nombreDeMessagesParPage);
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> -->
|
||||
<a href="./voirforum.php?f='.$forum.'">'.stripslashes(htmlspecialchars($data['forum_name'])).'</a>';
|
||||
|
||||
//Nombre de pages
|
||||
|
||||
|
||||
$page = (isset($_GET['page']))?intval($_GET['page']):1;
|
||||
|
||||
//On affiche les pages 1-2-3, etc.
|
||||
echo '<p>Page : ';
|
||||
for ($i = 1 ; $i <= $nombreDePages ; $i++)
|
||||
{
|
||||
if ($i == $page) //On ne met pas de lien sur la page actuelle
|
||||
{
|
||||
echo $i;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '
|
||||
<a href="voirforum.php?f='.$forum.'&page='.$i.'">'.$i.'</a>';
|
||||
}
|
||||
}
|
||||
echo '</p>';
|
||||
|
||||
|
||||
$premierMessageAafficher = ($page - 1) * $nombreDeMessagesParPage;
|
||||
//Le titre du forum
|
||||
echo '<h1>'.stripslashes(htmlspecialchars($data['forum_name'])).'</h1><br /><br />';
|
||||
|
||||
if (verif_auth($data['auth_topic'])) {
|
||||
//Et le bouton pour poster
|
||||
echo'<a href="./poster.php?action=nouveautopic&f='.$forum.'">
|
||||
<img src="./images/new.png" alt="Nouveau topic" title="Poster un nouveau topic"></a>';
|
||||
}
|
||||
else {
|
||||
echo'<img src="./images/pasnew.png" alt="Pas de nouveau topic" title="Vous ne pouvez pas poster de nouveau topic"></a>';
|
||||
}
|
||||
|
||||
$query->CloseCursor();
|
||||
|
||||
//On prend tout ce qu'on a sur les Annonces du forum
|
||||
|
||||
|
||||
$query=$db->prepare('SELECT forum_topic.topic_id, topic_titre, topic_createur, topic_vu, topic_post, topic_time, topic_last_post,
|
||||
Mb.membre_pseudo AS membre_pseudo_createur, post_createur, post_time, Ma.membre_pseudo AS membre_pseudo_last_posteur, post_id FROM forum_topic
|
||||
LEFT JOIN forum_membres Mb ON Mb.membre_id = forum_topic.topic_createur
|
||||
LEFT JOIN forum_post ON forum_topic.topic_last_post = forum_post.post_id
|
||||
LEFT JOIN forum_membres Ma ON Ma.membre_id = forum_post.post_createur
|
||||
WHERE topic_genre = "Annonce" AND forum_topic.forum_id = :forum
|
||||
ORDER BY topic_last_post DESC');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
//On lance notre tableau seulement s'il y a des requêtes !
|
||||
if ($query->rowCount()>0)
|
||||
{
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<th class="ico"><strong>Annonces</strong></th>
|
||||
<th class="titre"><strong>Titre</strong></th>
|
||||
<th class="nombremessages"><strong>Réponses</strong></th>
|
||||
<th class="nombrevu"><strong>Vus</strong></th>
|
||||
<th class="auteur"><strong>Auteur</strong></th>
|
||||
<th class="derniermessage"><strong>Dernier message</strong></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
//On commence la boucle
|
||||
while ($data=$query->fetch())
|
||||
{
|
||||
//Pour chaque topic :
|
||||
//Si le topic est une annonce on l'affiche en haut
|
||||
//mega echo de bourrain pour tout remplir
|
||||
|
||||
echo'<tr><td><img src="./images/annonce.png" alt="Annonce" /></td>
|
||||
|
||||
<td id="titre"><strong>Annonce : </strong>
|
||||
<strong><a href="./voirtopic.php?t='.$data['topic_id'].'"
|
||||
title="Topic commencé à
|
||||
'.date('H\hi \l\e d M,y',$data['topic_time']).'">
|
||||
'.stripslashes(htmlspecialchars($data['topic_titre'])).'</a></strong></td>
|
||||
|
||||
<td class="nombremessages">'.$data['topic_post'].'</td>
|
||||
|
||||
<td class="nombrevu">'.$data['topic_vu'].'</td>
|
||||
|
||||
<td><a href="./voirprofil.php?m='.$data['topic_createur'].'
|
||||
&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo_createur'])).'</a></td>';
|
||||
|
||||
//Selection dernier message
|
||||
$nombreDeMessagesParPage = 15;
|
||||
$nbr_post = $data['topic_post'] +1;
|
||||
$page = ceil($nbr_post / $nombreDeMessagesParPage);
|
||||
|
||||
echo '<td class="derniermessage">Par
|
||||
<a href="./voirprofil.php?m='.$data['post_createur'].'
|
||||
&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo_last_posteur'])).'</a><br />
|
||||
A <a href="./voirtopic.php?t='.$data['topic_id'].'&page='.$page.'#p_'.$data['post_id'].'">'.date('H\hi \l\e d M y',$data['post_time']).'</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
$query->CloseCursor();
|
||||
|
||||
//On prend tout ce qu'on a sur les topics normaux du forum
|
||||
|
||||
|
||||
$query=$db->prepare('SELECT forum_topic.topic_id, topic_titre, topic_locked, topic_createur, topic_vu, topic_post, topic_time, topic_last_post,
|
||||
Mb.membre_pseudo AS membre_pseudo_createur, post_id, post_createur, post_time, Ma.membre_pseudo AS membre_pseudo_last_posteur FROM forum_topic
|
||||
LEFT JOIN forum_membres Mb ON Mb.membre_id = forum_topic.topic_createur
|
||||
LEFT JOIN forum_post ON forum_topic.topic_last_post = forum_post.post_id
|
||||
LEFT JOIN forum_membres Ma ON Ma.membre_id = forum_post.post_createur
|
||||
WHERE topic_genre <> "Annonce" AND forum_topic.forum_id = :forum
|
||||
ORDER BY topic_last_post DESC
|
||||
LIMIT :premier ,:nombre');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->bindValue(':premier',(int) $premierMessageAafficher,PDO::PARAM_INT);
|
||||
$query->bindValue(':nombre',(int) $nombreDeMessagesParPage,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
if ($query->rowCount()>0)
|
||||
{
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<th class="ico"><strong>Messages</strong></th>
|
||||
<th class="titre"><strong>Titre</strong></th>
|
||||
<th class="nombremessages"><strong>Réponses</strong></th>
|
||||
<th class="nombrevu"><strong>Vus</strong></th>
|
||||
<th class="auteur"><strong>Auteur</strong></th>
|
||||
<th class="derniermessage"><strong>Dernier message </strong></th>
|
||||
</tr>
|
||||
<?php
|
||||
//On lance la boucle
|
||||
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
//Ah bah tiens... re vla l'echo de fou
|
||||
if ($data['topic_locked'] == 1) {
|
||||
echo'<tr><td><img src="./images/message.png" alt="Message" /><img src="./images/lock.png" alt="Verrouillé" /></td>
|
||||
|
||||
<td class="titre">
|
||||
<strong><a href="./voirtopic.php?t='.$data['topic_id'].'"
|
||||
title="Topic commencé à
|
||||
'.date('H\hi \l\e d M,y',$data['topic_time']).'">
|
||||
'.stripslashes(htmlspecialchars($data['topic_titre'])).'</a></strong></td>
|
||||
|
||||
<td class="nombremessages">'.$data['topic_post'].'</td>
|
||||
|
||||
<td class="nombrevu">'.$data['topic_vu'].'</td>
|
||||
|
||||
<td><a href="./voirprofil.php?m='.$data['topic_createur'].'
|
||||
&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo_createur'])).'</a></td>';
|
||||
}
|
||||
else {
|
||||
echo'<tr><td><img src="./images/message.png" alt="Message" /><img src="./images/unlock.png" alt="Pas verrouillé" /></td>
|
||||
|
||||
<td class="titre">
|
||||
<strong><a href="./voirtopic.php?t='.$data['topic_id'].'"
|
||||
title="Topic commencé à
|
||||
'.date('H\hi \l\e d M,y',$data['topic_time']).'">
|
||||
'.stripslashes(htmlspecialchars($data['topic_titre'])).'</a></strong></td>
|
||||
|
||||
<td class="nombremessages">'.$data['topic_post'].'</td>
|
||||
|
||||
<td class="nombrevu">'.$data['topic_vu'].'</td>
|
||||
|
||||
<td><a href="./voirprofil.php?m='.$data['topic_createur'].'
|
||||
&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo_createur'])).'</a></td>';
|
||||
}
|
||||
//Selection dernier message
|
||||
$nombreDeMessagesParPage = 15;
|
||||
$nbr_post = $data['topic_post'] +1;
|
||||
$page = ceil($nbr_post / $nombreDeMessagesParPage);
|
||||
|
||||
echo '<td class="derniermessage">Par
|
||||
<a href="./voirprofil.php?m='.$data['post_createur'].'
|
||||
&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo_last_posteur'])).'</a><br />
|
||||
A <a href="./voirtopic.php?t='.$data['topic_id'].'&page='.$page.'#p_'.$data['post_id'].'">'.date('H\hi \l\e d M y',$data['post_time']).'</a></td></tr>';
|
||||
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
else //S'il n'y a pas de message
|
||||
{
|
||||
echo'<p>Ce forum ne contient aucun sujet actuellement</p>';
|
||||
}
|
||||
$query->CloseCursor();
|
||||
?>
|
||||
</div>
|
||||
</body></html>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1a809e3953912f98430d657b6198c462ff47174f
|
||||
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Profil";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
|
||||
//On récupère la valeur de nos variables passées par URL
|
||||
$action = isset($_GET['action'])?htmlspecialchars($_GET['action']):'consulter';
|
||||
$membre = isset($_GET['m'])?(int) $_GET['m']:'';
|
||||
//On regarde la valeur de la variable $action
|
||||
switch($action) {
|
||||
//Si c'est "consulter"
|
||||
case "consulter":
|
||||
//On récupère les infos du membre
|
||||
$query=$db->prepare('SELECT membre_pseudo, membre_avatar,
|
||||
membre_email, membre_twitch, membre_signature, membre_siteweb, membre_post,
|
||||
membre_inscrit, membre_localisation, membre_prive, membre_rang, membre_emailprive, membre_steam, membre_tsuid, membre_lol, membre_r6
|
||||
FROM forum_membres WHERE membre_id=:membre');
|
||||
$query->bindValue(':membre',$membre, PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
if ($data['membre_prive'] and $membre != $id) erreur(ERR_PRIVE);
|
||||
|
||||
//On affiche les infos sur le membre
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> -->
|
||||
profil de '.stripslashes(htmlspecialchars($data['membre_pseudo']));
|
||||
echo'<h1>Profil de '.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</h1>';
|
||||
|
||||
echo'<img src="./images/avatars/'.$data['membre_avatar'].'"
|
||||
alt="Ce membre n\'a pas d\'avatar" />';
|
||||
|
||||
if ($id == $membre) {
|
||||
echo'<p> </p><a href="./voirprofil.php?action=modifier"><img src="./images/edit.png" alt="Editer" title="Editer ce message" /></a>';
|
||||
}
|
||||
|
||||
if ($data['membre_rang'] == 5) {
|
||||
$rang = "Administrateur";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 4) {
|
||||
$rang = "Modérateur";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 3) {
|
||||
$rang = "KT";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 2) {
|
||||
$rang = "Membre";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 1) {
|
||||
$rang = "Visiteur";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 0) {
|
||||
$rang = "Banni";
|
||||
}
|
||||
else {
|
||||
$rang = "Inconnu";
|
||||
}
|
||||
|
||||
echo'<p><strong>Grade:</strong> '.$rang.'<br />';
|
||||
|
||||
echo'<strong>Adresse E-Mail : </strong>';
|
||||
if ($data['membre_emailprive'] == 0) {
|
||||
echo'<a href="mailto:'.stripslashes($data['membre_email']).'">
|
||||
'.stripslashes(htmlspecialchars($data['membre_email'])).'</a><br />';
|
||||
}
|
||||
else {
|
||||
echo'Privé</br>';
|
||||
}
|
||||
|
||||
if ($data['membre_twitch'] != '') {
|
||||
echo'<strong>Chaine Twitch: </strong><a href="https://twitch.tv/'.stripslashes(htmlspecialchars($data['membre_twitch'])).'">twitch.tv/'.stripslashes(htmlspecialchars($data['membre_twitch'])).'</a><br />';
|
||||
}
|
||||
if ($data['membre_steam'] != NULL) {
|
||||
echo'<strong>Profil steam: </strong><a href="'.stripslashes(htmlspecialchars($data['membre_steam'])).'">'.stripslashes(htmlspecialchars($data['membre_steam'])).'</a><br />';
|
||||
}
|
||||
if ($data['membre_siteweb'] != '') {
|
||||
echo'<strong>Site Web : </strong><a href="http://'.stripslashes($data['membre_siteweb']).'" target=_blank>'.stripslashes(htmlspecialchars($data['membre_siteweb'])).'</a><br />';
|
||||
}
|
||||
|
||||
if ($data['membre_r6'] != NULL) {
|
||||
echo'<strong>Pseudo R6: </strong>'.stripslashes(htmlspecialchars($data['membre_r6'])).'</a><br />';
|
||||
}
|
||||
|
||||
if ($data['membre_lol'] != NULL) {
|
||||
echo'<strong>Pseudo Riot: </strong>'.stripslashes(htmlspecialchars($data['membre_lol'])).'</a><br />';
|
||||
}
|
||||
echo'<br /><br />';
|
||||
|
||||
if ($data['membre_post'] != 0 and $data['membre_post'] != 1) {
|
||||
echo'Ce membre est inscrit depuis le <strong>'.date('d/m/Y',$data['membre_inscrit']).'</strong> et a posté <strong>'.$data['membre_post'].'</strong> messages<br /><br />';
|
||||
}
|
||||
elseif ($data['membre_post'] == 1) {
|
||||
echo'Ce membre est inscrit depuis le <strong>'.date('d/m/Y',$data['membre_inscrit']).'</strong> et n\'a posté qu\'<strong>'.$data['membre_post'].'</strong> message<br /><br />';
|
||||
}
|
||||
else {
|
||||
echo'Ce membre est inscrit depuis le <strong>'.date('d/m/Y',$data['membre_inscrit']).'</strong> et n\'a posté aucun message<br /><br />';
|
||||
}
|
||||
echo'<strong>Localisation : </strong>'.stripslashes(htmlspecialchars($data['membre_localisation'])).'</p>';
|
||||
$query->CloseCursor();
|
||||
break;
|
||||
|
||||
//Si on choisit de modifier son profil
|
||||
case "modifier":
|
||||
if (empty($_POST['sent'])) // Si on la variable est vide, on peut considérer qu'on est sur la page de formulaire
|
||||
{
|
||||
//On commence par s'assurer que le membre est connecté
|
||||
if ($id==0) erreur(ERR_IS_NOT_CO);
|
||||
|
||||
//On prend les infos du membre
|
||||
$query=$db->prepare('SELECT membre_pseudo, membre_email,
|
||||
membre_siteweb, membre_signature, membre_twitch, membre_localisation,
|
||||
membre_avatar, membre_prive, membre_steam, membre_lol, membre_r6, membre_tsuid
|
||||
FROM forum_membres WHERE membre_id=:id');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Modification du profil';
|
||||
echo '<h1>Modifier son profil</h1>';
|
||||
|
||||
echo '<form method="post" action="voirprofil.php?action=modifier" enctype="multipart/form-data">
|
||||
|
||||
|
||||
<fieldset><legend>Identifiants</legend>
|
||||
Pseudo : <strong>'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</strong><br />
|
||||
<label for="password" style="width: 200px;">Nouveau mot de Passe :</label>
|
||||
<input placeholder="Nouveau mot de passe" type="password" name="password" id="password" /><br />
|
||||
<label for="confirm" style="width: 200px;">Confirmer le mot de passe :</label>
|
||||
<input placeholder="Confirmer le mot de passe" type="password" name="confirm" id="confirm" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend>Contacts</legend>
|
||||
<label for="email">Votre adresse E_Mail :</label>
|
||||
<input type="text" name="email" id="email"
|
||||
value="'.stripslashes($data['membre_email']).'" /><br />
|
||||
|
||||
<label for="twitch">Votre pseudo Twitch :</label>
|
||||
<input type="text" name="twitch" id="twitch"
|
||||
value="'.stripslashes($data['membre_twitch']).'" /><br />
|
||||
|
||||
<label for="website">Votre site web :</label>
|
||||
<input type="text" name="website" id="website"
|
||||
value="'.stripslashes($data['membre_siteweb']).'" /><br />
|
||||
|
||||
<label for="website">Votre profil steam :</label>
|
||||
<input type="text" name="steam" id="steam"
|
||||
value="'.stripslashes($data['membre_steam']).'" /><br />
|
||||
|
||||
<label for="website">Votre pseudo Riot: </label>
|
||||
<input type="text" name="lol" id="lol"
|
||||
value="'.stripslashes($data['membre_lol']).'" /><br />
|
||||
|
||||
<label for="website">Votre pseudo R6: </label>
|
||||
<input type="text" name="r6" id="r6"
|
||||
value="'.stripslashes($data['membre_r6']).'" /><br />';
|
||||
|
||||
if ($data['membre_tsuid'] == NULL) {
|
||||
echo '<label for="website">Liez votre Teamspeak avec le forum:</label>
|
||||
<a href="./verifts.php" style="text-decoration: none; color: white;"><div id="bouton" style="padding:0px">Verif TS</div></a><br />';
|
||||
}
|
||||
else {
|
||||
echo '<label for="website">Pour re-lier votre TS avec le site : </label>
|
||||
<a href="./verifts.php" style="text-decoration: none; color: white;"><div id="bouton" style="padding:0px">Verif TS</div></a><br />';
|
||||
}
|
||||
|
||||
echo '</fieldset>
|
||||
|
||||
<fieldset><legend>Informations supplémentaires</legend>
|
||||
<label for="localisation">Localisation :</label>
|
||||
<input type="text" name="localisation" id="localisation"
|
||||
value="'.stripslashes($data['membre_localisation']).'" /><br />
|
||||
</fieldset>
|
||||
|
||||
<fieldset><legend>Profil sur le forum</legend>
|
||||
<label for="avatar">Changer votre avatar :</label>
|
||||
<input type="file" name="avatar" id="avatar" />
|
||||
(Taille max : 10 ko)<br /><br />
|
||||
<label><input type="checkbox" name="delete" value="Delete" />
|
||||
Supprimer l\'avatar</label>
|
||||
Avatar actuel :
|
||||
<img src="./images/avatars/'.$data['membre_avatar'].'"
|
||||
alt="pas d avatar" />
|
||||
|
||||
<br /><br />
|
||||
<label for="signature">Signature :</label>
|
||||
<textarea maxlength="200" placeholder="La signature est limitée à 200 caractères" cols="40" rows="4" name="signature" id="signature">
|
||||
'.stripslashes($data['membre_signature']).'</textarea>';
|
||||
if ($data['membre_prive'] == 1) {
|
||||
echo '<p>Profil privé ? <input type="checkbox" checked="checked" name="prive" value="on"></p>';
|
||||
}
|
||||
else {
|
||||
echo '<p>Profil privé ? <input type="checkbox" name="prive" value="on"></p>';
|
||||
}
|
||||
echo '</fieldset>
|
||||
<p>
|
||||
<input type="submit" value="Modifier son profil" />
|
||||
<input type="hidden" id="sent" name="sent" value="1" />
|
||||
</p></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
else //Cas du traitement
|
||||
{
|
||||
//On déclare les variables
|
||||
|
||||
$mdp_erreur = NULL;
|
||||
$email_erreur1 = NULL;
|
||||
$email_erreur2 = NULL;
|
||||
$twitch_erreur = NULL;
|
||||
$signature_erreur = NULL;
|
||||
$avatar_erreur = NULL;
|
||||
$avatar_erreur1 = NULL;
|
||||
$avatar_erreur2 = NULL;
|
||||
$avatar_erreur3 = NULL;
|
||||
|
||||
//Encore et toujours notre belle variable $i :p
|
||||
$i = 0;
|
||||
$temps = time();
|
||||
$signature = $_POST['signature'];
|
||||
$email = $_POST['email'];
|
||||
$twitch = $_POST['twitch'];
|
||||
$website = $_POST['website'];
|
||||
$steam = $_POST['steam'];
|
||||
$lol = $_POST['lol'];
|
||||
$r6 = $_POST['r6'];
|
||||
$localisation = $_POST['localisation'];
|
||||
$pass = md5($_POST['password']);
|
||||
$confirm = md5($_POST['confirm']);
|
||||
|
||||
//Vérification du mdp
|
||||
if ($pass != $confirm)
|
||||
{
|
||||
$mdp_erreur = "Votre mot de passe et votre confirmation sont différents";
|
||||
$i++;
|
||||
}
|
||||
//Vérification de l'adresse email
|
||||
//Il faut que l'adresse email n'ait jamais été utilisée (sauf si elle n'a pas été modifiée)
|
||||
|
||||
//On commence donc par récupérer le mail
|
||||
$query=$db->prepare('SELECT membre_email FROM forum_membres WHERE membre_id =:id');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
if (strtolower($data['membre_email']) != strtolower($email))
|
||||
{
|
||||
//Il faut que l'adresse email n'ait jamais été utilisée
|
||||
$query=$db->prepare('SELECT COUNT(*) AS nbr FROM forum_membres WHERE membre_email =:mail');
|
||||
$query->bindValue(':mail',$email,PDO::PARAM_STR);
|
||||
$query->execute();
|
||||
$mail_free=($query->fetchColumn()==0)?1:0;
|
||||
$query->CloseCursor();
|
||||
if(!$mail_free)
|
||||
{
|
||||
$email_erreur1 = "Votre adresse email est déjà utilisé par un membre";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//On vérifie la forme maintenant
|
||||
if (!preg_match("#^[a-z0-9A-Z._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $email) || empty($email))
|
||||
{
|
||||
$email_erreur2 = "Votre nouvelle adresse E-Mail n'a pas un format valide";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
//Verif steam
|
||||
if (substr($steam, -1) == "/") {
|
||||
$steam = substr($steam, 0, -1);
|
||||
}
|
||||
|
||||
//Vérification de la signature
|
||||
if (strlen($signature) > 200)
|
||||
{
|
||||
$signature_erreur = "Votre nouvelle signature est trop longue";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
//Vérification de l'avatar
|
||||
|
||||
if (!empty($_FILES['avatar']['size']))
|
||||
{
|
||||
//On définit les variables :
|
||||
$maxsize = 30072; //Poid de l'image
|
||||
$maxwidth = 100; //Largeur de l'image
|
||||
$maxheight = 100; //Longueur de l'image
|
||||
//Liste des extensions valides
|
||||
$extensions_valides = array( 'jpg' , 'jpeg' , 'png' , 'png', 'bmp' );
|
||||
|
||||
if ($_FILES['avatar']['error'] > 0)
|
||||
{
|
||||
$avatar_erreur = "Erreur lors du tranfsert de l'avatar : ";
|
||||
}
|
||||
if ($_FILES['avatar']['size'] > $maxsize)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur1 = "Le fichier est trop gros :
|
||||
(<strong>".$_FILES['avatar']['size']." Octets</strong>
|
||||
contre <strong>".$maxsize." Octets</strong>)";
|
||||
}
|
||||
|
||||
$image_sizes = getimagesize($_FILES['avatar']['tmp_name']);
|
||||
if ($image_sizes[0] > $maxwidth OR $image_sizes[1] > $maxheight)
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur2 = "Image trop large ou trop longue :
|
||||
(<strong>".$image_sizes[0]."x".$image_sizes[1]."</strong> contre
|
||||
<strong>".$maxwidth."x".$maxheight."</strong>)";
|
||||
}
|
||||
|
||||
$extension_upload = strtolower(substr( strrchr($_FILES['avatar']['name'], '.') ,1));
|
||||
if (!in_array($extension_upload,$extensions_valides) )
|
||||
{
|
||||
$i++;
|
||||
$avatar_erreur3 = "Extension de l'avatar incorrecte";
|
||||
}
|
||||
}
|
||||
|
||||
//Prive ou pas
|
||||
if (isset($_POST['prive'])) {
|
||||
$prive = 1;
|
||||
}
|
||||
else {
|
||||
$prive = 0;
|
||||
}
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Modification du profil';
|
||||
|
||||
|
||||
if ($i == 0) // Si $i est vide, il n'y a pas d'erreur
|
||||
{
|
||||
if (!empty($_FILES['avatar']['size']))
|
||||
{
|
||||
$nomavatar=move_avatar($_FILES['avatar']);
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_avatar = :avatar
|
||||
WHERE membre_id = :id');
|
||||
$query->bindValue(':avatar',$nomavatar,PDO::PARAM_STR);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
//Une nouveauté ici : on peut choisis de supprimer l'avatar
|
||||
if (isset($_POST['delete']))
|
||||
{
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_avatar=0 WHERE membre_id = :id');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
echo'<h1>Modification terminée</h1>';
|
||||
echo'<p>Votre profil a été modifié avec succès !</p>';
|
||||
echo'<p>Cliquez <a href="./index.php">ici</a>
|
||||
pour revenir à la page d accueil</p>';
|
||||
|
||||
//On modifie la table
|
||||
if ($pass != 'd41d8cd98f00b204e9800998ecf8427e') {
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_mdp = :mdp, membre_email=:mail, membre_twitch=:twitch, membre_siteweb=:website, membre_lol=:lol, membre_r6=:r6 ,membre_signature=:sign, membre_localisation=:loc, membre_prive=:prive
|
||||
WHERE membre_id=:id');
|
||||
$query->bindValue(':mdp',$pass,PDO::PARAM_INT);
|
||||
$query->bindValue(':mail',$email,PDO::PARAM_STR);
|
||||
$query->bindValue(':twitch',$twitch,PDO::PARAM_STR);
|
||||
$query->bindValue(':website',$website,PDO::PARAM_STR);
|
||||
$query->bindValue(':steam',$steam,PDO::PARAM_STR);
|
||||
$query->bindValue(':lol',$lol,PDO::PARAM_STR);
|
||||
$query->bindValue(':r6',$r6,PDO::PARAM_STR);
|
||||
$query->bindValue(':sign',$signature,PDO::PARAM_STR);
|
||||
$query->bindValue(':loc',$localisation,PDO::PARAM_STR);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':prive',$prive,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
else {
|
||||
$query=$db->prepare('UPDATE forum_membres
|
||||
SET membre_email=:mail, membre_twitch=:twitch, membre_siteweb=:website, membre_signature=:sign, membre_localisation=:loc, membre_prive=:prive, membre_steam=:steam, membre_lol=:lol, membre_r6=:r6
|
||||
WHERE membre_id=:id');
|
||||
$query->bindValue(':mail',$email,PDO::PARAM_STR);
|
||||
$query->bindValue(':twitch',$twitch,PDO::PARAM_STR);
|
||||
$query->bindValue(':website',$website,PDO::PARAM_STR);
|
||||
$query->bindValue(':steam',$steam,PDO::PARAM_STR);
|
||||
$query->bindValue(':lol',$lol,PDO::PARAM_STR);
|
||||
$query->bindValue(':r6',$r6,PDO::PARAM_STR);
|
||||
$query->bindValue(':sign',$signature,PDO::PARAM_STR);
|
||||
$query->bindValue(':loc',$localisation,PDO::PARAM_STR);
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':prive',$prive,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<h1>Modification interrompue</h1>';
|
||||
echo'<p>Une ou plusieurs erreurs se sont produites pendant la modification du profil</p>';
|
||||
echo'<p>'.$i.' erreur(s)</p>';
|
||||
echo'<p>'.$mdp_erreur.'</p>';
|
||||
echo'<p>'.$email_erreur1.'</p>';
|
||||
echo'<p>'.$email_erreur2.'</p>';
|
||||
echo'<p>'.$twitch_erreur.'</p>';
|
||||
echo'<p>'.$signature_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur.'</p>';
|
||||
echo'<p>'.$avatar_erreur1.'</p>';
|
||||
echo'<p>'.$avatar_erreur2.'</p>';
|
||||
echo'<p>'.$avatar_erreur3.'</p>';
|
||||
echo'<p> Cliquez <a href="./voirprofil.php?action=modifier">ici</a> pour recommencer</p>';
|
||||
}
|
||||
} //Fin du else
|
||||
break;
|
||||
|
||||
default; //Si jamais c'est aucun de ceux là c'est qu'il y a eu un problème :o
|
||||
echo'<p>Cette action est impossible</p>';
|
||||
|
||||
} //Fin du switch
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
db93a4d06413b827f665dc5c6024ee8b5392ee9a
|
||||
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
session_start();
|
||||
$titre="Voir un sujet";
|
||||
include("includes/identifiants.php");
|
||||
include("includes/debut.php");
|
||||
include("includes/bbcode.php"); //On verra plus tard ce qu'est ce fichier
|
||||
|
||||
//On récupère la valeur de t
|
||||
$topic = (int) $_GET['t'];
|
||||
|
||||
if ($id != 0) {
|
||||
$query=$db->prepare('SELECT COUNT(*) FROM `forum_email` WHERE `membre_id` = :id AND `topic_id` = :topic');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$topic_sub = $query->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
|
||||
$query=$db->prepare('SELECT COUNT(*) FROM `forum_email` WHERE `membre_id` = :id AND `forum_all` = 1');
|
||||
$query->bindValue(':id',$id,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$forumall = $query->fetchColumn();
|
||||
$query->CloseCursor();
|
||||
}
|
||||
|
||||
//A partir d'ici, on va compter le nombre de messages pour n'afficher que les 15 premiers
|
||||
$query=$db->prepare('SELECT topic_titre, topic_post, forum_topic.forum_id, topic_last_post,
|
||||
forum_name, auth_view, auth_topic, auth_post, auth_modo, topic_locked
|
||||
FROM forum_topic
|
||||
LEFT JOIN forum_forum ON forum_topic.forum_id = forum_forum.forum_id
|
||||
WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
|
||||
if (!verif_auth($data['auth_view']))
|
||||
{
|
||||
erreur(ERR_AUTH_VIEW);
|
||||
}
|
||||
|
||||
$forum=$data['forum_id'];
|
||||
$totalDesMessages = $data['topic_post'] + 1;
|
||||
$nombreDeMessagesParPage = $config['post_par_page'];
|
||||
$nombreDePages = ceil($totalDesMessages / $nombreDeMessagesParPage);
|
||||
|
||||
echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> -->
|
||||
<a href="./voirforum.php?f='.$forum.'">'.stripslashes(htmlspecialchars($data['forum_name'])).'</a>
|
||||
--> <a href="./voirtopic.php?t='.$topic.'">'.stripslashes(htmlspecialchars($data['topic_titre'])).'</a>';
|
||||
if ($id != 0) {
|
||||
if ($forumall > 0 && $topic_sub > 0) {
|
||||
echo'<a href="./notifemail.php?action=delete&all=1&t='.$topic.'"><img src="./images/alarm.png" alt="go" style="float:right;"/></a>';
|
||||
}
|
||||
|
||||
elseif ($forumall > 0) {
|
||||
echo'<a href="./notifemail.php?action=delete&all=1"><img src="./images/alarm.png" alt="go" style="float:right;"/></a>';
|
||||
}
|
||||
|
||||
elseif ($topic_sub > 0) {
|
||||
echo'<a href="./notifemail.php?action=delete&t='.$topic.'"><img src="./images/alarm.png" alt="go" style="float:right;"/></a>';
|
||||
}
|
||||
else {
|
||||
echo'<a href="./notifemail.php?action=add&t='.$topic.'"><img src="./images/no-alarm.png" alt="go" style="float:right;"/></a>';
|
||||
}
|
||||
}
|
||||
echo '<h1>'.stripslashes(htmlspecialchars($data['topic_titre'])).'</h1>';
|
||||
|
||||
//Nombre de pages
|
||||
$page = (isset($_GET['page']))?intval($_GET['page']):1;
|
||||
|
||||
$premierMessageAafficher = ($page - 1) * $nombreDeMessagesParPage;
|
||||
|
||||
|
||||
if (!verif_auth($data['auth_post']) OR $data['topic_locked'] == 1) {
|
||||
//On affiche l'image répondre
|
||||
echo'<img src="./images/pasanswer.png" alt="Pas Répondre" title="Vous ne pouvez pas répondre à ce topic"></a>';
|
||||
}
|
||||
|
||||
else {
|
||||
echo'<a href="./poster.php?action=repondre&t='.$topic.'">
|
||||
<img src="./images/answer.png" alt="Répondre" title="Répondre à ce topic"></a>';
|
||||
}
|
||||
|
||||
if ($data['topic_locked'] == 1) {
|
||||
if (verif_auth($data['auth_modo'])) {
|
||||
echo'<a href="./postok.php?action=unlock&t='.$topic.'">
|
||||
<img src="./images/lock.png" alt="deverrouiller" title="Déverrouiller ce sujet ?" /></a>';
|
||||
}
|
||||
else {
|
||||
echo'<img src="./images/lock.png" alt="verrouille" title="Ce sujet est verrouillé" />';
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
if (verif_auth($data['auth_modo'])) {
|
||||
echo'<a href="./postok.php?action=lock&t='.$topic.'">
|
||||
<img src="./images/unlock.png" alt="verrouiller" title="Verrouiller ce sujet ?" /></a>';
|
||||
}
|
||||
else {
|
||||
echo'<img src="./images/unlock.png" alt="pasverouille" title="Le topic n\'est pas verrouillé.">';
|
||||
}
|
||||
}
|
||||
|
||||
$query=$db->prepare('SELECT auth_modo FROM forum_forum WHERE forum_id = :forum');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
if (verif_auth($data['auth_modo'])) {
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('SELECT forum_id, forum_name FROM forum_forum WHERE forum_id <> :forum');
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
//$forum a été définie tout en haut de la page !
|
||||
echo'<p style="margin-bottom: 0px;">Déplacer vers :</p>
|
||||
<form method="post" action=postok.php?action=deplacer&t='.$topic.'>
|
||||
<select name="dest">';
|
||||
while($data=$query->fetch()) {
|
||||
echo'<option value='.$data['forum_id'].' id='.$data['forum_id'].'>'.$data['forum_name'].'</option>';
|
||||
}
|
||||
echo'
|
||||
</select>
|
||||
<input type="hidden" name="from" value='.$forum.'>
|
||||
<input type="submit" name="submit" value="Envoyer" />
|
||||
</form>';
|
||||
$query->CloseCursor();
|
||||
$query=$db->prepare('SELECT topic_locked FROM forum_topic WHERE topic_id =:topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$data=$query->fetch();
|
||||
if ($data['topic_locked']==1) {
|
||||
echo '<p style="margin-bottom: 0px;">Réponse automatique :</p>
|
||||
<form method="post" action=postok.php?action=autorep&t='.$topic.'>
|
||||
<select name="rep">';
|
||||
$query=$db->query('SELECT automess_id, automess_titre
|
||||
FROM forum_automess');
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
echo '<option value="'.$data['automess_id'].'">
|
||||
'.$data['automess_titre'].'</option>';
|
||||
}
|
||||
echo '</select>
|
||||
<input type="submit" name="submit" value="Envoyer" /></form>';
|
||||
$query->CloseCursor();
|
||||
}
|
||||
}
|
||||
//Enfin on commence la boucle !
|
||||
$query=$db->prepare('SELECT post_id , auth_modo , post_createur , post_texte , post_time ,
|
||||
membre_id, membre_pseudo, membre_inscrit, membre_avatar, membre_localisation, membre_post, membre_signature, membre_rang, topic_locked
|
||||
FROM forum_post
|
||||
LEFT JOIN forum_membres ON forum_membres.membre_id = forum_post.post_createur
|
||||
LEFT JOIN forum_topic ON forum_topic.topic_id = :topic
|
||||
LEFT JOIN forum_forum ON forum_forum.forum_id = :forum
|
||||
WHERE forum_post.topic_id =:topic
|
||||
ORDER BY post_id
|
||||
LIMIT :premier, :nombre');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->bindValue(':forum',$forum,PDO::PARAM_INT);
|
||||
$query->bindValue(':premier',(int) $premierMessageAafficher,PDO::PARAM_INT);
|
||||
$query->bindValue(':nombre',(int) $nombreDeMessagesParPage,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
//On vérifie que la requête a bien retourné des messages
|
||||
if ($query->rowCount()<1)
|
||||
{
|
||||
echo'<p>Il n y a aucun post sur ce topic, vérifiez l\'url et reessayez</p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//Si tout roule on affiche notre tableau puis on remplit avec une boucle
|
||||
?><table>
|
||||
<tr>
|
||||
<th class="vt_auteur"><strong>Auteurs</strong></th>
|
||||
<th class="vt_mess"><strong>Messages</strong></th>
|
||||
</tr>
|
||||
<?php
|
||||
while ($data = $query->fetch())
|
||||
{
|
||||
//On commence à afficher le pseudo du créateur du message :
|
||||
//On vérifie les droits du membre
|
||||
//(partie du code commentée plus tard)
|
||||
echo'<tr><td><strong>
|
||||
<a href="./voirprofil.php?m='.$data['membre_id'].'&action=consulter">
|
||||
'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</a></strong></td>';
|
||||
|
||||
/* Si on est l'auteur du message, on affiche des liens pour
|
||||
Modérer celui-ci.
|
||||
Les modérateurs pourront aussi le faire, il faudra donc revenir sur
|
||||
ce code un peu plus tard ! */
|
||||
|
||||
if (verif_auth($data['auth_modo']) OR $data['post_createur'] == $id) {
|
||||
echo'<td id=p_'.$data['post_id'].'>Posté à '.date('H\hi \l\e d m y',$data['post_time']).'
|
||||
<a href="./poster.php?p='.$data['post_id'].'&action=delete">
|
||||
<img src="./images/delete.png" alt="Supprimer"
|
||||
title="Supprimer ce message" /></a>
|
||||
<a href="./poster.php?p='.$data['post_id'].'&action=edit">
|
||||
<img src="./images/edit.png" alt="Editer"
|
||||
title="Editer ce message" /></a></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo'<td>
|
||||
Posté à '.date('H\hi \l\e d m y',$data['post_time']).'
|
||||
</td></tr>';
|
||||
}
|
||||
|
||||
if ($data['membre_rang'] == 5) {
|
||||
$rang = "Administrateur";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 4) {
|
||||
$rang = "Modérateur";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 3) {
|
||||
$rang = "KT";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 2) {
|
||||
$rang = "Membre";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 1) {
|
||||
$rang = "Visiteur";
|
||||
}
|
||||
elseif ($data['membre_rang'] == 0) {
|
||||
$rang = "Banni";
|
||||
}
|
||||
else {
|
||||
$rang = "Inconnu";
|
||||
}
|
||||
|
||||
//Détails sur le membre qui a posté
|
||||
echo'<tr><td>
|
||||
<img style="width:32px;" src="./images/avatars/'.$data['membre_avatar'].'" alt="" />
|
||||
<br />Membre inscrit le '.date('d/m/Y',$data['membre_inscrit']).'
|
||||
<br />Messages : '.$data['membre_post'].'
|
||||
<br />Localisation : '.stripslashes(htmlspecialchars($data['membre_localisation'])).'
|
||||
<br/>Grade : '.$rang.'</td>';
|
||||
|
||||
//Message
|
||||
echo'<td><p>'.code(nl2br(stripslashes(htmlspecialchars($data['post_texte'])))).'</p>
|
||||
<br /><hr />'.code(nl2br(stripslashes(htmlspecialchars($data['membre_signature'])))).'</td></tr>';
|
||||
} //Fin de la boucle ! \o/
|
||||
$query->CloseCursor();
|
||||
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
echo '<p>Page : ';
|
||||
echo get_list_page($page, $nombreDePages, './voirtopic.php?t='.$topic);
|
||||
echo'</p>';
|
||||
|
||||
//On ajoute 1 au nombre de visites de ce topic
|
||||
$query=$db->prepare('UPDATE forum_topic
|
||||
SET topic_vu = topic_vu + 1 WHERE topic_id = :topic');
|
||||
$query->bindValue(':topic',$topic,PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
$query->CloseCursor();
|
||||
|
||||
} //Fin du if qui vérifiait si le topic contenait au moins un message
|
||||
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
3f7f3366a896a9c8944ca70ed3ad699f75873280
|
||||
@@ -1 +0,0 @@
|
||||
9d91de49ecf28244fde02aaa2a5b259d6a9e8de8
|
||||
@@ -1 +0,0 @@
|
||||
26641b0705f35e183bf216af86ec689bba74bd8c
|
||||
@@ -1 +0,0 @@
|
||||
174dc312af3b05b6ad92090be3d88472f2609202
|
||||
@@ -1 +0,0 @@
|
||||
d78d00669adfe6ff6d14cd422b0c8ffcdc35f3e3
|
||||
@@ -1 +0,0 @@
|
||||
e5f4cccd8aef160e86570ff330ef5b6ad6b12831
|
||||
@@ -1 +0,0 @@
|
||||
53ccf66bbdc4d55a47d0c6d87ccdacba8705c382
|
||||
@@ -1 +0,0 @@
|
||||
7d56b0d251a33c95cc7dc404c3ff29a041745108
|
||||
@@ -1 +0,0 @@
|
||||
5b934e0e271a0dfb7a4fd7dbd2a09f273322c13d
|
||||
@@ -1 +0,0 @@
|
||||
5edb2c9056e4583277f9c43f16a758e506efb2eb
|
||||
@@ -1 +0,0 @@
|
||||
6c5d118e64a9438e40d747d38875a11e26c3ab9c
|
||||
@@ -1 +0,0 @@
|
||||
0519475b63ec08b6f810389928f03f1d07491251
|
||||
@@ -1 +0,0 @@
|
||||
15f16058734284b6dfc96a001969214ae7777917
|
||||
@@ -1 +0,0 @@
|
||||
a31190e0dae4b950b8dc61bd1bae4c104720c7f5
|
||||
@@ -1 +0,0 @@
|
||||
5e8ed26590b85c6a99e92a6a660d27fb37aac2f6
|
||||
@@ -1 +0,0 @@
|
||||
c8e9e0294caf0deb178cf0992d03ef03da068f65
|
||||
@@ -1 +0,0 @@
|
||||
5b451f941de00eeaf2fba4368015253d03918b94
|
||||
@@ -1 +0,0 @@
|
||||
4248fe7ed61d61066d23baf4076cd01fc8cbf344
|
||||
@@ -1 +0,0 @@
|
||||
8249f4078857ffa41c843974b07f5192bd674983
|
||||
@@ -1 +0,0 @@
|
||||
a16250af80a4745bc25f56266bc02d18db227330
|
||||
@@ -1 +0,0 @@
|
||||
b2e5bf65d337b8ac2cd4165d0cfad53e3f883d1c
|
||||
@@ -1 +0,0 @@
|
||||
083494fba30193dfb4f9d62b7665668e05319bd7
|
||||
@@ -1 +0,0 @@
|
||||
49f2d0cecf5466a1cc01e0cdc8c174e3f7617ebd
|
||||
@@ -1 +0,0 @@
|
||||
10c19ed620b34fc7d9e4d282988c9af856b74144
|
||||
@@ -1 +0,0 @@
|
||||
4e56e63dd0275dcfc9da83318bc5391da8fa79c0
|
||||
@@ -1 +0,0 @@
|
||||
285da7344a1af8f633c7e4b8c9e73db71def9597
|
||||
@@ -1 +0,0 @@
|
||||
641052eb98b6a161f80ccab849ef3e0bc485e7a7
|
||||
@@ -1 +0,0 @@
|
||||
41a5f381a6ca3218bcbc970d856412e2f935dbc2
|
||||
@@ -1 +0,0 @@
|
||||
0f7a3200d1402b881cfaa78953f77b60a0b59393
|
||||
@@ -1 +0,0 @@
|
||||
89ec57106d4d62209eed7313dfb96a0a70f8cb94
|
||||
@@ -1 +0,0 @@
|
||||
59d23d045ffc66fc82b6396dbd64fc2de9116b96
|
||||
@@ -1 +0,0 @@
|
||||
45418ae29a22b8f387a3ab8f231a4f93bcaa9f39
|
||||
@@ -1 +0,0 @@
|
||||
ab9031ca38f669e44b7d51c92ec54b2e1ac8f357
|
||||
@@ -1 +0,0 @@
|
||||
9c01c92ee188b0e6655df7b10000eb3105bbc6e9
|
||||
@@ -1 +0,0 @@
|
||||
ed5c740b8a8de358f55786f4e5fc3789b0f24317
|
||||
@@ -1 +0,0 @@
|
||||
10a7e920393253715b520a04d3faf1f2fc3e6371
|
||||
@@ -1 +0,0 @@
|
||||
fd42a7d315149eb06e033c8fb5c209a9bc174c5d
|
||||
@@ -1 +0,0 @@
|
||||
5bc2ea2f63a56e5d39d2c7bf8ab81dd6cbdd6ef7
|
||||
@@ -1 +0,0 @@
|
||||
557140c4cf47d6ef6385e3724e09bc00b122f4bf
|
||||
@@ -1 +0,0 @@
|
||||
a4ebd595c390b4598698e4d6dccdb2c9a0dfa5f2
|
||||
@@ -1 +0,0 @@
|
||||
c1e12d45c369cfafde7e83a287ea2fc4cca93742
|
||||
@@ -1 +0,0 @@
|
||||
7c8c482a6db5a1cc3ee308278663b724e05d5150
|
||||
@@ -1 +0,0 @@
|
||||
c26eeaeb8e7c65b3b1af4ccc509b5144ae13f3b0
|
||||
@@ -1 +0,0 @@
|
||||
8fa0e7daf032e3f0bb8707331e2aa7773a4ed265
|
||||
@@ -1 +0,0 @@
|
||||
988be033d175f68c379a66c530b00206339ff584
|
||||
@@ -1 +0,0 @@
|
||||
038fc90a463a36baa93d5fbdf48f3547cfcf3e28
|
||||
@@ -1 +0,0 @@
|
||||
c0058a87741cbc53c8e75c20a23269545a288998
|
||||
@@ -1 +0,0 @@
|
||||
ff4548926ce79d8d314afd3b1791e51e6a92b1fa
|
||||
@@ -1 +0,0 @@
|
||||
d2d2fc95da296962e60e2c1127dcc9df8d493e0c
|
||||
@@ -1 +0,0 @@
|
||||
0fdf65743d3eb00e93559380378d4d134f11a1ba
|
||||
@@ -1 +0,0 @@
|
||||
192e91e1dab49e83a9d128206d67d359c291659e
|
||||
@@ -1 +0,0 @@
|
||||
1bc74099498868351db101e95dd61afe72350ad9
|
||||
@@ -1 +0,0 @@
|
||||
19b4dcf4881eb032ec8d38db853e18cf79e31cd6
|
||||
@@ -1 +0,0 @@
|
||||
b3c5f5b7f4e7b44a1712225f8aaaf920ad56e305
|
||||
@@ -1 +0,0 @@
|
||||
18eb52b6c9381591b748b51a7bf76d02834b252f
|
||||
@@ -1 +0,0 @@
|
||||
ee030b71c9b397f2148243278fe3b007c52e29f0
|
||||
@@ -1 +0,0 @@
|
||||
68845218a27f6dfffcd3e200d363c3d18abfe111
|
||||
@@ -1 +0,0 @@
|
||||
2c316937a1ee333a3019eff782e954838780531a
|
||||
@@ -1 +0,0 @@
|
||||
5886dd22fcc8f7fb81bdfc045a34ad536f233f9b
|
||||
@@ -1 +0,0 @@
|
||||
aec7fed6c6ff665d52f94f48394a8ed11123f11f
|
||||
@@ -1 +0,0 @@
|
||||
9beefd1b56a82dcb9656e50602e019be866727de
|
||||
@@ -1 +0,0 @@
|
||||
a666bed9e8c9acb6808b0803ac5c40b175c15036
|
||||
@@ -1 +0,0 @@
|
||||
d3cb11040bdba2a35cd1e4fc6cda370a9a36f2b6
|
||||
@@ -1 +0,0 @@
|
||||
7d9ef20b9ceef330a5642b644de92ec3675e1501
|
||||
@@ -1 +0,0 @@
|
||||
e2e24cde0edf79459a18bdcb097bc49321cd8381
|
||||
@@ -1 +0,0 @@
|
||||
d6974fac5977140f257970d0fc37e6a37966b45d
|
||||
@@ -1 +0,0 @@
|
||||
138128dc5c22d508a82e032e5ac483c976ad4db3
|
||||
@@ -1 +0,0 @@
|
||||
8d4b7312c775892b0191493f76d137654a00f748
|
||||
@@ -1 +0,0 @@
|
||||
f0d9fc6c71d486f6c41a2ba507790f1d3ad46bbc
|
||||
@@ -1 +0,0 @@
|
||||
307e81eb5d6d59631ceb478c281044233dae433c
|
||||
@@ -1 +0,0 @@
|
||||
bd88aab06f4919a535f172dc134c24ffb16f0a76
|
||||
@@ -1 +0,0 @@
|
||||
1b74e1691fbfd054653144160cdc2242ac8d59ac
|
||||
@@ -1 +0,0 @@
|
||||
bd43ce5ca8f255d5d59159225fa4e9aca72a5f18
|
||||
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user