すくすくゴートうちゃん 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.

user.mod.hsp 923 B

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. Fetch@Http CREATE_URL + "?name=" + p_name
  13. If status@Http = STATUS_SUCCESS@Http {
  14. Split data@Http, ",", create_data
  15. id = Int (create_data.0)
  16. pass = create_data.1
  17. inheritanceCode = create_data.2
  18. }
  19. Else {
  20. id = 0
  21. pass = ""
  22. inheritanceCode = ""
  23. }
  24. Save@Setting
  25. Return
  26. #deffunc local \
  27. Auth \
  28. int p_id,\
  29. local l_data
  30. Load@Setting
  31. If id <= 0 {
  32. Return
  33. }
  34. Fetch@Http AUTH_URL + "?id=" + id + "&pass=" + pass
  35. If status@Http = STATUS_SUCCESS@Http {
  36. Split data@Http, ",", l_data
  37. If Int (l_data.0) = 0 {
  38. id = 0
  39. Return
  40. }
  41. name = l_data.1
  42. }
  43. Else {
  44. id = 0
  45. }
  46. Return
  47. #global
  48. #endif ; not __USER__