Guest User

Untitled

a guest
Jul 8th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2. {
  3. if(response)
  4. {
  5. switch(dialogid)
  6. {
  7. case 1:
  8. {
  9. if(strlen(inputtext) > 0)
  10. {
  11. new name[60], query[256];
  12. GetPlayerName(playerid, name, sizeof(name));
  13. format(query, sizeof(query), "INSERT INTO `users` (username,password) VALUES('%s', md5('%s'))", name, inputtext);
  14. mysql_query(query);
  15. }
  16. else
  17. {
  18. SendClientMessage(playerid, -1, "You did not typed anything on the input!");
  19. }
  20. }
  21. case 2:
  22. {
  23. if(response)
  24. {
  25. if(strlen(inputtext) > 0)
  26. {
  27. new name[60], query[256], password[126];
  28. GetPlayerName(playerid, name, sizeof(name));
  29. format(query, sizeof(query), "SELECT password FROM `users` WHERE username = %s AND password = md5('%s')", name, password);
  30. mysql_query(query);
  31. mysql_store_result(1);
  32. if(mysql_num_rows() == 0)
  33. {
  34. SendClientMessage(playerid, -1, "The password is wrong!");
  35. Kick(playerid);
  36. }
  37. else
  38. {
  39. SendClientMessage(playerid, -1, "You have suceffully logged in!!!");
  40. }
  41. mysql_free_result(1);
  42. }
  43. else
  44. {
  45. SendClientMessage(playerid, -1, "You did not typed anything on the input!");
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return 1;
  52. }
Add Comment
Please, Sign In to add comment