rayhan_affichage #11

Merged
rayhan.hassou merged 2 commits from rayhan_affichage into master 2 years ago

@ -22,6 +22,21 @@ class Validation {
// $dVueEreur[] = "Veuillez revoir le mail*";
// }
<<<<<<< HEAD
//Vérification Email
if (!isset($email)||$email=="") {
$dVueEreur[] = "L'email est obligatoire.";
$pseudo="";
$i++;
}
if ($email != filter_var($email, FILTER_SANITIZE_STRING))
{
$dVueEreur[] = "Tentative d'injection de code (attaque sécurité)";
$nom="";
$i++;
}
=======
// //Vérification Pseudo
// if (!isset($pseudo)||$pseudo=="") {
// $dVueEreur[] = "pas de pseudo";
@ -30,6 +45,7 @@ class Validation {
// }
// val_string($pseudo,$i,$dVueEreur);
>>>>>>> master
// //Vérification Mot de Passe
// if (!isset($mdp)||$mdp=="") {
@ -38,7 +54,27 @@ class Validation {
// $i++;
// }
<<<<<<< HEAD
//Vérification Pseudo
if (!isset($pseudo)||$pseudo=="") {
$dVueEreur[] = "Le pseudonyme est obligatoire.";
$pseudo="";
$i++;
}
val_string($pseudo,$i,$dVueEreur);
//Vérification Mot de Passe
if (!isset($mdp)||$mdp=="") {
$dVueEreur[] = "Veuillez renseignez votre mot de passe.";
$mdp="";
$i++;
}
val_string($mdp,$i,$dVueEreur);
=======
// val_string($mdp,$i,$dVueEreur);
>>>>>>> master
// if (!preg_match('/^.{5,}$/', $mdp)) {
@ -57,7 +93,13 @@ class Validation {
$str = preg_replace('/[^A-Za-z\-]/', '', $str);
if($str == null || $str == '')
{
<<<<<<< HEAD
$dVueEreur[] = "Tentative d'injection de code (attaque sécurité)";
$str="";
$i++;
=======
return null;
>>>>>>> master
}
return $str;
}

@ -15,4 +15,5 @@ $vues['listPublic']='vue/html/PageListePublic.php';
$vues['login']='vue/html/login.php';
$vues['NavBar']='vue/html/NavBar.php';
?>

@ -41,6 +41,14 @@ class CtrlVisiteur {
$this->redirectionInscription($dVueEreur);
break;
case "SupprimerTache":
$this->SupprimerTache();
break;
case "SupprimerListe":
$this->SupprimerListe();
break;
//mauvaise action
default:
$dVueEreur[] = "Erreur d'appel php";
@ -98,11 +106,29 @@ class CtrlVisiteur {
function ConsulterListePublic(array $dVueEreur) {
global $rep,$vues;
$listes = MdlVisiteur::RecupererListePublic();
$taches = MdlVisiteur::RecupererTache();
require ($rep.$vues['listPublic']);
}
function SupprimerTache(){
global $rep,$vues;
$id = $_GET['idTache'];
$tache = MdlVisiteur::SupprimerTache($id);
$listes = MdlVisiteur::RecupererListePublic();
$taches = MdlVisiteur::RecupererTache();
require ($rep.$vues['listPublic']);
}
function SupprimerListe(){
global $rep,$vues;
$id = $_GET['idListe'];
$liste = MdlVisiteur::SupprimerListe($id);
$listes = MdlVisiteur::RecupererListePublic();
$taches = MdlVisiteur::RecupererTache();
require ($rep.$vues['listPublic']);
}
}//fin class
?>

@ -23,6 +23,26 @@ class MdlUtilisateur
return $userGtw->getListePublic(0,10);
}
<<<<<<< HEAD:src/Modele/MdlVisiteur.php
public static function RecupererTache(){
$userGtw = new TacheGateway();
return $userGtw->getTache();
}
public static function SupprimerTache(string $id){
$userGtw = new TacheGateway();
return $userGtw->Supprimer($id);
}
public static function SupprimerListe(string $id){
$userGtw = new ListeGateway();
return $userGtw->Supprimer($id);
}
=======
>>>>>>> master:src/modele/MdlUtilisateur.php
}

@ -24,4 +24,22 @@ class MdlVisiteur
return $userGtw->getListePublic(0,10);
}
public static function RecupererTache(){
$userGtw = new TacheGateway();
return $userGtw->getTache();
}
public static function SupprimerTache(string $id){
$userGtw = new TacheGateway();
return $userGtw->Supprimer($id);
}
public static function SupprimerListe(string $id){
$userGtw = new ListeGateway();
return $userGtw->Supprimer($id);
}
}

