C plu KC ٩(^ᗜ^ )و ´-

This commit is contained in:
Yasder5 2026-02-19 23:19:20 +01:00
parent 26c81bc3c6
commit 738c14c451
8 changed files with 33 additions and 29 deletions

View file

@ -208,20 +208,20 @@ class UserCtrl extends MotherCtrl {
$arrUserData = $objUserModel->findUserById($_SESSION['user']['user_id']);
$objUser->hydrate($arrUserData);
if (!empty($_POST)) {
if ($objUserModel->mailExists($objUser->getMail()) && ($_POST['user_mail'] != $objUser->getMail())) {
if ($objUserModel->mailExists($_POST['user_mail']) && ($_POST['user_mail'] != $objUser->getMail())) {
$arrError['user_mail'] = "Ce mail est déjà associé";
} else {
if ($objUserModel->pseudoExists($objUser->getPseudo()) && ($_POST['user_pseudo'] != $objUser->getPseudo())){
if ($objUserModel->pseudoExists($_POST['user_pseudo']) && ($_POST['user_pseudo'] != $objUser->getPseudo())){
$arrError['user_pseudo'] = "Ce pseudo est déjà utiliser";
}else{
$objUser->hydrate($_POST);
$objUser->setId($_SESSION['user']['user_id']);
$boolInsert = $objUserModel->update($objUser);
if ($boolInsert === true) {
$objUser->hydrate($_POST);
$objUser->setPseudo($_SESSION['user']['user_pseudo']);
$arrNewInfo = $objUserModel->findUserByPseudo($objUser->getPseudo());
$objUser->hydrate($arrNewInfo);
$_SESSION['user'] = $arrNewInfo;
$_SESSION['success'] = "Compte modifier avec succès";
header("Location:?ctrl=user&action=user&pseudo=".$objUser->getPseudo());
exit;
@ -232,7 +232,6 @@ class UserCtrl extends MotherCtrl {
}
}
$this->_arrData["arrError"] = $arrError;
$this->_arrData['objUser'] = $objUser;
$this->_display("useredit");

View file

@ -2,6 +2,7 @@
session_start();
require("./vendor/autoload.php");
var_dump($_SESSION);
//environnement
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);

View file

@ -154,7 +154,9 @@
*/
public function findUserById(int $intId): array|bool {
$strRq = "SELECT user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description FROM users WHERE user_id = :id";
$strRq = "SELECT user_id,user_status ,user_image ,user_name, user_firstname, user_pseudo, user_mail, user_phone, user_work, user_location, user_description, authorisation_name
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
WHERE user_id = :id";
$prep = $this->_db->prepare($strRq);
$prep->bindValue(':id', $intId, PDO::PARAM_INT);
@ -165,7 +167,9 @@
public function findUserByPseudo(string $strPseudo): array|bool {
$strRq = "SELECT * FROM users WHERE user_pseudo = :pseudo";
$strRq = "SELECT user_id,user_image, user_status ,user_name, user_firstname, user_pseudo, user_mail, user_phone, user_work, user_location, user_description, authorisation_name
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
WHERE user_pseudo = :pseudo";
$prep = $this->_db->prepare($strRq);
$prep->bindValue(':pseudo', $strPseudo, PDO::PARAM_STR);
@ -180,6 +184,6 @@
$rq->bindValue(":pseudo", $pseudo, PDO::PARAM_STR);
$rq->execute();
return (bool)$rq->fetchColumn();
return $rq->fetchColumn();
}
}

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-19 20:34:58
/* Smarty version 5.7.0, created on 2026-02-19 22:12:22
from 'file:views/home.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_699773f2d00b20_63958967',
'unifunc' => 'content_69978ac6b0b222_32068546',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -21,20 +21,20 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/preview.tpl' => 1,
),
))) {
function content_699773f2d00b20_63958967 (\Smarty\Template $_smarty_tpl) {
function content_69978ac6b0b222_32068546 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1754256969699773f2cfc9e0_97315296', "content");
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_25908580169978ac6b06f52_32628533', "content");
?>
<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
}
/* {block "content"} */
class Block_1754256969699773f2cfc9e0_97315296 extends \Smarty\Runtime\Block
class Block_25908580169978ac6b06f52_32628533 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-19 20:34:58
/* Smarty version 5.7.0, created on 2026-02-19 22:12:22
from 'file:views/layout.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_699773f2daec37_53772832',
'unifunc' => 'content_69978ac6bc10c8_56568837',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/footer.tpl' => 1,
),
))) {
function content_699773f2daec37_53772832 (\Smarty\Template $_smarty_tpl) {
function content_69978ac6bc10c8_56568837 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, false);
$_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?>
<?php
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1261446363699773f2dad438_86277148', "content");
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_70694026869978ac6bbf874_52756185', "content");
?>
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
}
/* {block "content"} */
class Block_1261446363699773f2dad438_86277148 extends \Smarty\Runtime\Block
class Block_70694026869978ac6bbf874_52756185 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views';

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-19 20:34:59
/* Smarty version 5.7.0, created on 2026-02-19 22:12:22
from 'file:views/_partial/footer.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_699773f31603e6_74741526',
'unifunc' => 'content_69978ac6ef0740_24328389',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array (
),
))) {
function content_699773f31603e6_74741526 (\Smarty\Template $_smarty_tpl) {
function content_69978ac6ef0740_24328389 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?>
<footer class="footer container-fluid d-flex justify-content-around mt-auto">

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-19 20:34:59
/* Smarty version 5.7.0, created on 2026-02-19 22:12:22
from 'file:views/_partial/preview.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_699773f30290e1_79139964',
'unifunc' => 'content_69978ac6db0a09_75278520',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
array (
),
))) {
function content_699773f30290e1_79139964 (\Smarty\Template $_smarty_tpl) {
function content_69978ac6db0a09_75278520 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?><article class="col-md-3 mb-5 <?php if ((true && (true && null !== ($_SESSION['user'] ?? null))) && $_SESSION['user']['user_status'] == 2) {?> pb-5 <?php }?>" style="border-radius: 100px ;">
<div class="card h-100 shadow article-card rounded-4" style="border-width: 2px; overflow: hidden;">

View file

@ -1,11 +1,11 @@
<?php
/* Smarty version 5.7.0, created on 2026-02-19 20:34:58
/* Smarty version 5.7.0, created on 2026-02-19 22:12:22
from 'file:views/_partial/header.tpl' */
/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.7.0',
'unifunc' => 'content_699773f2e1fb23_50571046',
'unifunc' => 'content_69978ac6c3fc31_29835641',
'has_nocache_code' => false,
'file_dependency' =>
array (
@ -21,7 +21,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
'file:views/_partial/messages.tpl' => 1,
),
))) {
function content_699773f2e1fb23_50571046 (\Smarty\Template $_smarty_tpl) {
function content_69978ac6c3fc31_29835641 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
?><!DOCTYPE html>
<html lang="fr">