|
|
@ -25,8 +25,18 @@ Class UserGateway extends Gateway{
|
|
|
|
return $id;
|
|
|
|
return $id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function randomImg():int{
|
|
|
|
|
|
|
|
$query = "SELECT id_img FROM image ORDER BY Random() LIMIT 1";
|
|
|
|
|
|
|
|
$this->co->executeQuery($query);
|
|
|
|
|
|
|
|
$res = $this->co->getResults();
|
|
|
|
|
|
|
|
return $res[0][0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function insertUser(string $pseudo, string $email, string $password, bool $isAdmin, int $imgPrfl) : bool {
|
|
|
|
public function insertUser(string $pseudo, string $email, string $password, bool $isAdmin, int $imgPrfl) : bool {
|
|
|
|
|
|
|
|
|
|
|
|
$id=$this->firstIdUser();
|
|
|
|
$id=$this->firstIdUser();
|
|
|
|
|
|
|
|
$idImg=$this->randomImg();
|
|
|
|
|
|
|
|
|
|
|
|
$query = "
|
|
|
|
$query = "
|
|
|
|
INSERT INTO Users(id_user,username,email,password,creation,img)
|
|
|
|
INSERT INTO Users(id_user,username,email,password,creation,img)
|
|
|
|
VALUES (:id, :pseudo, :email, :password, CURRENT_DATE, :imgPrfl);
|
|
|
|
VALUES (:id, :pseudo, :email, :password, CURRENT_DATE, :imgPrfl);
|
|
|
@ -36,7 +46,7 @@ Class UserGateway extends Gateway{
|
|
|
|
":pseudo" => [$pseudo, PDO::PARAM_STR],
|
|
|
|
":pseudo" => [$pseudo, PDO::PARAM_STR],
|
|
|
|
":email" => [$email, PDO::PARAM_STR],
|
|
|
|
":email" => [$email, PDO::PARAM_STR],
|
|
|
|
":password" => [$password, PDO::PARAM_STR],
|
|
|
|
":password" => [$password, PDO::PARAM_STR],
|
|
|
|
":imgPrfl" => [$imgPrfl, PDO::PARAM_STR]
|
|
|
|
":imgPrfl" => [$idImg, PDO::PARAM_STR]
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|