Amélioration de la page login +Autoloader commencer

rayhan_gatewayTache
Emre KARTAL 2 years ago
parent 0c09742cb9
commit 6fecace1ae

@ -7,7 +7,7 @@
**Nom de lapplication** : ToDoList
</br>
**Thème de lapplication** : Repertorier les tâches à accomplir.
**Thème de lapplication** : Répertorier les tâches à accomplir.
</br>
**Récapitulation de notre application** :
@ -18,7 +18,7 @@
# Repartition du Gitlab
La racine de notre gitlab est composé de deux dossier essentielles au projet:
La racine de notre gitlab est composé de deux dossiers essentiels au projet:
[**src**](src) : **Toute la partie codage du site web**
@ -30,6 +30,6 @@ Notre environnement de travail se base essentiellement sur du php et du HTML/CSS
# Technicien en charge de l'application
La composition pour le projet se voit fait par deux élèves de l'IUT d'aubière:
La composition pour le projet se voit réaliser par deux élèves de l'IUT d'aubière:
- Emre KARTAL (Groupe 4)
- Rayhan HASSOU (Groupe 4)

@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2022-11-18T08:53:01.103Z" agent="5.0 (X11)" etag="T0h4_q4_bEF78AhTsrVm" version="20.5.3" type="device"><diagram id="YT-LZJT85HNrmgPDGNfd" name="Page-1">7Vpdj5s4FP010T5NhG0+H5NMp6NVV5o2/XxaEfAEq4BZYyZJf/2aYBKw6ZBOSUh3q5Ey+GJsc+65514ME7RItq+Zn0V/0RDHE2iE2wm6nUDoAlP8loZdZYCGCSrLmpGwsjUMS/INS6MhrQUJcd7qyCmNOcnaxoCmKQ54y+YzRjftbo80bs+a+WusGZaBH+vWTyTkkbwv6Bzt95iso3pmYHvVmcSvO8s7ySM/pJuGCb2aoAWjlFdHyXaB4xK8GpfqurvvnD0sjOGUn3KBh2i0zJbv33zdBm9v7nPjLXt/I0d58uNC3rBcLN/VCGwiwvEy84OyvRFenqB5xJNYtIA49POswv2RbLGYaq6vq54EM463DZNc52tME8zZTnSpzzoSM8maG1O2N0cX2HWfqAH/wehLt68PYx+REQcSnB8ACnYAZcdi2nlInsThujz8kGNWm8UsjTMdnWvTiqkW9VLFIYJIWXlYJPE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 +1,91 @@
<?php
namespace controleur;
class Controleur {
function __construct() {
global $rep,$vues; // nécessaire pour utiliser variables globales
// on démarre ou reprend la session
session_start();
//debut
//on initialise un tableau d'erreur
$dVueEreur = array ();
try{
$action=$_REQUEST['action'];
switch($action) {
//pas d'action, on réinitialise 1er appel
case NULL:
$this->Reinit();
break;
case "validationFormulaire":
$this->ValidationFormulaire($dVueEreur);
break;
//mauvaise action
default:
$dVueEreur[] = "Erreur d'appel php";
require ($rep.$vues['vuephp1']);
break;
}
} catch (PDOException $e)
{
//si erreur BD, pas le cas ici
$dVueEreur[] = "Erreur inattendue!!! ";
require ($rep.$vues['erreur']);
}
catch (Exception $e2)
{
$dVueEreur[] = "Erreur inattendue!!! ";
require ($rep.$vues['erreur']);
}
//fin
exit(0);
}//fin constructeur
function Reinit() {
global $rep,$vues;
$dVue = array (
'nom' => "",
'age' => 0,
);
require ($rep.$vues['vuephp1']);
}
function ValidationFormulaire(array $dVueEreur) {
global $rep,$vues;
//si exception, ca remonte !!!
$nom=$_POST['txtNom']; // txtNom = nom du champ texte dans le formulaire
$age=$_POST['txtAge'];
\config\Validation::val_form($nom,$age,$dVueEreur);
$model = new \Modele\Simplemodel();
$data=$model->get_data();
$dVue = array (
'nom' => $nom,
'age' => $age,
'data' => $data,
);
require ($rep.$vues['vuephp1']);
}
}//fin class
?>

