level00: done
level01: done
This commit is contained in:
38
level01/source.c
Normal file
38
level01/source.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char a_user_name[100];
|
||||
|
||||
bool verify_user_name(void)
|
||||
{
|
||||
puts("verifying username....\n");
|
||||
return memcmp(a_user_name, "dat_wil", 7) != 0;
|
||||
}
|
||||
|
||||
bool verify_user_pass(const char *password)
|
||||
{
|
||||
return memcmp(password, "admin", 5) != 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char password[64];
|
||||
bool valid;
|
||||
|
||||
memset(password, 0, sizeof(password));
|
||||
valid = false;
|
||||
puts("********* ADMIN LOGIN PROMPT *********");
|
||||
printf("Enter Username: ");
|
||||
fgets(a_user_name, 256, stdin);
|
||||
valid = verify_user_name();
|
||||
if (valid) {
|
||||
puts("nope, incorrect username...\n");
|
||||
} else {
|
||||
puts("Enter Password: ");
|
||||
fgets(password, 100, stdin);
|
||||
valid = verify_user_pass(password);
|
||||
puts("nope, incorrect password...\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
Reference in New Issue
Block a user