This commit is contained in:
parent
26c4272163
commit
927c8a6eea
@ -39,18 +39,35 @@ public class AuthentifForm {
|
||||
* @return true is ok, false sinon
|
||||
*/
|
||||
public boolean controlerRole(HttpServletRequest request) {
|
||||
/* Comparaison entre l'utilisateur admin et un utilisateur créé
|
||||
avec le pseudo et le mdp saisi */
|
||||
/* Comparaison entre l'utilisateur saisi et un utilisateur de la base de donées */
|
||||
// UserP ChefCaserne = new UserP("Michel", "mRANN");
|
||||
try{
|
||||
Statement stmt = theConnection.createStatement();
|
||||
ResultSet resultQ = null;
|
||||
resultQ = stmt.executeQuery("SELECT * FROM pompier WHERE login=);
|
||||
resultQ = stmt.executeQuery("SELECT * FROM pompier WHERE login=ztPseudo");
|
||||
boolean isChef=false;
|
||||
Pompier userSaisi = new Pompier( request.getParameter("ztPseudo"),
|
||||
request.getParameter("ztMDP"));
|
||||
if(request.getParameter("ztPseudo").equals(request)){
|
||||
Pompier userSaisi = new Pompier(resultQ.getInt("id"),
|
||||
resultQ.getInt("idCaserne"),
|
||||
resultQ.getString("nom"),
|
||||
resultQ.getString("prenom"),
|
||||
resultQ.getInt("statut"),
|
||||
resultQ.getString("mail"),
|
||||
resultQ.getString("login"),
|
||||
resultQ.getString("mdp"),
|
||||
resultQ.getInt("adrNo"),
|
||||
resultQ.getString("adrRue"),
|
||||
resultQ.getString("adrCP"),
|
||||
resultQ.getString("adrVille"),
|
||||
resultQ.getInt("grade"),
|
||||
resultQ.getString("commentaire"));
|
||||
if(request.getParameter("ztPseudo").equals(resultQ.getString("login"))){
|
||||
isChef=true;
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.out.println("SQLException : " + ex.getMessage());
|
||||
System.out.println("SQLState : " + ex.getSQLState());
|
||||
System.out.println("Code erreur : " + ex.getErrorCode());
|
||||
}
|
||||
// Mise à jour de l'attribut resultat
|
||||
setResultat(isChef ? "Vous êtes chef de caserne" : "Vous n'êtes pas chef de caserne");
|
||||
|
||||
|
@ -59,7 +59,8 @@ public class NouveauPompForm {
|
||||
request.getParameter("ztAdrRue"),
|
||||
request.getParameter("ztAdrCP"),
|
||||
request.getParameter("ztAdrVille"),
|
||||
request.getParameter("nGrade")
|
||||
request.getParameter("nGrade"),
|
||||
request.getParameter("commentaire")
|
||||
);
|
||||
PompierMySql cm = new PompierMySql();
|
||||
int id = cm.createRP(unPompier); // Requête préparée
|
||||
|
Loading…
x
Reference in New Issue
Block a user