@ -0,0 +1,19 @@
<?php
namespace modeles;
class Simplemodel
{
//constructeur
//vide
function get_data() :string
{
return "Mon modèle ne fait rien";
}
//fin modèles
}
?>

@ -7,10 +7,74 @@ body {
min-height: 100vh;
background: linear-gradient(to right, #ffffff,#38B6FF);
display: flex;
font-family: sans-serif;
background-color: #81d4fa;
font-weight: bold;
align-items: center;
justify-content: center;
}
.btn{
display: flex;
flex-direction: column;
margin-left: 17rem;
margin-top: -22rem;
}
.btn:link,
.btn:visited {
text-transform: uppercase;
text-decoration: none;
padding: 10px 20px;
display: inline-block;
border-radius: 100px;
font-size: 60%;
transition: all .2s;
position: absolute;
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.btn:active {
transform: translateY(-1px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}
.btn-white {
background-color: #fff;
color: #777;
}
.btn::after {
content: "";
display: inline-block;
height: 100%;
width: 100%;
border-radius: 100px;
position: absolute;
top: 0;
left: 0;
z-index: -1;
transition: all .4s;
}
.btn-white::after {
background-color: #fff;
}
.btn:hover::after {
transform: scaleX(1.5) scaleY(1.7);
opacity: 0;
}
.btn-animated {
animation: moveInBottom 5s ease-out;
animation-fill-mode: backwards;
}
.model {
width: 450px;
background: rgba(255,255,255, .5);
@ -40,6 +104,22 @@ body {
text-align: center;
}
.BoutonVisiteur {
display: flex;
align-items: center;
color: rgba(0, 0, 0, .4);
width: 150px;
height: 50px;
background: rgba(255,255,255,.3);
padding: 1rem 1.5rem;
border-radius: 30px;
}
.BoutonVisiteur:hover {
background: white;
transform: scale(1.1);
}
.model a{
text-decoration: none;
color: #35339a;

@ -5,26 +5,29 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<link rel="stylesheet" href="Vue/css/style.css">
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@48,300,0,0" />
</head>
<body>
<div class="text-box">
<a href="#" class="btn btn-white btn-animate">Rentrer quand même</a>
</div>
<div class="main">
<div class="model">
<div class="main-logo">
<img src="Vue/Images/Logo.png" alt="logo">
<img src="../Images/Logo.png" alt="logo">
</div>
<div class="login-card-header">
<h1>Sign In</h1>
<div>Please login to use platform</div>
<h1>Se Connecter</h1>
</div>
<form class="login-card-form">
<div class="form-item">
<span class="form-item-icon material-symbols-rounded">mail</span>
<input type="text" placeholder="Enter Mail" required autofocus>
</div>
<div class="form item">
<div class="form-item">
<span class="form-item-icon material-symbols-rounded">lock</span>
<input type="password" placeholder="Enter Password" required >
</div>
@ -35,10 +38,10 @@
</div>
<a href="#">Oublie de mot de passe</a>
</div>
<button type="submit">Sign In</button>
<button type="submit">Se connecter</button>
</form>
<div class="login-card-footer">
Pas de compte? <a href="Vue/html/inscription.html">Creer un compte</a>
Pas de compte? <a href="inscription.html">Creer un compte</a>
</div>
</div>
<div class="social">

BIN
src/config/.DS_Store vendored

Binary file not shown.

@ -0,0 +1,55 @@
<?php
//prs0 compliant
class Autoload
{
private static $_instance = null;
public static function charger()
{
if(null !== self::$_instance) {
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
}
self::$_instance = new self();
if(!spl_autoload_register(array(self::$_instance, '_autoload'), false)) {
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
}
}
public static function shutDown()
{
if(null !== self::$_instance) {
if(!spl_autoload_unregister(array(self::$_instance, '_autoload'))) {
throw new RuntimeException('Could not stop the autoload');
}
self::$_instance = null;
}
}
private static function _autoload($className)
{
echo $className;
$folder = "./";
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strripos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
include $folder . $fileName;
}
}
?>

@ -0,0 +1,155 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
* $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
* $classLoader->register();
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Roman S. Borschel <roman@code-factory.org>
* @author Matthew Weier O'Phinney <matthew@zend.com>
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
*/
class SplClassLoader
{
private $_fileExtension = '.php';
private $_namespace;
private $_includePath;
private $_namespaceSeparator = '\\';
/**
* Creates a new <tt>SplClassLoader</tt> that loads classes of the
* specified namespace.
*
* @param string $ns The namespace to use.
*/
public function __construct(string $ns = null, string $includePath = null)
{
$this->_namespace = $ns;
$this->_includePath = $includePath;
}
/**
* Sets the namespace separator used by classes in the namespace of this class loader.
*
* @param string $sep The separator to use.
*/
public function setNamespaceSeparator(string $sep)
{
$this->_namespaceSeparator = $sep;
}
/**
* Gets the namespace seperator used by classes in the namespace of this class loader.
*
* @return void
*/
public function getNamespaceSeparator()
{
return $this->_namespaceSeparator;
}
/**
* Sets the base include path for all class files in the namespace of this class loader.
*
* @param string $includePath
*/
public function setIncludePath(string $includePath)
{
$this->_includePath = $includePath;
}
/**
* Gets the base include path for all class files in the namespace of this class loader.
*
* @return string $includePath
*/
public function getIncludePath()
{
return $this->_includePath;
}
/**
* Sets the file extension of class files in the namespace of this class loader.
*
* @param string $fileExtension
*/
public function setFileExtension($fileExtension)
{
$this->_fileExtension = $fileExtension;
}
/**
* Gets the file extension of class files in the namespace of this class loader.
*
* @return string $fileExtension
*/
public function getFileExtension()
{
return $this->_fileExtension;
}
/**
* Installs this class loader on the SPL autoload stack.
*/
public function register()
{
spl_autoload_register(array($this, 'loadClass'));
}
/**
* Uninstalls this class loader from the SPL autoloader stack.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $className The name of the class to load.
* @return void
*/
public function loadClass(string $className)
{
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
$fileName = '';
$namespace = '';
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
}
}
}

@ -0,0 +1,40 @@
<?php
namespace config;
class Validation {
static function val_action($action) {
if (!isset($action)) {
throw new Exception('pas d\'action');
//on pourrait aussi utiliser
//$action = $_GET['action'] ?? 'no';
// This is equivalent to:
//$action = if (isset($_GET['action'])) $action=$_GET['action'] else $action='no';
}
}
static function val_form(string &$nom, string &$age, &$dVueEreur) {
if (!isset($nom)||$nom=="") {
$dVueEreur[] = "pas de nom";
$nom="";
}
if ($nom != filter_var($nom, FILTER_SANITIZE_STRING))
{
$dVueEreur[] = "testative d'injection de code (attaque sécurité)";
$nom="";
}
if (!isset($age)||$age==""||!filter_var($age, FILTER_VALIDATE_INT)) {
$dVueEreur[] = "pas d'age ";
$age=0;
}
}
}
?>

@ -0,0 +1,24 @@
<?php
//gen
$rep=__DIR__.'/../';
// liste des modules à inclure
//$dConfig['includes']= array('controleur/Validation.php');
//BD
$base="sasa";
$login="";
$mdp="";
//Vues
$vues['erreur']='vues/erreur.php';
$vues['vuephp1']='vues/vuephp1.php';
?>

@ -0,0 +1,17 @@
<?php
//si controller pas objet
// header('Location: controller/controller.php');
//si controller objet
//chargement config
require_once(__DIR__.'/config/config.php');
//chargement autoloader pour autochargement des classes
require_once(__DIR__.'/config/Autoload.php');
Autoload::charger();
$cont = new Controleur();
?>
Loading…
Cancel
Save