MAJ 2021 PHP-SQL

Sortie de mon projet de BTS.
Intégration du PHP qui ne l'a pas été jusqu'à ce jour avec la connexion a une BDD sur le LAN.
Intégration évènement, actualité, compte user connecté a la BDD en mode MVC.
Amélioration de l'intégration…
Nombreux défaut encore présent. il serons amélioré dans le futur
This commit is contained in:
ccunatbrule
2021-10-07 02:07:47 +02:00
parent 5af95bc813
commit a7ae429e83
127 changed files with 1248 additions and 194 deletions

View File

@@ -0,0 +1 @@
/modele/connexion_sql.php

View File

@@ -0,0 +1,2 @@
# Projet d'école de BTS (HTML-CSS-PHP-SQL)
Site web d'une écurie

View File

@@ -1,5 +1,10 @@
<?php
include_once('./vue/header.html');
include_once('./vue/actualite/index.html');
include_once('./vue/footer.html');
?>
include_once('./modele/connexion_sql.php');
if (!isset($_GET['section']) OR $_GET['section'] == 'index')
{
include_once('./controleur/actualite/index.php');
}
include_once('./vue/footer.html');

View File

@@ -1,5 +1,5 @@
<?php
include_once('./vue/header.html');
include_once('./vue/balade/index.html');
include_once('./vue/activite/balade/index.html');
include_once('./vue/footer.html');
?>

View File

@@ -1,5 +1,5 @@
<?php
include_once('./vue/header.html');
include_once('./vue/centre/index.html');
include_once('./vue/information/centre/index.html');
include_once('./vue/footer.html');
?>

View File

@@ -0,0 +1,9 @@
<?php
include_once('./vue/header.html');
include_once('./modele/connexion_sql.php');
if (!isset($_GET['section']) OR $_GET['section'] == 'index')
{
include_once('./controleur/membre/connexion/index.php');
}
include_once('./vue/footer.html');

View File

@@ -1,5 +1,5 @@
<?php
include_once('./vue/header.html');
include_once('./vue/contact/index.html');
include_once('./vue/information/contact/index.html');
include_once('./vue/footer.html');
?>

View File

@@ -0,0 +1,19 @@
<?php
// On demande les 5 derniers billets (mod<6F>le)
include_once('./modele/actualite/model_class.php');
$event1 = get_News(0, 5);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($event1 as $cle => $event)
{
$event1[$cle]['nomevent'] = ($event['nomevent']);
$event1[$cle]['dateevent'] = ($event['dateevent']);
$event1[$cle]['imageevent'] = ($event['imageevent']);
$event1[$cle]['lieuevent'] = ($event['lieuevent']);
$event1[$cle]['descriptionevent'] = ($event['descriptionevent']);
}
// On affiche la page (vue)
include_once('./vue/actualite/index.php');

View File

@@ -0,0 +1,18 @@
<?php
// On demande les 5 derniers billets (mod<6F>le)
include_once('./modele/evenement/model_class.php');
$eventsAll = get_events(0, 5);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($eventsAll as $cle => $event)
{
$events[$cle]['nomevent'] = ($event['nomevent']);
$events[$cle]['dateevent'] = ($event['dateevent']);
$events[$cle]['imageevent'] = ($event['imageevent']);
$events[$cle]['lieuevent'] = ($event['lieuevent']);
$events[$cle]['descriptionevent'] = ($event['descriptionevent']);
}
// On affiche la page (vue)
include_once('./vue/evenement/index.php');

View File