@ -17,13 +17,13 @@ class ListeGateway{
}
public function Editer(Liste $Liste){
$query='UPDATE ToDoListe_Liste SET nom=:nom WHERE id=:id';
$query='UPDATE ToDoList_Liste SET nom=:nom WHERE id=:id';
$this->con->executeQuery($query, array('nom' => array($Liste->getNom(), PDO::PARAM_STRING)), array('id' => array($Liste->getId()),PDO::PARAM_INT));
}
public function Supprimer(int $id){
$query='DELETE FROM ToDoListe_Liste WHERE id=:id';
$this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_STRING)));
$query='DELETE FROM ToDoList_Liste WHERE id=:id';
$this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT)));
}
public function getListe(int $offset, int $limit){
@ -34,14 +34,14 @@ class ListeGateway{
}
public function getTacheListe(Liste $liste){
$query = 'SELECT tache FROM ToDoListe_Liste WHERE id=:id ';
$query = 'SELECT tache FROM ToDoList_Liste WHERE id=:id ';
$this->con->executeQuery($query, array('id' => array($liste->getId, PDO::PARAM_INT)));
$results=$this->con->getResults();
return $results;
}
public function getListePublic($offset,$limit){
$query = "SELECT * FROM ToDoList_Liste ";
$query = "SELECT * FROM ToDoList_Liste WHERE estPublic LIMIT $offset, $limit";
$this->con->executeQuery($query);
$listes = [];
foreach ($this->con->getResults() as $liste) {

@ -2,6 +2,7 @@
class TacheGateway{
private $con;
public function __construct(){
global $dsn,$user,$pass;
$this->con=new Connection($dsn,$user,$pass);
}
@ -19,9 +20,19 @@ class TacheGateway{
$this->con->executeQuery($query, array('nom' => array($tache->getNom(), PDO::PARAM_STRING)), array('description' => array($tache->getdescription(), PDO::PARAM_STRING)), array('id' => array($tache->getId(),PDO::PARAM_INT)));
}
public function Supprimer(Tache $tache){
public function Supprimer(string $id){
$query='DELETE FROM ToDoList_Tache WHERE id=:id';
$this->con->executeQuery($query,'id' => array($tache->getId(), PDO::PARAM_STRING));
$this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT)));
}
public function getTache(){
$query='SELECT * FROM ToDoList_Tache';
$this->con->executeQuery($query);
$taches = [];
foreach ($this->con->getResults() as $tache) {
$taches[] = new Tache($tache["id"],$tache["nom"],$tache["description"],$tache["dateCreation"],$tache["estValide"],$tache["idListe"]);
}
return $taches;
}
}
?>

@ -20,7 +20,19 @@ class UtilisateurGateway{
public function SupprimerUtilisateur(int $id){
$query='DELETE FROM ToDoList_Utilisateur WHERE id=:id;';
$this->con->executeQuery($query, array(
'id' => array($id, PDO::PARAM_STRING)));
'id' => array($id, PDO::PARAM_INT)));
}
public getCredential(string $id){
$query = 'SELECT motDePasse FROM ToDoList_Utilisateur WHERE id=:id';
if(this->con->executeQuery($query, array('id' => array($id, PDO::PARAM_INT)))){
return (this->con->getResults[0]['motDePasse'])
}
else{
/* pas sur de ça*/
throw new PDOexception;
}
}
public function RechercheUtilisateurViaEmail(string $pseudo){

@ -32,6 +32,10 @@ class Liste
return $this->nom;
}
public function getDescription(){
return $this->description;
}
public function setNom($nom){
$this->nom=$nom;
}

@ -65,7 +65,7 @@ class Tache
//idList
public function getIdListe(){
return $this->estValide;
return $this->idListe;
}
public function setIdListe($idListe){

@ -7,6 +7,7 @@ class Utilisateur
private $prenom;
private $pseudo;
private $email;
private $isAdmin;
public function __construct($id, $nom, $prenom, $pseudo, $email, $motDePasse, $isAdmin){
$this->id = $id;
@ -14,6 +15,7 @@ class Utilisateur
$this->prenom = $prenom;
$this->pseudo = $pseudo;
$this->email = $email;
$this->isAdmin = $isAdmin;
}
//Nom

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

@ -16,11 +16,66 @@
<?php require($rep.$vues['NavBar']); ?>
<?php
<?php
foreach($listes as $liste){
echo '<center>'.$liste->getNom().'</center>';
}
?>
?>
<div class="container py-2 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col col-lg-8 col-xl-6">
<div class="card rounded-3">
<div class="card-body p-4">
<div>
<p class="mb-2">
<span class="h2 me-2 text-info"><?= $liste->getNom()?>
<a href="index.php?action=SupprimerListe&idListe=<?= $liste->getId() ?>">
<button class="btn btn-default">
<img src="./vue/Images/trash.png" width="25" />
</button>
</a>
<button type="submit" class="btn btn-default">
<img src="./vue/Images/edit.png" width="25" />
</button>
</span>
</p>
<p><span class="h5 me-2"><?= $liste->getDescription()?></span>
<p class="text-muted pb-2"><?= $liste->getDateCreation()?></p>
</div>
<ul class="list-group rounded-0">
<?php
foreach($taches as $tache){
if($tache->getIdListe() == $liste->getId()){
?>
<li class="list-group-item border-0 d-flex align-items-center ps-0">
<input class="form-check-input me-3" type="checkbox" value="" aria-label="..."/>
<?= $tache->getNom() ?> : <?= $tache->getDescription() ?>
<a href="index.php?action=SupprimerTache&idTache=<?= $tache->getId() ?>">
<button class="btn btn-default">
<img src="./vue/Images/trash.png" width="25" />
</button>
</a>
<button type="submit" class="btn btn-default">
<img src="./vue/Images/edit.png" width="25" />
</button>
</li>
<?php
}
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
@ -126,5 +181,4 @@
</div>
<!-- Copyright -->
</footer>
</html>
</html>
Loading…
Cancel
Save