Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- int main(){
- char username[25];
- char passwd[45];
- printf("Input your name ->");
- fgets(username, 25, stdin);
- printf("Input your password->");
- fgets(passwd, 45, stdin);
- char query[128]="select username, password from accounts where username='";
- char and[18]="' and password='";
- strncat(query, username, 25);
- strncat(query, and, 16);
- strncat(query, passwd, 45);
- strncat(query, "';n", 4);
- printf("%s", query);
- return 0;
- //OBS: Código de exemplo
- }
- gcc main.c
- ./a.out
- Input your name ->linus
- Input your password->123
- select username, password from accounts where username='linus
- ' and password='123
- ';
Add Comment
Please, Sign In to add comment