Bensik le goat a corrigé

This commit is contained in:
laura.chevillet 2026-01-26 16:25:08 +01:00
parent 0a77e33b82
commit 08cf6cc31c
5 changed files with 228 additions and 497 deletions

View file

@ -2,50 +2,123 @@
require_once("mother_entity.php"); require_once("mother_entity.php");
class User extends Entity{ class User extends Entity{
// Attributs private int $_id;
private string $_name = ''; private string $_name = '';
private string $_firstname = ''; private string $_firstname = '';
private string $_pseudo = '';
private string $_image = '';
private string $_mail = ''; private string $_mail = '';
private string $_pwd; private string $_pwd;
private string $_phone = '';
private string $_work = '';
private string $_birth = '';
private string $_location = '';
private string $_description = '';
private string $_account_creation = '';
private int $_status;
/**
* Constructeur
*/
public function __construct(){ public function __construct(){
// Préfixe de la table pour hydratation $this->_prefix = 'user_';
$this->_prefixe = 'user_'; }
public function getId():int{
return $this->_id;
}
public function setId(int $id){
$this->_id = $id;
} }
// Méthodes - getters et setters
public function getName():string{ public function getName():string{
return $this->_name; return $this->_name;
} }
public function setName(string $strNewName){ public function setName(string $name){
$this->_name = $this->nettoyer($strNewName); $this->_name = $name;
} }
public function getFirstname():string{ public function getFirstname():string{
return $this->_firstname; return $this->_firstname;
} }
public function setFirstname(string $strFirstname){ public function setFirstname(string $firstname){
$this->_firstname = $this->nettoyer($strFirstname); $this->_firstname = $firstname;
} }
public function getPseudo():string{
return $this->_pseudo;
}
public function setPseudo(string $pseudo){
$this->_pseudo = $pseudo;
}
public function getImage():string{
return $this->_image;
}
public function setImage(string $image){
$this->_image = $image;
}
public function getMail():string{ public function getMail():string{
return $this->_mail; return $this->_mail;
} }
public function setMail(string $strMail){ public function setMail(string $mail){
$this->_mail = strtolower($this->nettoyer($strMail)); $this->_mail = strtolower($mail);
} }
public function getPwd():string{ public function getPwd():string{
return $this->_pwd; return $this->_pwd;
} }
public function getPwdHash():string{ public function getPwdHash():string{
return password_hash($this->_pwd, PASSWORD_DEFAULT); return password_hash($this->_pwd, PASSWORD_DEFAULT);
} }
public function setPwd(string $strPwd){ public function setPwd(string $pwd){
$this->_pwd = $strPwd; $this->_pwd = $pwd;
} }
public function getPhone():string{
return $this->_phone;
}
public function setPhone(string $phone){
$this->_phone = $phone;
}
public function getWork():string{
return $this->_work;
}
public function setWork(string $work){
$this->_work = $work;
}
public function getBirth():string{
return $this->_birth;
}
public function setBirth(string $birth){
$this->_birth = $birth;
}
public function getLocation():string{
return $this->_location;
}
public function setLocation(string $location){
$this->_location = $location;
}
public function getDescription():string{
return $this->_description;
}
public function setDescription(string $description){
$this->_description = $description;
}
public function getAccountCreation():string{
return $this->_account_creation;
}
public function setAccountCreation(string $account_creation){
$this->_account_creation = $account_creation;
}
public function getStatus():int{
return $this->_status;
}
public function setStatus(int $status){
$this->_status = $status;
}
} }

View file

@ -1,124 +0,0 @@
<?php
require_once("mother_entity.php");
class User extends Entity{
private int $_id;
private string $_name = '';
private string $_firstname = '';
private string $_pseudo = '';
private string $_image = '';
private string $_mail = '';
private string $_pwd;
private string $_phone = '';
private string $_work = '';
private string $_birth = '';
private string $_location = '';
private string $_description = '';
private string $_account_creation = '';
private int $_status;
public function __construct(){
$this->_prefix = 'user_';
}
public function getId():int{
return $this->_id;
}
public function setId(int $id){
$this->_id = $id;
}
public function getName():string{
return $this->_name;
}
public function setName(string $name){
$this->_name = $name;
}
public function getFirstname():string{
return $this->_firstname;
}
public function setFirstname(string $firstname){
$this->_firstname = $firstname;
}
public function getPseudo():string{
return $this->_pseudo;
}
public function setPseudo(string $pseudo){
$this->_pseudo = $pseudo;
}
public function getImage():string{
return $this->_image;
}
public function setImage(string $image){
$this->_image = $image;
}
public function getMail():string{
return $this->_mail;
}
public function setMail(string $mail){
$this->_mail = strtolower($mail);
}
public function getPwd():string{
return $this->_pwd;
}
public function getPwdHash():string{
return password_hash($this->_pwd, PASSWORD_DEFAULT);
}
public function setPwd(string $pwd){
$this->_pwd = $pwd;
}
public function getPhone():string{
return $this->_phone;
}
public function setPhone(string $phone){
$this->_phone = $phone;
}
public function getWork():string{
return $this->_work;
}
public function setWork(string $work){
$this->_work = $work;
}
public function getBirth():string{
return $this->_birth;
}
public function setBirth(string $birth){
$this->_birth = $birth;
}
public function getLocation():string{
return $this->_location;
}
public function setLocation(string $location){
$this->_location = $location;
}
public function getDescription():string{
return $this->_description;
}
public function setDescription(string $description){
$this->_description = $description;
}
public function getAccountCreation():string{
return $this->_account_creation;
}
public function setAccountCreation(string $account_creation){
$this->_account_creation = $account_creation;
}
public function getStatus():int{
return $this->_status;
}
public function setStatus(int $status){
$this->_status = $status;
}
}

View file

@ -1,15 +1,4 @@
<? php <body class="sb-nav-fixed">
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Dashboard - Folliow Admin</title>
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />
<link href="css/styles.css" rel="stylesheet" />
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
</head>
<body class="sb-nav-fixed">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark"> <nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
<!-- Navbar Brand--> <!-- Navbar Brand-->

View file

@ -6,11 +6,11 @@
directement en contact avec les entreprises.</p> directement en contact avec les entreprises.</p>
</section> </section>
<section aria-label="Articles récents"> <section class="container" aria-label="Articles récents">
<h2 class="visually-hidden">Les 4 derniers articles</h2> <h2 class="visually-hidden">Les 4 derniers articles</h2>
<div class="row mb-2"> <div class="row mb-2">
<?php <?php
foreach($arrProjectToDiplay as $objProject){ foreach($arrProjectToDisplay as $objProject){
include("../app/views/partials/preview.php"); include("../app/views/partials/preview.php");
} }
?> ?>

View file

