diff --git a/business/ListTask.php b/business/ListTask.php index aa34586..5a2ce29 100644 --- a/business/ListTask.php +++ b/business/ListTask.php @@ -1,8 +1,8 @@ owner = $owner; } + function get_id() { return $this->id; } @@ -21,6 +22,14 @@ $this->id = $id; } + function get_nom() { + return $this->nom; + } + + function set_nom($nom) { + $this->nom = $nom; + } + function get_taches() { return $this->taches; } @@ -28,18 +37,11 @@ function set_taches($taches) { $this->taches = $taches; } - - function get_nom() { - return $this->nom; - } - - function set_nom($nom) { - $this->nom= $nom; - } function get_owner() { if($this->owner == "") return NULL; + return $this->owner; } @@ -54,7 +56,5 @@ function set_dc($dc) { $this->dc = $dc; } - - } ?> diff --git a/business/Task.php b/business/Task.php index 5031fcc..d3d85c6 100644 --- a/business/Task.php +++ b/business/Task.php @@ -6,6 +6,7 @@ private $dateDeb; private $dateFin; # $today = date("m.d.y") private string $priorite; + private string $idlist; // # id associating task to list private bool $isDone; // # si la tache est complete diff --git a/business/User.php b/business/User.php index 8f283c2..7de66c5 100644 --- a/business/User.php +++ b/business/User.php @@ -1,13 +1,9 @@ login = $login; - $this->mdp = $mdp; - $this->admin = $admin; } function get_login() { @@ -17,21 +13,5 @@ function set_login($login) { $this->login = $login; } - - function get_mdp() { - return $this->mdp; - } - - function set_mdp($mdp) { - $this->mdp = $mdp; - } - - function get_admin() { - return $this->admin; - } - - function set_admin($admin) { - $this->admin = $admin; - } } ?> \ No newline at end of file diff --git a/config/config.php b/config/config.php index 9e59053..e2a19d3 100644 --- a/config/config.php +++ b/config/config.php @@ -1,6 +1,7 @@ \ No newline at end of file diff --git a/controller/CtrlUser.php b/controller/CtrlUser.php new file mode 100644 index 0000000..0a2359a --- /dev/null +++ b/controller/CtrlUser.php @@ -0,0 +1,39 @@ +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']); + } + exit(0); + } + } + +?> \ No newline at end of file diff --git a/dal/UserGateway.php b/dal/UserGateway.php index 9361d12..d9db4ad 100644 --- a/dal/UserGateway.php +++ b/dal/UserGateway.php @@ -1,20 +1,55 @@ con=$con; - } + public function __construct(Connection $con) { + $this->con = $con; } - public function insert(User $u){ + public function create($login, $mdp){ + $pwrd = password_hash($mdp, PASSWORD_BCRYPT, array("cost" => 12)); + $query = 'INSERT INTO User VALUES (:login, :mdp)'; + $this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR), + ':mdp'=>array($pwrd, PDO::PARAM_STR))); + $result = $this->con->getResults(); + return $result; + } - } -} + public function updateLogin($oldValue, $newValue){ + $query = 'UPDATE User SET login = :newValue WHERE login = :oldValue'; + $this->con->executeQuery($query, array(':oldValue'=>array($oldValue, PDO::PARAM_STR), + ':newValue'=>array($newValue, PDO::PARAM_STR))); + } + public function updateMdp($login, $mdp){ + $pwrd = password_hash($mdp, PASSWORD_BCRYPT, array("cost" => 12)); + $query = 'UPDATE User SET mdp = :value WHERE login = :login'; + $this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR), + ':value'=>array($pwrd, PDO::PARAM_STR))); + } + public function delete($value){ + $query = 'DELETE FROM User WHERE login = :value'; + $this->con->executeQuery($query, array(':value'=>array($value, PDO::PARAM_STR))); + } + + public function find($value, $parameterkind){ + $query = 'SELECT login FROM User WHERE :parameterkind = :value'; + $this->con->executeQuery($query, array(':value'=>array($value, PDO::PARAM_STR), + ':parameterkind'=>array($parameterkind, PDO::PARAM_STR))); + $result = $this->con->getResults(); + return $result; + } -?> + public function findUser($login, $mdp){ + $pwrd = password_hash($mdp, PASSWORD_BCRYPT, array("cost" => 12)); + $query = 'SELECT login FROM User WHERE login = :login AND mdp = :mdp'; + $this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR), + ':mdp'=>array($pwrd, PDO::PARAM_STR))); + $result = $this->con->getResults(); + return $result; + } + } +?> \ No newline at end of file diff --git a/index.php b/index.php index 3996940..5fe3c7f 100644 --- a/index.php +++ b/index.php @@ -1,8 +1,8 @@ 2do index