Guest User

Untitled

a guest
Feb 28th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <string.h>
  2. #include <stdio.h>
  3.  
  4. int main(){
  5.  
  6. char username[25];
  7. char passwd[45];
  8.  
  9. printf("Input your name ->");
  10. fgets(username, 25, stdin);
  11.  
  12. printf("Input your password->");
  13. fgets(passwd, 45, stdin);
  14.  
  15. char query[128]="select username, password from accounts where username='";
  16. char and[18]="' and password='";
  17.  
  18. strncat(query, username, 25);
  19. strncat(query, and, 16);
  20. strncat(query, passwd, 45);
  21. strncat(query, "';n", 4);
  22.  
  23. printf("%s", query);
  24.  
  25. return 0;
  26.  
  27. //OBS: Código de exemplo
  28. }
  29.  
  30. gcc main.c
  31. ./a.out
  32. Input your name ->linus
  33. Input your password->123
  34. select username, password from accounts where username='linus
  35. ' and password='123
  36. ';
Add Comment
Please, Sign In to add comment