@ -1,382 +1,175 @@
<!-- Page : Inscription --> <!-- Page : Inscription -->
<main class="container py-5"> <main class="container py-5">
<!-- Centrage du formulaire -->
<div class="row justify-content-center">
<!-- Contenu principal de la page -->
<main class="container py-5">
<!-- Centrage horizontal du formulaire --> <!-- Centrage horizontal du formulaire -->
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-6"> <div class="col-12 col-md-10 col-lg-6">
<!-- Carte contenant le formulaire d'inscription --> <!-- Carte contenant le formulaire d'inscription -->
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5"> <div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
<!-- Titre principal de la page --> <!-- Titre principal de la page -->
<h1 class="h3 fw-bold mb-1">Inscription</h1>
<!-- Texte descriptif -->
<p class="text-secondary mb-4">
Créez votre compte utilisateur.
</p>
<!-- Formulaire d'inscription -->
<!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
<form method="POST">
<div class="row g-3">
<!-- Champ : prénom de l'utilisateur -->
<div class="col-md-6">
<label class="form-label" for="user_firstname">
Prénom *
</label>
<input
class="form-control"
type="text"
id="user_firstname"
name="user_firstname"
required
>
</div>
<!-- Champ : nom de l'utilisateur -->
<div class="col-md-6">
<label class="form-label" for="user_name">
Nom *
</label>
<input
class="form-control"
type="text"
id="user_name"
name="user_name"
required
>
</div>
<!-- Champ : pseudo (identifiant public de l'utilisateur) -->
<div class="col-12">
<label class="form-label" for="user_pseudo">
Pseudo *
</label>
<div class="input-group">
<span class="input-group-text">@</span>
<input
class="form-control"
type="text"
id="user_pseudo"
name="user_pseudo"
required
>
</div>
<!-- Carte Bootstrap contenant le formulaire -->
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
<!-- Titre et description -->
<h1 class="h3 fw-bold mb-1">Inscription</h1> <h1 class="h3 fw-bold mb-1">Inscription</h1>
<!-- Texte descriptif -->
<p class="text-secondary mb-4"> <p class="text-secondary mb-4">
Créez votre compte utilisateur. Créez votre compte utilisateur.
</p> </p>
<?php <!-- Formulaire d'inscription -->
// Affichage des messages d'erreur du formulaire, l'affichage en Bootstrap (validation côté serveur) <!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
if (!empty($arrError)) { ?> <form method="POST">
<div class="alert alert-danger" role="alert">
<?php foreach ($arrError as $strError) { ?>
<p class="mb-0">
<?php echo htmlspecialchars($strError); ?>
</p>
<?php } ?>
</div>
<?php } ?>
<!-- Formulaire d'inscription -->
<!-- Les données sont envoyées en POST vers la méthode signin du user_controller.php -->
<form method="POST" action="index.php?ctrl=user&action=signin">
<div class="row g-3"> <div class="row g-3">
<!-- Champ : Nom --> <!-- Champ : prénom de l'utilisateur -->
<div class="col-md-6">
<label class="form-label" for="user_name">
Nom *
</label>
<input
class="form-control <?php if (isset($arrError['user_name'])) echo 'is-invalid'; ?>"
type="text"
id="user_name"
name="user_name"
value="<?php echo htmlspecialchars($objUser->getName()); ?>"
required
>
</div>
<!-- Champ : Prénom -->
<div class="col-md-6"> <div class="col-md-6">
<label class="form-label" for="user_firstname"> <label class="form-label" for="user_firstname">
Prénom * Prénom *
</label> </label>
<input <input
class="form-control <?php if (isset($arrError['user_firstname'])) echo 'is-invalid'; ?>" class="form-control"
type="text" type="text"
id="user_firstname" id="user_firstname"
name="user_firstname" name="user_firstname"
value="<?php echo htmlspecialchars($objUser->getFirstname()); ?>" required >
required </div>
<!-- Champ : nom de l'utilisateur -->
<div class="col-md-6">
<label class="form-label" for="user_name">
Nom *
</label>
<input
class="form-control"
type="text"
id="user_name"
name="user_name"
required
> >
</div> </div>
<!-- Champ : Pseudo --> <!-- Champ : pseudo -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="user_pseudo"> <label class="form-label" for="user_pseudo">
Pseudo * Pseudo *
</label> </label>
<div class="input-group"> <div class="input-group">
<span class="input-group-text">@</span> <span class="input-group-text">@</span>
<input
class="form-control <?php if (isset($arrError['user_pseudo'])) echo 'is-invalid'; ?>"
type="text"
id="user_pseudo"
name="user_pseudo"
value="<?php echo htmlspecialchars($objUser->getPseudo()); ?>"
required
>
</div>
</div>
<!-- Champ : Adresse e-mail -->
<div class="col-12">
<label class="form-label" for="user_mail">
Adresse e-mail *
</label>
<input <input
class="form-control <?php if (isset($arrError['user_mail'])) echo 'is-invalid'; ?>" class="form-control"
type="email" type="text"
id="user_mail" id="user_pseudo"
name="user_mail" name="user_pseudo"
value="<?php echo htmlspecialchars($objUser->getMail()); ?>" required
required
> >
</div> </div>
</div>
<!-- Champ : Mot de passe --> <!-- Champ : adresse e-mail -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="user_password"> <label class="form-label" for="user_mail">
Mot de passe * Adresse e-mail *
</label> </label>
<input <input
class="form-control <?php if (isset($arrError['user_password'])) echo 'is-invalid'; ?>" class="form-control"
type="password" type="email"
id="user_password" id="user_mail"
name="user_password" name="user_mail"
required required
> >
</div> </div>
<!-- Champ : Confirmation du mot de passe --> <!-- Champ : mot de passe -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="pwd_confirm"> <label class="form-label" for="user_password">
Confirmation du mot de passe * Mot de passe *
</label> </label>
<input <input
class="form-control <?php if (isset($arrError['pwd_confirm'])) echo 'is-invalid'; ?>" class="form-control"
type="password" type="password"
id="pwd_confirm" id="user_password"
name="pwd_confirm" name="user_password"
required required
> >
</div> </div>
<!-- Champ optionnel : numéro de téléphone --> <!-- Champ optionnel : numéro de téléphone -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="user_phone"> <label class="form-label" for="user_phone">
Téléphone Téléphone
</label> </label>
<input <input
class="form-control" class="form-control"
type="text" type="text"
id="user_phone" id="user_phone"
name="user_phone" name="user_phone"
> >
</div> </div>
<!-- Champ optionnel : profession de l'utilisateur --> <!-- Champ optionnel : profession de l'utilisateur -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="user_work"> <label class="form-label" for="user_work">
Profession Profession
</label> </label>
<input <input
class="form-control" class="form-control"
type="text" type="text"
id="user_work" id="user_work"
name="user_work" name="user_work"
> >
</div> </div>
<!-- Champ optionnel : localisation de l'utilisateur --> <!-- Champ optionnel : localisation de l'utilisateur -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="user_location"> <label class="form-label" for="user_location">
Localisation Localisation
</label> </label>
<input <input
class="form-control" class="form-control"
type="text" type="text"
id="user_location" id="user_location"
name="user_location" name="user_location"
> >
</div> </div>
<!-- Champ optionnel : phrase d'accroche / description courte --> <!-- Champ optionnel : phrase d'accroche -->
<div class="col-12"> <div class="col-12">
<label class="form-label" for="user_description"> <label class="form-label" for="user_description">
Phrase d'accroche Phrase d'accroche
</label> </label>
<textarea <textarea
class="form-control" class="form-control"
id="user_description" id="user_description"
name="user_description" name="user_description"
rows="3" rows="3"
></textarea> ></textarea>
</div> </div>
<!-- Lien vers la page de connexion --> <!-- Bouton de soumission du formulaire -->
<div class="col-12 text-center"> <div class="col-12 d-grid mt-2">
<small class="text-secondary"> <button type="submit" class="btn btn-primary btn-lg rounded-3">
Déjà un compte ? Créer mon compte
<a href="index.php?ctrl=user&action=login">Se connecter</a> </button>
</small>
</div>
<!-- Bouton de soumission -->
<div class="col-12 d-grid mt-2">
<button type="submit" class="btn btn-primary btn-lg rounded-3">
Créer mon compte
</button>
</div> </div>
<!-- Lien vers la page de connexion -->
<div class="col-12 text-center">
<small class="text-secondary">
Déjà un compte ?
<a href="index.php?ctrl=user&action=login">Se connecter</a>
</small>
</div> </div>
</form> </form>
</div>
<!-- Champ : adresse e-mail -->
<div class="col-12">
<label class="form-label" for="user_mail">
Adresse e-mail *
</label>
<input
class="form-control"
type="email"
id="user_mail"
name="user_mail"
required
>
</div>
<!-- Champ : mot de passe -->
<div class="col-12">
<label class="form-label" for="user_password">
Mot de passe *
</label>
<input
class="form-control"
type="password"
id="user_password"
name="user_password"
required
>
</div>
<!-- Confirmation du mot de passe -->
<div class="col-12">
<label class="form-label" for="pwd_confirm">
Confirmation du mot de passe *
</label>
<input
class="form-control <?php if (isset($arrError['pwd_confirm'])) echo 'is-invalid'; ?>"
type="password"
id="pwd_confirm"
name="pwd_confirm"
required
>
</div>
<!-- Champ optionnel : numéro de téléphone -->
<div class="col-12">
<label class="form-label" for="user_phone">
Téléphone
</label>
<input
class="form-control"
type="text"
id="user_phone"
name="user_phone"
>
</div>
<!-- Champ optionnel : profession de l'utilisateur -->
<div class="col-12">
<label class="form-label" for="user_work">
Profession
</label>
<input
class="form-control"
type="text"
id="user_work"
name="user_work"
>
</div>
<!-- Champ optionnel : localisation de l'utilisateur -->
<div class="col-12">
<label class="form-label" for="user_location">
Localisation
</label>
<input
class="form-control"
type="text"
id="user_location"
name="user_location"
>
</div>
<!-- Champ optionnel : phrase d'accroche / description courte -->
<div class="col-12">
<label class="form-label" for="user_description">
Phrase d'accroche
</label>
<textarea
class="form-control"
id="user_description"
name="user_description"
rows="3"
></textarea>
</div>
<!-- Bouton de soumission du formulaire -->
<div class="col-12 d-grid mt-2">
<button type="submit" class="btn btn-primary btn-lg rounded-3">
Créer mon compte
</button>
</div>
<!-- Lien vers la page de connexion -->
<div class="col-12 text-center">
<small class="text-secondary">
Déjà un compte ?
<a href="connexion.php">Se connecter</a>
</small>
</div>
</div>
</form>
</div> </div>
</div>
</div>
</div>
</div> </div>
</div>
</main> </main>