1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| bool CMysql::Verification(const char *login, const char *pass)
{
int nbligne,rep;
bool autorisation=false;
char *requete="select * from user";
mysql_select_db(bdd,"projet");
rep = mysql_real_query (bdd, requete, (unsigned int) strlen (requete));
resultat = mysql_store_result (bdd);
nbligne = mysql_num_rows (resultat);
lignes = mysql_fetch_row (resultat);
for(int i=0; i<nbligne; i++)
{
if ( ( lignes[1]== login ) || ( lignes[2]==pass ) )
{
printf("SUCCES\n");
printf("Login : %s, champ : %s\n",login,lignes[1]);
printf("Pass : %s, champ : %s\n",pass,lignes[2]);
autorisation=true;
}
else if ( ( lignes[1]!=login ) && ( lignes[2]!=pass ) )
{
printf("ERREUR\n");
printf("Login : %s, champ : %s\n",login,lignes[1]);
printf("Pass : %s, champ : %s\n",pass,lignes[2]);
autorisation=false;
}
}
mysql_free_result (resultat); // Pour libérer la mémoire
return autorisation;
} |
Partager