Merge branch 'pre-master' of https://codefirst.iut.uca.fr/git/roxane.rossetto/Php_RSS into pre-master
commit
758f6eeb31
@ -1,14 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/twig/twig" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/twig/twig" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/mvc_PSR4_twig.iml" filepath="$PROJECT_DIR$/.idea/mvc_PSR4_twig.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" packagePrefix="config\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/controleur" isTestSource="false" packagePrefix="controleur\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/metier" isTestSource="false" packagePrefix="modeles\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/twig/twig" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace DAL;
|
||||
|
||||
use App\modeles\Article;
|
||||
use PDO;
|
||||
class ArticleGateway
|
||||
{
|
||||
private $con;
|
||||
|
||||
/**
|
||||
* @param $con
|
||||
*/
|
||||
public function __construct($con)
|
||||
{
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
public function getAllArticles():array
|
||||
{
|
||||
$query = 'SELECT * FROM Article;';
|
||||
$this->con->executeQuery($query, array());
|
||||
return $this->con->getResults();
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace DAL;
|
||||
|
||||
use PDO;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace DAL;
|
||||
|
||||
use PDO;
|
||||
|
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
namespace config;
|
||||
|
||||
class Validation
|
||||
{
|
||||
public 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';
|
||||
}
|
||||
}
|
||||
|
||||
public static function val_form(string &$nom, string &$age, &$dVueEreur)
|
||||
{
|
||||
if (!isset($nom) || $nom == '') {
|
||||
$dVueEreur[] = 'pas de nom';
|
||||
$nom = '';
|
||||
}
|
||||
|
||||
if ( strlen(htmlspecialchars($nom, ENT_QUOTES)) != strlen($nom) ) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
namespace config;
|
||||
|
||||
class Validation
|
||||
{
|
||||
public 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';
|
||||
}
|
||||
}
|
||||
|
||||
public static function val_form(string &$nom, string &$age, &$dVueEreur)
|
||||
{
|
||||
if (!isset($nom) || $nom == '') {
|
||||
$dVueEreur[] = 'pas de nom';
|
||||
$nom = '';
|
||||
}
|
||||
|
||||
if ( strlen(htmlspecialchars($nom, ENT_QUOTES)) != strlen($nom) ) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
//gen
|
||||
$rep = __DIR__ . '/../';
|
||||
|
||||
// liste des modules à inclure
|
||||
|
||||
//$dConfig['includes']= array('controleur/Validation.php');
|
||||
|
||||
//BD
|
||||
|
||||
$base = 'sasa';
|
||||
$login = '';
|
||||
$mdp = '';
|
||||
<?php
|
||||
|
||||
//gen
|
||||
$rep = __DIR__ . '/../';
|
||||
|
||||
// liste des modules à inclure
|
||||
|
||||
//$dConfig['includes']= array('controleur/Validation.php');
|
||||
|
||||
//BD
|
||||
|
||||
$base = 'sasa';
|
||||
$login = '';
|
||||
$mdp = '';
|
@ -1,81 +1,83 @@
|
||||
<?php
|
||||
namespace controleur;
|
||||
|
||||
class Controleur
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
// on démarre ou reprend la session pas utilisée ici
|
||||
session_start();
|
||||
|
||||
//debut
|
||||
|
||||
//on initialise un tableau d'erreur
|
||||
$dVueEreur = [];
|
||||
|
||||
try {
|
||||
$action = $_REQUEST['action'] ?? null;
|
||||
|
||||
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";
|
||||
echo $twig->render('vuephp1.html', ['dVueEreur' => $dVueEreur]);
|
||||
break;
|
||||
}
|
||||
} catch (\PDOException $e) {
|
||||
//si erreur BD, pas le cas ici
|
||||
$dVueEreur[] = 'Erreur inattendue!!! ';
|
||||
} catch (\Exception $e2) {
|
||||
$dVueEreur[] = 'Erreur inattendue!!! ';
|
||||
echo $twig->render('erreur.html', ['dVueEreur' => $dVueEreur]);
|
||||
}
|
||||
|
||||
//fin
|
||||
exit(0);
|
||||
}//fin constructeur
|
||||
|
||||
public function Reinit()
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
|
||||
$dVue = [
|
||||
'nom' => '',
|
||||
'age' => 0,
|
||||
];
|
||||
echo $twig->render('vuephp1.html', [
|
||||
'dVue' => $dVue
|
||||
]);
|
||||
}
|
||||
|
||||
public function ValidationFormulaire(array $dVueEreur)
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
|
||||
//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 \modeles\Simplemodel();
|
||||
$data = $model->get_data();
|
||||
|
||||
$dVue = [
|
||||
'nom' => $nom,
|
||||
'age' => $age,
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
echo $twig->render('vuephp1.html', ['dVue' => $dVue, 'dVueEreur' => $dVueEreur]);
|
||||
}
|
||||
}//fin class
|
||||
<?php
|
||||
namespace controleur;
|
||||
|
||||
use model\ArticleModel;
|
||||
|
||||
class Controleur
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
session_start();
|
||||
$tabArticle[] = ArticleModel::getArticles();
|
||||
//debut
|
||||
|
||||
//on initialise un tableau d'erreur
|
||||
$dVueEreur = [];
|
||||
|
||||
try {
|
||||
$action = $_REQUEST['action'] ?? null;
|
||||
|
||||
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";
|
||||
$dataview = ['Article'=> $tabArticle];
|
||||
echo $twig->render('listArticle.html', ['tabArticle' => $dataview, 'dVueErreur'=>$dVueEreur]);
|
||||
break;
|
||||
}
|
||||
} catch (\PDOException $e) {
|
||||
//si erreur BD, pas le cas ici
|
||||
$dVueEreur[] = 'Erreur inattendue!!! ';
|
||||
} catch (\Exception $e2) {
|
||||
$dVueEreur[] = 'Erreur inattendue!!! ';
|
||||
echo $twig->render('erreur.html', ['dVueEreur' => $dVueEreur]);
|
||||
}
|
||||
|
||||
//fin
|
||||
exit(0);
|
||||
}//fin constructeur
|
||||
|
||||
public function Reinit()
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
|
||||
$dVue = [
|
||||
'nom' => '',
|
||||
'age' => 0,
|
||||
];
|
||||
echo $twig->render('vuephp1.html', [
|
||||
'dVue' => $dVue
|
||||
]);
|
||||
}
|
||||
|
||||
public function ValidationFormulaire(array $dVueEreur)
|
||||
{
|
||||
global $twig; // nécessaire pour utiliser variables globales
|
||||
|
||||
//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 \metier\Simplemodel();
|
||||
$data = $model->get_data();
|
||||
|
||||
$dVue = [
|
||||
'nom' => $nom,
|
||||
'age' => $age,
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
echo $twig->render('vuephp1.html', ['dVue' => $dVue, 'dVueEreur' => $dVueEreur]);
|
||||
}
|
||||
}//fin class
|
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
//chargement config
|
||||
require_once __DIR__ . '/config/config.php';
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use controleur\Controleur;
|
||||
|
||||
//twig
|
||||
$loader = new \Twig\Loader\FilesystemLoader('templates');
|
||||
$twig = new \Twig\Environment($loader, [
|
||||
'cache' => 'cache',
|
||||
]);
|
||||
|
||||
$cont = new Controleur();
|
||||
<?php
|
||||
|
||||
//chargement config
|
||||
require_once __DIR__ . '/config/config.php';
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use controleur\Controleur;
|
||||
|
||||
//twig
|
||||
$loader = new \Twig\Loader\FilesystemLoader('templates');
|
||||
$twig = new \Twig\Environment($loader, [
|
||||
'cache' => false,
|
||||
]);
|
||||
|
||||
$cont = new Controleur();
|
@ -1,127 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace metier;
|
||||
|
||||
class Article
|
||||
{
|
||||
private int $id;
|
||||
private string $title;
|
||||
private string $date;
|
||||
private string $description;
|
||||
private string $guid;
|
||||
private string $link;
|
||||
private string $mediaContent;
|
||||
private int $provenance;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $title
|
||||
* @param string $date
|
||||
* @param string $description
|
||||
* @param string $guid
|
||||
* @param string $link
|
||||
* @param string $mediaContent
|
||||
* @param int $provenance
|
||||
*/
|
||||
public function __construct(string $title, string $date, string $description, string $guid, string $link, string $mediaContent)
|
||||
public function __construct(int $id, string $title, string $date, string $description, string $guid, string $link, string $mediaContent, int $provenance)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->title = $title;
|
||||
$this->date = $date;
|
||||
$this->description = $description;
|
||||
$this->guid = $guid;
|
||||
$this->link = $link;
|
||||
$this->mediaContent = $mediaContent;
|
||||
$this->provenance = $provenance;
|
||||
}
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): void
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle(string $title): void
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDate(): string
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $date
|
||||
*/
|
||||
public function setDate(string $date): void
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGuid(): string
|
||||
{
|
||||
return $this->guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $guid
|
||||
*/
|
||||
public function setGuid(string $guid): void
|
||||
{
|
||||
$this->guid = $guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink(): string
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $link
|
||||
*/
|
||||
public function setLink(string $link): void
|
||||
{
|
||||
$this->link = $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMediaContent(): string
|
||||
{
|
||||
return $this->mediaContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mediaContent
|
||||
*/
|
||||
public function setMediaContent(string $mediaContent): void
|
||||
{
|
||||
$this->mediaContent = $mediaContent;
|
||||
}
|
||||
|
||||
public function getProvenance(): int
|
||||
{
|
||||
return $this->provenance;
|
||||
}
|
||||
|
||||
public function setProvenance(int $provenance): void
|
||||
{
|
||||
$this->provenance = $provenance;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace metier;
|
||||
|
||||
class Flux
|
||||
{
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
use DAL;
|
||||
use metier;
|
||||
class ArticleModel
|
||||
{
|
||||
public static function getArticles() : array
|
||||
{
|
||||
$gwArticle = new DAL\ArticleGateway(new DAL\Connection('mysql:host = localhost; dbname = dbrorossetto', 'rorossetto', 'tpphp'));
|
||||
$res = $gwArticle->getAllArticles();
|
||||
foreach($res as $row){
|
||||
$tabArticle[] = new metier\Article($row['id'], $row['title'],$row['datePub'],$row['description'],$row['guid'],$row['link'],$row['mediaContent'],$row['provenance'] );
|
||||
}
|
||||
return $tabArticle;
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Erreur</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>ERREUR page !!!!!</h1>
|
||||
{% if dVueEreur is defined %}
|
||||
{% for value in dVueEreur %}
|
||||
<p>{{value}}</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Erreur</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>ERREUR page !!!!!</h1>
|
||||
{% if dVueEreur is defined %}
|
||||
{% for value in dVueEreur %}
|
||||
<p>{{value}}</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>All Articles</title>
|
||||
</head>
|
||||
<body>
|
||||
{% for value in tabArticle.Article %}
|
||||
<p>{{value}}</p>
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
@ -1,105 +1,105 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Personne - formulaire</title>
|
||||
<script type="text/javascript">
|
||||
function clearForm(oForm) {
|
||||
const elements = oForm.elements;
|
||||
oForm.reset();
|
||||
|
||||
for (i = 0; i < elements.length; i++) {
|
||||
field_type = elements[i].type.toLowerCase();
|
||||
|
||||
switch (field_type) {
|
||||
case "text":
|
||||
case "password":
|
||||
case "textarea":
|
||||
case "hidden":
|
||||
elements[i].value = "";
|
||||
break;
|
||||
|
||||
case "radio":
|
||||
case "checkbox":
|
||||
if (elements[i].checked) {
|
||||
elements[i].checked = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "select-one":
|
||||
case "select-multi":
|
||||
elements[i].selectedIndex = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- on vérifie les données provenant du modèle -->
|
||||
{% if dVue is defined %}
|
||||
<div align="center">
|
||||
{% if dVueEreur is defined and dVueEreur|length >0 %}
|
||||
<h2>ERREUR !!!!!</h2>
|
||||
{% for value in dVueEreur %}
|
||||
<p>{{value}}</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<h2>Personne - formulaire</h2>
|
||||
<hr />
|
||||
<!-- affichage de données provenant du modèle -->
|
||||
{{dVue.data}}
|
||||
|
||||
<form method="post" name="myform" id="myform">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Nom</td>
|
||||
<td>
|
||||
<input name="txtNom" value="{{dVue.nom}}" type="text" size="20" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Age</td>
|
||||
<td>
|
||||
<input
|
||||
name="txtAge"
|
||||
value="{{dVue.age}}"
|
||||
type="text"
|
||||
size="3"
|
||||
required
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td><input type="submit" value="Envoyer" /></td>
|
||||
<td><input type="reset" value="Rétablir" /></td>
|
||||
<td>
|
||||
<input
|
||||
type="button"
|
||||
value="Effacer"
|
||||
onclick="clearForm(this.form);"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- action !!!!!!!!!! -->
|
||||
<input type="hidden" name="action" value="validationFormulaire" />
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>Erreur !!<br />utilisation anormale de la vuephp</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
Essayez de mettre du code html dans nom -> Correspond à une attaque de type injection
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Personne - formulaire</title>
|
||||
<script type="text/javascript">
|
||||
function clearForm(oForm) {
|
||||
const elements = oForm.elements;
|
||||
oForm.reset();
|
||||
|
||||
for (i = 0; i < elements.length; i++) {
|
||||
field_type = elements[i].type.toLowerCase();
|
||||
|
||||
switch (field_type) {
|
||||
case "text":
|
||||
case "password":
|
||||
case "textarea":
|
||||
case "hidden":
|
||||
elements[i].value = "";
|
||||
break;
|
||||
|
||||
case "radio":
|
||||
case "checkbox":
|
||||
if (elements[i].checked) {
|
||||
elements[i].checked = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "select-one":
|
||||
case "select-multi":
|
||||
elements[i].selectedIndex = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- on vérifie les données provenant du modèle -->
|
||||
{% if dVue is defined %}
|
||||
<div align="center">
|
||||
{% if dVueEreur is defined and dVueEreur|length >0 %}
|
||||
<h2>ERREUR !!!!!</h2>
|
||||
{% for value in dVueEreur %}
|
||||
<p>{{value}}</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<h2>Personne - formulaire</h2>
|
||||
<hr />
|
||||
<!-- affichage de données provenant du modèle -->
|
||||
{{dVue.data}}
|
||||
|
||||
<form method="post" name="myform" id="myform">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Nom</td>
|
||||
<td>
|
||||
<input name="txtNom" value="{{dVue.nom}}" type="text" size="20" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Age</td>
|
||||
<td>
|
||||
<input
|
||||
name="txtAge"
|
||||
value="{{dVue.age}}"
|
||||
type="text"
|
||||
size="3"
|
||||
required
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td><input type="submit" value="Envoyer" /></td>
|
||||
<td><input type="reset" value="Rétablir" /></td>
|
||||
<td>
|
||||
<input
|
||||
type="button"
|
||||
value="Effacer"
|
||||
onclick="clearForm(this.form);"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- action !!!!!!!!!! -->
|
||||
<input type="hidden" name="action" value="validationFormulaire" />
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>Erreur !!<br />utilisation anormale de la vuephp</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
Essayez de mettre du code html dans nom -> Correspond à une attaque de type injection
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue