Classe user

user
Anna BOUDOUL 2 years ago
parent 1f3ed90963
commit 4f8184f8ef

@ -0,0 +1,27 @@
<?php
class User{
private string $login;
private string $mdp;
function __construct($login, $mdp) {
$this->login = $login;
$this->mdp = $mdp;
}
function get_login() {
return $this->login;
}
function set_login($login) {
$this->login = $login;
}
function get_mdp() {
return $this->mdp;
}
function set_mdp($mdp) {
$this->mdp = $mdp;
}
}
?>

@ -0,0 +1,33 @@
<?php
class Connection extends PDO {
private $stmt;
public function __construct(string $dsn, string $username, string $password) {
parent::__construct($dsn,$username,$password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
/** * @param string $query
* @param array $parameters *
* @return bool Returns `true` on success, `false` otherwise
*/
public function executeQuery(string $query, array $parameters = []) : bool{
$this->stmt = parent::prepare($query);
foreach ($parameters as $name => $value) {
$this->stmt->bindValue($name, $value[0], $value[1]);
}
return $this->stmt->execute();
}
public function getResults() : array {
return $this->stmt->fetchall();
}
}
?>

@ -0,0 +1,2 @@
<?php
?>

@ -18,6 +18,11 @@ label{
margin-top : 20px;
}
#envoyer{
width : 150px;
height : 30px;
}
#btnEnvoi{
margin: 20px;
}

@ -7,7 +7,7 @@
<h1>Magnifique To do list</h1>
<form action="authentification.php" method="POST">
<label>Login</label>
<input type="text" name="login" placeholder="Saisir votre login" required />
<input type="text" name="login" placeholder="Saisissez votre login" required />
<label>Mot de passe</label>
<input type="mdp" name="mdp" placeholder="Saisissez votre mot de passe" required />
<div id="btnEnvoi">

@ -0,0 +1 @@
<a href="CtrlUser.php?action=exaction&id=1"
Loading…
Cancel
Save