Lucie Bedouret 2 years ago
commit 92e177f06f

@ -5,16 +5,16 @@
if (!isset($usrName)||$usrName=="") { if (!isset($usrName)||$usrName=="") {
$dataVueEreur[] ="Username or password missing"; $dataVueEreur[] ="Username or password missing";
} }
$usrName = Validation::clear_string($usrName); if ($usrName != Validation::clear_string($usrName)){
if($usrName == false){ $dataVueEreur[] = "Forbidden characters";
$dataVueEreur[] = "Sanitizing error"; $usrName="";
} }
if (!isset($mdp)||$mdp=="") { if (!isset($mdp)||$mdp=="") {
$dataVueEreur[] ="Username or password missing"; $dataVueEreur[] ="Username or password missing";
} }
$mdp = Validation::clear_string($mdp); if($mdp != Validation::clear_string($mdp)){
if($mdp == false){ $dataVueEreur[] = "Forbidden characters";
$dataVueEreur[] = "Sanitizing error"; $mdp="";
} }
return $dataVueEreur; return $dataVueEreur;
} }
@ -23,24 +23,23 @@
if (!isset($username)||$username==="") { if (!isset($username)||$username==="") {
$dataVueEreur[] ="All fields are required"; $dataVueEreur[] ="All fields are required";
} }
$username = Validation::clear_string($username); if($username != Validation::clear_string($username)){
if($username == false){ $dataVueEreur[] = "Forbidden characters";
$dataVueEreur[] = "Sanitizing error"; $username="";
throw new Exception('sanitizing fail');
} }
if (!isset($pwd1)||$pwd1==="") { if (!isset($pwd1)||$pwd1==="") {
$dataVueEreur[] ="All fields are required"; $dataVueEreur[] ="All fields are required";
} }
$pwd1 = Validation::clear_string($pwd1); if($pwd1 != Validation::clear_string($pwd1)){
if($pwd1 == false){ $dataVueEreur[] = "Forbidden characters";
$dataVueEreur[] = "Sanitizing error"; $pwd1="";
} }
if (!isset($pwd2)||$pwd2==="") { if (!isset($pwd2)||$pwd2==="") {
$dataVueEreur[] ="All fields are required"; $dataVueEreur[] ="All fields are required";
} }
$pwd2 = Validation::clear_string($pwd2); if($pwd2 != Validation::clear_string($pwd2)){
if($pwd2 == false){ $dataVueEreur[] = "Forbidden characters";
$dataVueEreur[] = "Sanitizing error"; $pwd2="";
} }
if($pwd1 !== $pwd2){ if($pwd1 !== $pwd2){
$dataVueEreur[]="Invalid confirmation"; $dataVueEreur[]="Invalid confirmation";
@ -48,15 +47,24 @@
return $dataVueEreur; return $dataVueEreur;
} }
static function val_intitule($intitule, $dataVueEreur){ static function val_intitule($name, $dataVueEreur){
if (!isset($intitule)||$intitule==="") { if (!isset($name)||$name==="") {
$dataVueEreur[] ="Intitulé manquant"; $dataVueEreur[] ="Intitulé manquant";
throw new Exception('pas d\'intitule');
} }
$intitule = Validation::clear_string($intitule); if($name != Validation::clear_string($name)){
if($intitule == false){ $dataVueEreur[] = "Forbidden characters";
$dataVueEreur[] = "Sanitizing error"; $name="";
throw new Exception('sanitizing fail'); }
return $dataVueEreur;
}
static function val_id($id, $dataVueEreur){
if (!isset($id)||$id=""){
$dataVueEreur[] = "Id error";
}
if($id != filter_var($id, FILTER_VALIDATE_INT)){
$dataVueEreur[] = "Id validation error";
$id = 0;
} }
return $dataVueEreur; return $dataVueEreur;
} }

@ -3,7 +3,7 @@
//Prefixe //Prefixe
$rep=__DIR__.'/../'; $rep=__DIR__.'/../';
//BD //BD
$bd['dsn'] = "mysql:host=localhost;port=8888;dbname=dbPhp"; $bd['dsn'] = "mysql:host=localhost;port=8888;dbname=bdPhp";
$bd['user'] = "root"; $bd['user'] = "root";
$bd['pswd'] = "root"; $bd['pswd'] = "root";
//Vues //Vues

@ -84,6 +84,7 @@ class ControleurVisiteur {
public function accessListInfos($arrayErrorViews){ public function accessListInfos($arrayErrorViews){
global $rep,$vues,$dataView; global $rep,$vues,$dataView;
$idListe=$_POST['liste']; $idListe=$_POST['liste'];
$arrayErrorViews = Validation::val_id($idListe, $arrayErrorViews);
$model = new ListeModel(); $model = new ListeModel();
$dataView = $model->pullListById($idListe); $dataView = $model->pullListById($idListe);
require($rep.$vues['infosListe']); require($rep.$vues['infosListe']);
@ -93,6 +94,8 @@ class ControleurVisiteur {
global $rep,$vues,$dataView; global $rep,$vues,$dataView;
$nom=$_POST['name']; $nom=$_POST['name'];
$idListe=$_POST['liste']; $idListe=$_POST['liste'];
$arrayErrorViews = Validation::val_intitule($name, $arrayErrorViews);
$arrayErrorViews = Validation::val_id($idListe, $arrayErrorViews);
$model = new TacheModel(); $model = new TacheModel();
$model->addTache($nom,$idListe); $model->addTache($nom,$idListe);
$_REQUEST['action']="accessListInfos"; $_REQUEST['action']="accessListInfos";
@ -102,6 +105,8 @@ class ControleurVisiteur {
public function delTache($arrayErrorViews){ public function delTache($arrayErrorViews){
global $rep,$vues,$dataView; global $rep,$vues,$dataView;
$idTache=$_POST['tache']; $idTache=$_POST['tache'];
$arrayErrorViews = Validation::val_id($idTache, $arrayErrorViews);
$model= new TacheModel(); $model= new TacheModel();
$model->delTache($idTache); $model->delTache($idTache);
$_REQUEST['action']="accessListInfos"; $_REQUEST['action']="accessListInfos";
@ -111,6 +116,7 @@ class ControleurVisiteur {
public function changeCompletedTache($arrayErrorViews){ public function changeCompletedTache($arrayErrorViews){
global $rep,$vues,$dataView; global $rep,$vues,$dataView;
$idTache=$_POST['tache']; $idTache=$_POST['tache'];
$arrayErrorViews = Validation::val_id($idTache, $arrayErrorViews);
$model = new TacheModel(); $model = new TacheModel();
$model->changeCompletedTache($idTache); $model->changeCompletedTache($idTache);
$_REQUEST['action']="accessListInfos"; $_REQUEST['action']="accessListInfos";
@ -184,6 +190,7 @@ class ControleurVisiteur {
public function delListe(array $vues_erreur){ public function delListe(array $vues_erreur){
global $rep, $vues; global $rep, $vues;
$idListe=$_POST['liste']; $idListe=$_POST['liste'];
$arrayErrorViews = Validation::val_id($idListe, $arrayErrorViews);
$model = new ListeModel(); $model = new ListeModel();
$model->delListe($idListe); $model->delListe($idListe);
$_REQUEST['action']=null; $_REQUEST['action']=null;

@ -0,0 +1,33 @@
html,
body {
height: 100%;
}
body {
display: flex;
align-items: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.form-signin {
max-width: 330px;
padding: 15px;
}
.form-signin .form-floating:focus-within {
z-index: 2;
}
.form-signin input[type="text"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
Loading…
Cancel
Save