@@ -0,0 +1,76 @@
<?php
include_once('./modele/membre/connexion.php');
$titre="Connexion";
if ($id!=0) erreur(ERR_IS_CO);
if (!isset($_POST['pseudo'])) { //Page de formulaire
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Connexion</h2>
<form method="post" action="connexion.php">
<br><fieldset>
<label class="labelI" for="pseudo">Pseudo :</label><input name="pseudo" type="text" id="pseudo" /><br>
<label class="labelI" for="password">Password :</label><input type="password" name="password" id="password" />
</fieldset><br>
<p class="btns"><input type="submit" value="Connexion" class="button-3" /></p>
</form>
<a href="./inscription.php">Pas encore inscrit ?</a><br><br>
</center>
</div>
</section>
</div>
<?php
}
else { //Check de l'identification
$message='';
$data = check_Password();
if (empty($_POST['pseudo']) || empty($_POST['password']) ) {
$message = '<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Echec de connexion</h2><br>
<p>Une erreur s\'est produite pendant votre identification!</p>
<p>Vous devez remplir tous les champs</p>
<p>Cliquez <a href="./connexion.php">ici</a> pour revenir à la page de connexion.</p></center>
</div>
</section>
</div>';
}
else { //Validation de l'accès
if ($data['mdp'] == /*md5*/($_POST['password'])) {
$_SESSION['pseudo'] = $data['pseudo'];
$_SESSION['privilege'] = $data['privilege'];
$_SESSION['ideleve'] = $data['ideleve'];
$message = '<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Connexion réussie!</h2><br>
<p>Bienvenue '.$data['pseudo'].',<br>Vous êtes maintenant connecté!</p>
<p>Cliquez <a href="./espace_membre.php">ici</a> pour accéder a votre espace membre!</p></center>
</div>
</section>
</div>';
}
else {
$message = '<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Echec de connexion</h2><br>
<p>Une erreur s\'est produite pendant votre identification!</p>
<p>Le mot de passe ou le pseudo entré n\'est pas correct.</p>
<p>Cliquez <a href="./connexion.php">ici</a> pour revenir à la page de connexion.</p></center>
</div>
</section>
</div>';
}
}
echo $message;
}
include_once('./vue/membre/connexion.php');

View File

@@ -0,0 +1,9 @@
<?php
define('VISITEUR',1);
define('INSCRIT',2);
define('MODO',3);
define('ADMIN',4);
define('ERR_IS_CO','Vous ne pouvez pas accéder à cette page si vous n\'êtes pas connecté');
?>

View File

@@ -0,0 +1,23 @@
<?php
include_once('./modele/membre/espace.php');
$titre = "Index du forum";
//Initialisation de deux variables
$totaldesmessages = 0;
$categorie = NULL;
$TotalDesMembres = get_MemberCount();
$data = get_LastMember();
$derniermembre = stripslashes(htmlspecialchars($data['pseudo']));
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Espace Membre</h2><br>
<h5>Qui est en ligne ?</h5>
<p>Le site comptent <strong> <?php echo $TotalDesMembres;?></strong> membres.</p><br>
<a href="./profil.php?m=<?php echo $data['ideleve']?>&amp;action=consulter"><?php echo $derniermembre;?></a> est le dernier membre.</p></center>
</div>
</section>
</div>
<?php
include_once('./vue/membre/espace.php');

View File

@@ -0,0 +1,25 @@
<?php
function erreur($err='')
{
$mess=($err!='')? $err:'Une erreur inconnue s\'est produite';
exit('<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Vous êtes pas autorisé a passer ici</h2><br>
<p> '.$mess.' </p>
<p>Cliquez <a href="./espace_membre.php">ici</a> pour revenir à la page d\'accueil</p>
</div>
</section>
</div>');
}
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;
}
?>

View File

@@ -0,0 +1,137 @@
<?php
include_once('./modele/membre/inscription.php');
$titre="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
{
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Inscription</h2>
<form method="post" action="inscription.php" enctype="multipart/form-data">
<label class="labelI" >*Pseudo</label><br><input name="pseudo" type="text" id="pseudo" placeholder=" Entre 3 à 15 caractères"/><br><br>
<label class="labelI" for="password">*Mot de Passe :</label><input type="password" name="password" id="password" />
<label class="labelI" for="confirm">*Confirmer :</label><input type="password" name="confirm" id="confirm" /><br>
</fieldset>
<label class="labelI" for="email">*Votre adresse email :</label><br><input type="text" name="email" id="email" /><br>
</fieldset>
<label class="labelI" for="localisation">Localisation :</label><br><input type="text" name="localisation" id="localisation" /><br>
</fieldset>
<fieldset><legend class="colorbold marg3 pad1">Profil sur le forum</legend>
<label for="avatar">Choisissez votre avatar :</label><br><input type="file" name="avatar" id="avatar" /><br>(Taille max : 10Ko)
</fieldset><br>
<p class="btns"><input type="submit" value="S'inscrire" class="button-3"/></p><br>
<p>Les champs précédés d'un * sont obligatoires</p>
</form></center>
</div>
</section>
</div>
<?php
}
else //On est dans le cas traitement
{
$pseudo_erreur1 = NULL;$pseudo_erreur2 = NULL;
$email_erreur1 = NULL;$email_erreur2 = NULL;
$avatar_erreur = NULL;$avatar_erreur1 = NULL;
$avatar_erreur2 = NULL;$avatar_erreur3 = NULL;
$mdp_erreur = NULL;
//On récupère les variables
$i = 0;
$pseudo=$_POST['pseudo'];
$email = $_POST['email'];
$localisation = $_POST['localisation'];
$pass = /*md5*/($_POST['password']);
$confirm = /*md5*/($_POST['confirm']);
//Verification des champs formulaire
$pseudo_free = get_checkPseudo();
if(!$pseudo_free)
{
$pseudo_erreur1 = "Votre pseudo est déjà utilisé par un membre";
$i++;
}
if (strlen($pseudo) < 3 || strlen($pseudo) > 15)
{
$pseudo_erreur2 = "Votre pseudo est soit trop grand, soit trop petit";
$i++;
}
if ($pass != $confirm || empty($confirm) || empty($pass))
{
$mdp_erreur = "Votre mot de passe et la confirmation sont diffèrent, ou sont vides";
$i++;
}
$mail_free = get_checkMail();
if(!$mail_free)
{
$email_erreur1 = "Votre adresse email est déjà utilisée par un membre";
$i++;
}
if (!preg_match("#^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}\.[a-z]{2,4}$#", $email) || empty($email))
{
$email_erreur2 = "Votre adresse email n'a pas un format valide";
$i++;
}
if (!empty($_FILES['avatar']['size']))
{
$maxsize = 10024; //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' , 'gif' , 'png', 'bmp' );
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";
}
}
if ($i==0)
{
?>
<center><h2>Inscription terminée</h2>
<p>Bienvenue <?php echo stripslashes(htmlspecialchars($_POST['pseudo'])); ?> vous êtes maintenant inscrit sur le forum!</p>
<p>Cliquez <a href="./espace_membre.php">ici</a> pour revenir dans votre espace membre</p></center>
<?php
$nomavatar=(!empty($_FILES['avatar']['size']))?move_avatar($_FILES['avatar']):'';
post_Registre();
//Et on définit les variables de sessions
$_SESSION['pseudo'] = $pseudo;
$_SESSION['ideleve'] = $bdd->lastInsertId();
$_SESSION['privilege'] = 2;
}
else
{
?>
<center><h2>Inscription interrompue</h2><br>
<h5><?php echo $i; ?> erreurs se sont produites lors de votre incription</h5><br>
<ul>
<p><?php echo $email_erreur1; $email_erreur2; ?></p>
<p><?php echo $pseudo_erreur1; $pseudo_erreur2; ?></p>
<p><?php echo $avatar_erreur1; $avatar_erreur2; ?></p>
<p><?php echo $avatar_erreur3; $avatar_erreur; ?></p>
<p><?php echo $mdp_erreur; ?></p>
</ul><br>
<p>Cliquez <a href="./inscription.php">ici</a> pour recommencer</p></center>
<?php
}
}
include_once('./vue/membre/inscription.php');

View File

