You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.2 KiB
53 lines
1.2 KiB
#include "Msae.h"
|
|
|
|
void clearpage(void)
|
|
{
|
|
char entre;
|
|
printf("\nappuyé sur la touche [ENTREE] pour continuer");
|
|
scanf("%*c%c", &entre);
|
|
system("clear");
|
|
}
|
|
|
|
int login(void)
|
|
{
|
|
int i=3;
|
|
char id,mdp[31]="mettez20svp",mdpatrouve[31];
|
|
system("clear");
|
|
printf("################################################################\n\tBienvenue!\n\n\n\tSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur? (U/A)\t");
|
|
scanf("%c%*c",&id);
|
|
if(id=='q')
|
|
return -1;
|
|
while(id!='A' && id!='a' && id!='U' && id!='u')
|
|
{
|
|
system("clear");
|
|
printf("################################################################\n\tMauvaise saisie (q pour quitter)\n\n\n\tSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur? (U/A)\t");
|
|
scanf("%c%*c",&id);
|
|
if(id=='q')
|
|
return -1;
|
|
}
|
|
if(id=='A' || id=='a')
|
|
{
|
|
while(i!=0)
|
|
{
|
|
printf("\n\n\n\tMot de passe :\t");
|
|
system("stty -echo");
|
|
fgets(mdpatrouve,31,stdin);
|
|
mdpatrouve[strlen(mdpatrouve)-1] = '\0';
|
|
if( strcmp(mdpatrouve,mdp) == 0 )
|
|
{
|
|
system("stty echo");
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
i--;
|
|
printf("Mot de passe incorrect, il vous reste %d chances\n",i);
|
|
}
|
|
system("stty echo");
|
|
}
|
|
return -1;
|
|
}
|
|
else return 0;
|
|
system("clear");
|
|
}
|