Bensik le goat a corrigé
This commit is contained in:
parent
0a77e33b82
commit
08cf6cc31c
5 changed files with 228 additions and 497 deletions
|
|
@ -2,50 +2,123 @@
|
|||
require_once("mother_entity.php");
|
||||
|
||||
class User extends Entity{
|
||||
// Attributs
|
||||
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;
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
*/
|
||||
public function __construct(){
|
||||
// Préfixe de la table pour hydratation
|
||||
$this->_prefixe = 'user_';
|
||||
$this->_prefix = '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{
|
||||
return $this->_name;
|
||||
}
|
||||
public function setName(string $strNewName){
|
||||
$this->_name = $this->nettoyer($strNewName);
|
||||
public function setName(string $name){
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
public function getFirstname():string{
|
||||
return $this->_firstname;
|
||||
}
|
||||
public function setFirstname(string $strFirstname){
|
||||
$this->_firstname = $this->nettoyer($strFirstname);
|
||||
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 $strMail){
|
||||
$this->_mail = strtolower($this->nettoyer($strMail));
|
||||
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 $strPwd){
|
||||
$this->_pwd = $strPwd;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,4 @@
|
|||
<? php
|
||||
<!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">
|
||||
<body class="sb-nav-fixed">
|
||||
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
|
||||
|
||||
<!-- Navbar Brand-->
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
directement en contact avec les entreprises.</p>
|
||||
</section>
|
||||
|
||||
<section aria-label="Articles récents">
|
||||
<section class="container" aria-label="Articles récents">
|
||||
<h2 class="visually-hidden">Les 4 derniers articles</h2>
|
||||
<div class="row mb-2">
|
||||
<?php
|
||||
foreach($arrProjectToDiplay as $objProject){
|
||||
foreach($arrProjectToDisplay as $objProject){
|
||||
include("../app/views/partials/preview.php");
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
|
||||
<!-- Page : Inscription -->
|
||||
<main class="container py-5">
|
||||
|
||||
<!-- Centrage du formulaire -->
|
||||
<div class="row justify-content-center">
|
||||
<!-- Contenu principal de la page -->
|
||||
<main class="container py-5">
|
||||
|
||||
<main class="container py-5">
|
||||
|
||||
<!-- Centrage horizontal du formulaire -->
|
||||
<div class="row justify-content-center">
|
||||
|
|
@ -38,8 +35,7 @@
|
|||
type="text"
|
||||
id="user_firstname"
|
||||
name="user_firstname"
|
||||
required
|
||||
>
|
||||
required >
|
||||
</div>
|
||||
|
||||
<!-- Champ : nom de l'utilisateur -->
|
||||
|
|
@ -56,7 +52,7 @@
|
|||
>
|
||||
</div>
|
||||
|
||||
<!-- Champ : pseudo (identifiant public de l'utilisateur) -->
|
||||
<!-- Champ : pseudo -->
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="user_pseudo">
|
||||
Pseudo *
|
||||
|
|
@ -71,193 +67,6 @@
|
|||
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>
|
||||
<p class="text-secondary mb-4">
|
||||
Créez votre compte utilisateur.
|
||||
</p>
|
||||
|
||||
<?php
|
||||
// Affichage des messages d'erreur du formulaire, l'affichage en Bootstrap (validation côté serveur)
|
||||
if (!empty($arrError)) { ?>
|
||||
<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">
|
||||
|
||||
<!-- Champ : Nom -->
|
||||
<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">
|
||||
<label class="form-label" for="user_firstname">
|
||||
Prénom *
|
||||
</label>
|
||||
<input
|
||||
class="form-control <?php if (isset($arrError['user_firstname'])) echo 'is-invalid'; ?>"
|
||||
type="text"
|
||||
id="user_firstname"
|
||||
name="user_firstname"
|
||||
value="<?php echo htmlspecialchars($objUser->getFirstname()); ?>"
|
||||
required
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- Champ : Pseudo -->
|
||||
<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 <?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
|
||||
class="form-control <?php if (isset($arrError['user_mail'])) echo 'is-invalid'; ?>"
|
||||
type="email"
|
||||
id="user_mail"
|
||||
name="user_mail"
|
||||
value="<?php echo htmlspecialchars($objUser->getMail()); ?>"
|
||||
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 <?php if (isset($arrError['user_password'])) echo 'is-invalid'; ?>"
|
||||
type="password"
|
||||
id="user_password"
|
||||
name="user_password"
|
||||
required
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- Champ : 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>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Champ : adresse e-mail -->
|
||||
|
|
@ -288,20 +97,6 @@
|
|||
>
|
||||
</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">
|
||||
|
|
@ -341,7 +136,7 @@
|
|||
>
|
||||
</div>
|
||||
|
||||
<!-- Champ optionnel : phrase d'accroche / description courte -->
|
||||
<!-- Champ optionnel : phrase d'accroche -->
|
||||
<div class="col-12">
|
||||
<label class="form-label" for="user_description">
|
||||
Phrase d'accroche
|
||||
|
|
@ -365,18 +160,16 @@
|
|||
<div class="col-12 text-center">
|
||||
<small class="text-secondary">
|
||||
Déjà un compte ?
|
||||
<a href="connexion.php">Se connecter</a>
|
||||
<a href="index.php?ctrl=user&action=login">Se connecter</a>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
Loading…
Add table
Add a link
Reference in a new issue