@@ -0,0 +1,239 @@
<script>
function bbcode(bbdebut, bbfin)
{
var input = window.document.formulaire.message;
input.focus();
if(typeof document.selection != 'undefined')
{
var range = document.selection.createRange();
var insText = range.text;
range.text = bbdebut + insText + bbfin;
range = document.selection.createRange();
if (insText.length == 0)
{
range.move('character', -bbfin.length);
}
else
{
range.moveStart('character', bbdebut.length + insText.length + bbfin.length);
}
range.select();
}
else if(typeof input.selectionStart != 'undefined')
{
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + bbdebut + insText + bbfin + input.value.substr(end);
var pos;
if (insText.length == 0)
{
pos = start + bbdebut.length;
}
else
{
pos = start + bbdebut.length + insText.length + bbfin.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
else
{
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while(!re.test(pos))
{
pos = prompt("insertion (0.." + input.value.length + "):", "0");
}
if(pos > input.value.length)
{
pos = input.value.length;
}
var insText = prompt("Veuillez taper le texte");
input.value = input.value.substr(0, pos) + bbdebut + insText + bbfin + input.value.substr(pos);
}
}
function smilies(img)
{
window.document.formulaire.message.value += '' + img + '';
}
</script>
<?php
session_start();
$titre="Poster";
$balises = true;
include("./modele/connexion_sql.php");
include("./debut.php");
include("./menu.php");
?>
<?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_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= $bdd->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="./members_area.php">Index du forum</a> -->
<a href="./voirforum.php?f='.$data['forum_id'].'">'.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=$bdd->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="./members_area.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=$bdd->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="./members_area.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();
?>
<?php
switch($action)
{
case "repondre": //Premier cas : on souhaite répondre
//Ici, on affiche le formulaire de réponse
break;
case "nouveautopic": //Deuxième cas : on souhaite créer un nouveau topic
//Ici, on affiche le formulaire de nouveau topic
break;
//D'autres cas viendront s'ajouter là plus tard :p
default: //Si jamais c'est aucun de ceux-là, c'est qu'il y a eu un problème :o
echo'<h2>Cette action est impossible</h2>';
} //Fin du switch
?>
<?php
switch($action)
{
case "repondre": //Premier cas on souhaite répondre
?>
<h1>Poster une réponse</h1>
<form method="post" action="postok.php?action=repondre&amp;t=<?php echo $topic ?>" name="formulaire">
<fieldset><legend>Mise en forme</legend>
<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 />
<img src="./images/smileys/heureux.gif" title="heureux" alt="heureux" onClick="javascript:smilies(' :D ');return(false)" />
<img src="./images/smileys/lol.gif" title="lol" alt="lol" onClick="javascript:smilies(' :lol: ');return(false)" />
<img src="./images/smileys/triste.gif" title="triste" alt="triste" onClick="javascript:smilies(' :triste: ');return(false)" />
<img src="./images/smileys/cool.gif" title="cool" alt="cool" onClick="javascript:smilies(' :frime: ');return(false)" />
<img src="./images/smileys/rire.gif" title="rire" alt="rire" onClick="javascript:smilies(' XD ');return(false)" />
<img src="./images/smileys/confus.gif" title="confus" alt="confus" onClick="javascript:smilies(' :s ');return(false)" />
<img src="./images/smileys/choc.gif" title="choc" alt="choc" onClick="javascript:smilies(' :o ');return(false)" />
<img src="./images/smileys/question.gif" title="?" alt="?" onClick="javascript:smilies(' :interrogation: ');return(false)" />
<img src="./images/smileys/exclamation.gif" title="!" alt="!" onClick="javascript:smilies(' :exclamation: ');return(false)" />
</fieldset>
<fieldset><legend>Message</legend><textarea cols="80" rows="8" id="message" name="message"></textarea></fieldset>
<input type="submit" name="submit" value="Envoyer" />
<input type="reset" name = "Effacer" value = "Effacer"/>
</p></form>
<?php
break;
case "nouveautopic":
?>
<h1>Nouveau topic</h1>
<form method="post" action="postok.php?action=nouveautopic&amp;f=<?php echo $forum ?>" name="formulaire">
<fieldset><legend>Titre</legend>
<input type="text" size="80" id="titre" name="titre" /></fieldset>
<fieldset><legend>Mise en forme</legend>
<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 />
<img src="./images/smileys/heureux.gif" title="heureux" alt="heureux" onClick="javascript:smilies(':D');return(false)" />
<img src="./images/smileys/lol.gif" title="lol" alt="lol" onClick="javascript:smilies(':lol:');return(false)" />
<img src="./images/smileys/triste.gif" title="triste" alt="triste" onClick="javascript:smilies(':triste:');return(false)" />
<img src="./images/smileys/cool.gif" title="cool" alt="cool" onClick="javascript:smilies(':frime:');return(false)" />
<img src="./images/smileys/rire.gif" title="rire" alt="rire" onClick="javascript:smilies('XD');return(false)" />
<img src="./images/smileys/confus.gif" title="confus" alt="confus" onClick="javascript:smilies(':s');return(false)" />
<img src="./images/smileys/choc.gif" title="choc" alt="choc" onClick="javascript:smilies(':O');return(false)" />
<img src="./images/smileys/question.gif" title="?" alt="?" onClick="javascript:smilies(':interrogation:');return(false)" />
<img src="./images/smileys/exclamation.gif" title="!" alt="!" onClick="javascript:smilies(':exclamation:');return(false)" /></fieldset>
<fieldset><legend>Message</legend>
<textarea cols="80" rows="8" id="message" name="message"></textarea>
<label><input type="radio" name="mess" value="Annonce" />Annonce</label>
<label><input type="radio" name="mess" value="Message" checked="checked" />Topic</label>
</fieldset>
<p>
<input type="submit" name="submit" value="Envoyer" />
<input type="reset" name = "Effacer" value = "Effacer" /></p>
</form>
<?php
break;
//D'autres cas viendront s'ajouter ici par la suite
?>
<input type="button" id="gras" name="gras" value="Gras" onClick="javascript:bbcode('[g]', '[/g]');return(false)" />
<?php
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>

View File

@@ -0,0 +1,202 @@
<?php
include_once('./modele/membre/profil.php');
$titre="Profil";
//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']:'';
switch($action)
{
case "consulter":
//On affiche les infos sur le membre
$data = get_MemberInfo();
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Profil de <?php echo stripslashes(htmlspecialchars($data['pseudo'])); ?></h2><br>
<img src="./images/avatars/<?php echo $data['imageeleve']; ?>" alt="Acun avatar" /><br>
<p class="text-2" ><strong>Adresse E-Mail : </strong>
<a class=link2 href="mailto:<?php echo stripslashes($data['adressemail']); ?>"> <?php echo stripslashes(htmlspecialchars($data['adressemail'])); ?></a><br/><br>
Ce membre est inscrit depuis le <strong><?php echo date('d-m-Y', strtotime(str_replace('/','-',$data['dateenregistre']))); ?></strong><br/><br/>
<strong>Localisation : </strong> <?php echo stripslashes(htmlspecialchars($data['adresse'])); ?>
</p></center>
</div>
</section>
</div>
<?php
break;
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);
//Les infos du membre
$data = get_MemberInfoId();
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><form method="post" action="profil.php?action=modifier" enctype="multipart/form-data">
<h2>Edition du profil de <?php echo stripslashes(htmlspecialchars($data['pseudo']));?></h2><br>
<fieldset>
<label class="labelI" for="password">*Mot de passe<br>Nouveau mot de passe</label><br>
<input type="password" name="password" id="password" /><br>
<label class="labelI" for="confirm">*Confirmation du mot de passe</label><br>
<input type="password" name="confirm" id="confirm" /><br>
</fieldset><br>
<fieldset><legend class=colorbold marg3 pad1>Contacts</legend>
<label class="labelI" for="email">Adresse email</label><br>
<input type="text" name="email" id="email" value="<?php echo stripslashes($data['adressemail']); ?>" /><br>
</fieldset><br>
<fieldset><legend class=colorbold marg3 pad1>Informations supplémentaires</legend>
<label class="labelI" for="localisation">Localisation</label><br>
<input type="text" name="localisation" id="localisation" value="<?php echo stripslashes($data['adresse']); ?>" />
</fieldset><br>
<fieldset><legend class=colorbold marg3 pad1>Profil sur le forum</legend>
Avatar actuel <img src="./images/avatars/<?php echo $data['imageeleve'];?>" alt="pas d avatar" /><br><br>
<label class="labelI" for="avatar">Changer mon avatar</label><br>
<input type="file" name="avatar" id="avatar" /><br>(Taille max : 10 ko)<br><br>
<label><input type="checkbox" name="delete" value="Delete" /> Supprimer mon avatar</label>
</fieldset><br>
<p>
<input type="submit" value="Modifier mon profil" class="button-3"/><br>
<input type="hidden" id="sent" name="sent" value="1" />
</p><br>
<p>Les champs avec une * sont obligatoires</p><br>
</form></center>
</div>
</section>
</div>
<?php
}
else //Sinon on est dans la page de traitement
{
//On déclare les variables
$mdp_erreur = NULL;
$email_erreur1 = NULL;
$email_erreur2 = 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();
$email = $_POST['email'];
$localisation = $_POST['localisation'];
$pass = /*md5*/($_POST['password']);
$confirm = /*md5*/($_POST['confirm']);
//Vérification des champs du formulaire
if ($pass != $confirm || empty($confirm) || empty($pass))
{
$mdp_erreur = "Votre mot de passe et votre confirmation sont different ou sont vides";
$i++;
}
$data = get_checkMail();
if (strtolower($data['adressemail']) != strtolower($email))
{
$mail_free = get_checkCopyMail();
if(!$mail_free)
{
$email_erreur1 = "Votre adresse email est déjà utilisé par un membre";
$i++;
}
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++;
}
}
if (!empty($_FILES['avatar']['size']))
{
$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' , 'gif' , '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 sur l'avatar
{
if (!empty($_FILES['avatar']['size']))
{
post_UpdateAvatar();
}
if (isset($_POST['delete']))
{
post_RemoveAvatar();
}
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Modification de profil terminée</h2><br>
<p>Votre profil a été modifié avec succès !</p>
<p>Cliquez <a href="./profil.php?action=modifier">ici</a>
pour revenir à ton profil</p></center>
</div>
</section>
</div>
<?php
//On modifie la table
post_UpdateMember();
}
else
{
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Modification de profil interrompue</h2><br>
<h5><?php echo $i; ?> erreurs se sont produites lors de votre modification</h5>
<ul>
<?php
echo'<p>' .$email_erreur1. '' .$email_erreur2. '</p>
<p>' .$avatar_erreur. '' .$avatar_erreur1. '</p>
<p>' .$avatar_erreur2. '' .$avatar_erreur3. '</p>
<p>' .$mdp_erreur. '</p>';
?>
</ul>
<p> Cliquez <a href="./profil.php?action=modifier">ici</a> pour recommencer</p></center>
</div>
</section>
</div>
<?php
}
}
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>';
}
include_once('./vue/membre/profil.php');

View File

@@ -0,0 +1,51 @@
<?php
// On demande les 5 derniers billets (mod<6F>le)
include_once('./modele/vitrine/model_class.php');
$articlesCav = get_ArticlesCavalier(0, 3);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($articlesCav as $cle => $article)
{
$articles[$cle]['imagearticle'] = ($article['imagearticle']);
$articles[$cle]['libelle'] = ($article['libelle']);
$articles[$cle]['description'] = ($article['description']);
}
$articlesChvT = get_ArticlesChevalT(0, 3);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($articlesChvT as $cle => $article)
{
$articles[$cle]['imagearticle'] = ($article['imagearticle']);
$articles[$cle]['libelle'] = ($article['libelle']);
$articles[$cle]['description'] = ($article['description']);
}
$articlesChvR = get_ArticlesChevalR(0, 3);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($articlesChvR as $cle => $article)
{
$articles[$cle]['imagearticle'] = ($article['imagearticle']);
$articles[$cle]['libelle'] = ($article['libelle']);
$articles[$cle]['description'] = ($article['description']);
}
$categories = get_ArticlesCat(0, 3);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($categories as $cle => $categorie)
{
$categories[$cle]['idcategorie'] = ($categorie['idcategorie']);
$categories[$cle]['libelle'] = ($categorie['libelle']);
}
$articles = get_Articles(0, 3);
// On effectue du traitement sur les donn<6E>es (contr<74>leur)
// Ici, on doit surtout s<>curiser l'affichage
foreach($articles as $cle => $article)
{
$articles[$cle]['imagearticle'] = ($article['imagearticle']);
$articles[$cle]['libelle'] = ($article['libelle']);
$articles[$cle]['description'] = ($article['description']);
$articles[$cle]['idcategorie'] = ($article['idcategorie']);
}
// On affiche la page (vue)
include_once('./vue/vitrine/index.php');

View File

@@ -0,0 +1,23 @@
<?php
session_start();
session_destroy();
$titre="Déconnexion";
include("./vue/header.html");
if ($id==0) erreur(ERR_IS_NOT_CO);
?>
<body>
<div class="container-fluid">
<section id="content" class="page-content">
<div class="container">
<center><h2>Déconnexion réussie!</h2><br>
<center><h4>A Bientôt</h4><br>
<p>Vous êtes à présent déconnecté <br/>
<!--Cliquez <a href="'.htmlspecialchars($_SERVER['HTTP_REFERER']).'">ici</a> pour revenir à la page précédente.<br />-->
Cliquez <a href="./espace_membre.php">ici</a> pour revenir à la page principale</p></center><br>
</div>
</div>
</section>
</div>
<?php
include("./vue/footer.html");
?>

View File

@@ -0,0 +1,9 @@
<?php
include_once('./vue/header.html');
include_once('./modele/connexion_sql.php');
if (!isset($_GET['section']) OR $_GET['section'] == 'index')
{
include_once('./controleur/membre/espace/index.php');
}
include_once('./vue/footer.html');

View File

@@ -1,5 +1,5 @@
<?php
include_once('./vue/header.html');
include_once('./vue/ethologie/index.html');
include_once('./vue/activite/ethologie/index.html');
include_once('./vue/footer.html');
?>

View File

@@ -1,5 +1,9 @@
<?php
include_once('./vue/header.html');
include_once('./vue/evenement/index.html');
include_once('./modele/connexion_sql.php');
if (!isset($_GET['section']) OR $_GET['section'] == 'index')
{
include_once('./controleur/evenement/index.php');
}
include_once('./vue/footer.html');
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,9 @@
<?php
include_once('./vue/header.html');
include_once('./modele/connexion_sql.php');
if (!isset($_GET['section']) OR $_GET['section'] == 'index')
{
include_once('./controleur/membre/inscription/index.php');
}
include_once('./vue/footer.html');

View File

@@ -0,0 +1,12 @@
<?php
function get_News()
{
global $bdd;
$req = $bdd->prepare('SELECT * FROM Event WHERE lieuevent="ORVEAU" ');
$req->execute();
$event1 = $req->fetchAll();
return $event1;
}

View File

@@ -0,0 +1,12 @@
<?php
function get_events()
{
global $bdd;
$req = $bdd->prepare('SELECT * FROM Event WHERE dateevent > TO_DAYS(NOW()) AND idtype <> 1 ORDER BY dateevent ASC');
$req->execute();
$eventsAll = $req->fetchAll();
return $eventsAll;
}

View File

@@ -0,0 +1,10 @@
<?php
function check_Password()
{
global $bdd;
$req = $bdd->prepare('SELECT mdp, ideleve, privilege, pseudo FROM CompteEleve WHERE pseudo = :pseudo');
$req->bindValue(':pseudo',$_POST['pseudo'], PDO::PARAM_STR);
$req->execute();
$data = $req->fetch();
return $data;
}

View File

@@ -0,0 +1,30 @@
<?php
function get_MemberCount()
{
global $bdd;
$TotalDesMembres = $bdd->query('SELECT COUNT(*) FROM CompteEleve')->fetchColumn();
return $TotalDesMembres;
}
function get_LastMember()
{
global $bdd;
$req = $bdd->query('SELECT pseudo, ideleve FROM CompteEleve ORDER BY ideleve DESC LIMIT 0, 1');
$data = $req->fetch();
return $data;
}
function get_allMember()
{
//NOT USE actually
global $bdd;
//Cette requête permet d'obtenir tout sur le forum
$req = $bdd->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');
$req->bindValue(':lvl',$lvl,PDO::PARAM_INT);
$req->execute();
}

Some files were not shown because too many files have changed in this diff Show More