すくすくゴートうちゃん Android 版(黒歴史)
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.

73 lines
971 B

  1. #include "./modules/http.mod.hsp"
  2. #include "./modules/setting.mod.hsp"
  3. #ifndef __USER__
  4. #define __USER__
  5. #module \
  6. User
  7. #define CREATE_URL (CONFIG_SERVER_URL + "/create_user.php")
  8. #define AUTH_URL (CONFIG_SERVER_URL + "/auth_user.php")
  9. #deffunc local \
  10. Create \
  11. str p_name,\
  12. local l_data
  13. Fetch@Http CREATE_URL + "?name=" + p_name
  14. If status@Http = STATUS_SUCCESS@Http {
  15. Split data@Http, ",", l_data
  16. id = Int (l_data.0)
  17. pass = l_data.1
  18. inheritanceCode = l_data.2
  19. }
  20. Else {
  21. id = 0
  22. pass = ""
  23. inheritanceCode = ""
  24. }
  25. Save@Setting
  26. Return
  27. #deffunc local \
  28. Auth \
  29. int p_id,\
  30. local l_data
  31. Load@Setting
  32. id = userId@Setting
  33. pass = userPasscode@Setting
  34. If id <= 0 {
  35. Return
  36. }
  37. Fetch@Http AUTH_URL + "?id=" + id + "&pass=" + pass
  38. If status@Http = STATUS_SUCCESS@Http {
  39. Split data@Http, ",", l_data
  40. If Int (l_data.0) = 0 {
  41. id = 0
  42. Return
  43. }
  44. name = l_data.1
  45. }
  46. Else {
  47. id = 0
  48. }
  49. Return
  50. #global
  51. #endif ; not __USER__