Skip to content

Commit

Permalink
tyt
Browse files Browse the repository at this point in the history
  • Loading branch information
adriendelagneau committed Aug 17, 2021
1 parent 11c6792 commit 5891b00
Show file tree
Hide file tree
Showing 10 changed files with 837 additions and 767 deletions.
679 changes: 379 additions & 300 deletions app/Controllers/back/BackController.php

Large diffs are not rendered by default.

378 changes: 191 additions & 187 deletions app/Controllers/front/FrontController.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Views/back/listOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1> Liste des commandes</h1>
<section>

<?php foreach($totos as $titi) { ?>
<?php foreach($inscriptonUsers as $titi) { ?>

<div class="card_articles">
<div class="article_title">numero de commande : <?= $titi["userName"] ?></div>
Expand Down
12 changes: 6 additions & 6 deletions app/Views/front/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@
<label for="name">Nom :</label>
<input type="text" id="name" name="name" placeholder="Legrand">
<span class="error">
<?php if(isset($errors["required_name"])){echo $errors["required_name"];} ?>
<?php if(isset($errorContact["required_name"])){echo $errorContact["required_name"];} ?>
</span>

<label for="email">Email :</label>
<input type="email" id="email" name="mail" placeholder="[email protected]">
<span class="error">
<?php if(isset($errors["invalid_email"])){ echo $errors["invalid_email"];} ?>
<?php if(isset($errorContact["invalid_email"])){ echo $errorContact["invalid_email"];} ?>
</span>
<span class="error">
<?php if(isset($errors["required_email"])){echo $errors["required_email"];} ?>
<?php if(isset($errorContact["required_email"])){echo $errorContact["required_email"];} ?>
</span>

<label for="sujet">Sujet :</label>
<input type="text" id="sujet" name="sujet" placeholder="L'objet de votre message">
<span class="error">
<?php if(isset($errors["required_sujet"])){echo $errors["required_sujet"]; }?>
<?php if(isset($errorContact["required_sujet"])){echo $errorContact["required_sujet"]; }?>
</span>

<label for="message">votre message :</label>
<textarea id="message" name="content"></textarea>
<span class="error">
<?php if(isset($errors["required_content"])){echo $errors["required_content"]; }?>
<?php if(isset($errorContact["required_content"])){echo $errorContact["required_content"]; }?>
</span>
<span class="error">
<?php if(isset($errors["too_long_message"])){echo $errors["too_long_message"];}?>
<?php if(isset($errorContact["too_long_message"])){echo $errorContact["too_long_message"];}?>
</span>

<input id="submit" type="submit" value="Envoyer">
Expand Down
12 changes: 6 additions & 6 deletions app/Views/front/inscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@
<label for="userName">Nom :</label>
<input type="text" id="userName" name="userName" placeholder="Legrand">
<span class="error">
<?php if(isset($errorsz["required_userName"])){echo $errorsz["required_userName"];} ?>
<?php if(isset($errorInscription["required_userName"])){echo $errorInscription["required_userName"];} ?>
</span>

<label for="userFirstname">Prenom :</label>
<input type="text" id="userFirstname" name="userFirstname" placeholder="John">
<span class="error">
<?php if(isset($errorsz["required_userFirstname"])){echo $errorsz["required_userFirstname"];} ?>
<?php if(isset($errorInscription["required_userFirstname"])){echo $errorInscription["required_userFirstname"];} ?>
</span>

<label for="userAdress">Votre adresse :</label>
<input type="text" name="userAdress" id="userAdress" placeholder="3 rue des peupliers">
<div id="item"></div>
<span class="error">
<?php if(isset($errorsz["required_userAdress"])){echo $errorsz["required_userAdress"];} ?>
<?php if(isset($errorInscription["required_userAdress"])){echo $errorInscription["required_userAdress"];} ?>
</span>

<label for="userPhone">Téléphone:</label>
<input type="text" id="userPhone" name="userPhone" placeholder="06 10 10 47 **">
<span class="error">
<?php if(isset($errorsz["required_userPhone"])){echo $errorsz["required_userPhone"];} ?>
<?php if(isset($errorInscription["required_userPhone"])){echo $errorInscription["required_userPhone"];} ?>
</span>

<label for="userEmail">Email :</label>
<input type="email" id="userEmail" name="userMail" placeholder="[email protected]">
<span class="error">
<?php if(isset($errorsz["required_userEmail"])){echo $errorsz["required_userEmail"];} ?>
<?php if(isset($errorInscription["required_userEmail"])){echo $errorInscription["required_userEmail"];} ?>
</span>

<label for="userPWD">Mot De Passe</label>
<input type="password" id="userPWD" name="userPWD" placeholder="John"><!-- type pwd -->
<span class="error">
<?php if(isset($errorsz["required_userPWD"])){echo $errorsz["required_userPWD"];} ?>
<?php if(isset($errorInscription["required_userPWD"])){echo $errorInscription["required_userPWD"];} ?>
</span>

<input id="submit" type="submit" value="Envoyer">
Expand Down
2 changes: 1 addition & 1 deletion app/Views/front/templates/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<li><a href="index.php?action=burger">Burgers </a></li>
<li><a href="index.php?action=boissons"> Boissons</a></li>
<li><a href="index.php?action=contact"> Contact</a></li>
<li><a href="index.php?action=toto"> Inscription</a></li>
<li><a href="index.php?action=inscriptonUser"> Inscription</a></li>
</ul>
<div id="icons">
<div id="userIcon"><i class="fas fa-user"></i></div>
Expand Down
20 changes: 10 additions & 10 deletions blabla.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,48 @@ DESCRIPTION b166e1518483 185.98.131.149
// Removing all illegal characters from email
$userMail = filter_var($userMail, FILTER_SANITIZE_EMAIL);

$errorsx = array();
$errorContactx = array();


if(empty($userName)){
$errorsx["required_name"] = "The name is required";
$errorContactx["required_name"] = "The name is required";
}

if(empty($userFirstname)){
$errorsx["required_Firstname"] = "The Firstname is required";
$errorContactx["required_Firstname"] = "The Firstname is required";
}

if(empty($userAdress)){
$errorsx["required_adress"] = "The adress is required";
$errorContactx["required_adress"] = "The adress is required";
}

if(empty($userPhone)){
$errorsx["required_Phone"] = "The Phone number is required";
$errorContactx["required_Phone"] = "The Phone number is required";
}


if(!empty($userMail) && filter_var($userMail, FILTER_VALIDATE_EMAIL) == false) {
$errorsx["invalid_email"] = "The e-mail is invalid";
$errorContactx["invalid_email"] = "The e-mail is invalid";
}

if(empty($userMail)){
$errorsx["required_email"] = "The e-mail is required";
$errorContactx["required_email"] = "The e-mail is required";
}

if(empty($userPWD)){
$errorsx["required_PWD"] = "The password is required";
$errorContactx["required_PWD"] = "The password is required";
}

if(!empty($userName) && (!empty($userFirstname) && (!empty($userAdress) && (!empty($userPhone) && (!empty($userMail) && (!empty($userPWD) )))))) {
if(empty($errorsx)) {
if(empty($errorContactx)) {
$inscription = $userManager->inscription($userName, $userFirstname, $userAdress, $userPhone, $userMail, $userPWD);
$aLaUne = new \Project\Models\ImagesManager();
$allALaUne = $aLaUne->getALaUne();
require "app/Views/front/contact.php";
echo '<script>alert("message envoyé");</script>';
}
} else{
$this->contact($errorsx);
$this->contact($errorContactx);
}
}

Expand Down
119 changes: 55 additions & 64 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,93 +2,84 @@

session_start();

require_once __DIR__ . "/vendor/autoload.php";

try{
require_once __DIR__.'/vendor/autoload.php';

try {
$frontController = new Project\Controllers\front\FrontController();

if(isset ($_GET["action"])){

if($_GET["action"] == "pizzas"){
if (isset($_GET['action'])) {
if ($_GET['action'] == 'pizzas') {
$frontController->pizzas();
}
else if($_GET["action"] == "accueil"){
}
elseif ($_GET['action'] == 'accueil') {
$frontController->accueil();
}
else if($_GET["action"] == "veg"){
$isVeg = $_GET["isVeg"];
}
elseif ($_GET['action'] == 'veg') {
$isVeg = $_GET['isVeg'];
$frontController->veg($isVeg);
}
else if($_GET["action"] == "pigless"){
$isPigless = $_GET["isPigless"];
elseif ($_GET['action'] == 'pigless') {
$isPigless = $_GET['isPigless'];
$frontController->pigless($isPigless);
}
else if($_GET["action"] == "burger"){
elseif ($_GET['action'] == 'burger') {
$frontController->burger();
}
else if($_GET["action"] == "boissons"){
}
elseif ($_GET['action'] == 'boissons') {
$frontController->boissons();
}
else if($_GET["action"] == "alcool"){
$isAlcool = $_GET["isAlcool"];
}
elseif ($_GET['action'] == 'alcool') {
$isAlcool = $_GET['isAlcool'];
$frontController->alcool($isAlcool);
}
else if($_GET["action"] == "contact"){
}
elseif ($_GET['action'] == 'contact') {
$frontController->contact();
}
else if($_GET["action"] == "toto"){
$frontController->toto();
elseif ($_GET['action'] == 'inscriptonUser') {
$frontController->inscriptonUser();
}

else if($_GET["action"] == "inscription"){

$userName = htmlspecialchars($_POST["userName"]);
$userFirstname = htmlspecialchars($_POST["userFirstname"]);
$userAdress = htmlspecialchars($_POST["userAdress"]);
$userPhone = htmlspecialchars($_POST["userPhone"]);
$userMail = htmlspecialchars($_POST["userMail"]);

$user1 = htmlspecialchars($_POST["userPWD"]);
elseif ($_GET['action'] == 'inscription') {
$userName = htmlspecialchars($_POST['userName']);
$userFirstname = htmlspecialchars($_POST['userFirstname']);
$userAdress = htmlspecialchars($_POST['userAdress']);
$userPhone = htmlspecialchars($_POST['userPhone']);
$userMail = htmlspecialchars($_POST['userMail']);
$user1 = htmlspecialchars($_POST['userPWD']);
$userPWD = password_hash($user1, PASSWORD_DEFAULT);

$frontController->inscription($userName, $userFirstname, $userAdress,$userPhone,$userMail, $userPWD);
}
$frontController->inscription($userName, $userFirstname, $userAdress, $userPhone, $userMail, $userPWD);
}
elseif ($_GET['action'] == 'contactMail') {
$lastname = htmlspecialchars($_POST['name']);
$mail = htmlspecialchars($_POST['mail']);
$sujet = htmlspecialchars($_POST['sujet']);
$content = htmlspecialchars($_POST['content']);

else if($_GET["action"] == "contactMail"){
$lastname = htmlspecialchars($_POST["name"]);
$mail = htmlspecialchars($_POST["mail"]);
$sujet = htmlspecialchars($_POST["sujet"]);
$content = htmlspecialchars($_POST["content"]);
$frontController->contactMail($lastname, $mail, $sujet, $content);
}
$frontController->contactMail($lastname, $mail, $sujet, $content);
}
elseif ($_GET['action'] == 'connexionAdmin') {
$pseudo = htmlspecialchars($_POST['pseudo']);
$mdp = htmlspecialchars($_POST['pwd']);

else if($_GET["action"] == 'connexionAdmin'){
$pseudo = htmlspecialchars($_POST["pseudo"]);
$mdp = htmlspecialchars($_POST["pwd"]);
if(!empty($pseudo) && !empty($mdp)){
if (!empty($pseudo) && !empty($mdp)) {
$frontController->connexionAdmin($pseudo, $mdp);
}else{
} else {
$frontController->erreurChampsVides();
}
}
}
}
elseif ($_GET['action'] == 'connexionUser') {
$userName = htmlspecialchars($_POST['pseudoUser']);
$userPWD = htmlspecialchars($_POST['pwdUser']);

else if($_GET["action"] == 'connexionUser'){
$userName = htmlspecialchars($_POST["pseudoUser"]);
$userPWD = htmlspecialchars($_POST["pwdUser"]);
if(!empty($userName) && !empty($userPWD)){
if (!empty($userName) && !empty($userPWD)) {
$frontController->connexionUser($userName, $userPWD);
}else{
} else {
$frontController->erreurChampsVides();
}
}

}else{
$frontController->accueil();
}
}catch(Exception $e){
die("Erreur:" . $e->getMessage());
};

} else {
$frontController->accueil();
}
} catch (Exception $e) {
die('Erreur:'.$e->getMessage());
}
Loading

0 comments on commit 5891b00

Please sign in to comment.