ericek111

Frames users docs #1

Aug 8th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. users.php:
  2. Actions:
  3. register:
  4. Description: Registers new user.
  5. method: POST,
  6. Input (array):
  7. username: [username]
  8. email: [email]
  9. password: [non-hashed password]
  10. data [json string of userdata]
  11. Output (integer/string):
  12. 0: Arguments (username | email | password | data) missing.
  13. 1: Username or email already exists!
  14. 2: Invalid e-mail!
  15. 3: Invalid username!
  16. 4: User successfully created!
  17. 5: No rows changed - MySQL query failed.
  18. Other: mostly error.
  19. Functions:
  20. validate_username()
  21. Description: Validates username.
  22. Input (string):
  23. $username = Username, which are going to be validated.
  24. Output (string):
  25. "invalid username": Username is not valid!
  26. Other: Validated username.
  27. validate_email()
  28. Description: Validated e-mail.
  29. Input:
  30. $email - E-mail, which are going to be validated.
  31. Output (string):
  32. validated e-mail
  33. check_userid_value()
  34. Description: Checks, if is input value e-mail, user ID or username.
  35. Input (string):
  36. $id = E-mail/password/user ID.
  37. Output (string):
  38. "email": Input value is e-mail.
  39. "username": Input valuse is username.
  40. "id": Input valuse is user ID.
  41. user_exists()
  42. Description: Checks, if user exists.
  43. Input (string):
  44. $username / $email / $id = Checks, if user exists using output from check_userid_value().
  45. Output (boolean):
  46. true: User exists.
  47. false: User doesn't exists.
  48. get_user()
  49. Description: Outputs MySQL row from users table with user info.
  50. Input (string / integer):
  51. $username / $email / $id = Username / email / user ID - check_userid_value().
  52. Output (MySQL result):
  53. $result: Result of MySQL query (SELECT * FROM users WHERE check_userid_value($input)=$input)
  54. get_users()
  55. Description: Returns all users in users table.
  56. Output (MySQL result):
  57. $result = Result of MySQL query (SELECT * FROM users)
  58. getrank()
  59. Description: Converts numeric level of user rank to string and vice versa.
  60. Output (string / integer) or input:
  61. 0: Visitor
  62. 1: Waiting
  63. 2: Registered
  64. 3: Moderator
  65. 4: Editor
  66. 5: Redactor
  67. 6: Master
  68. 7: Administrator
  69. 8: Owner
  70. get_userdata()
  71. Description: Outputs user data from column "data" in user's row in MySQL users table.
  72. Input:
  73. $username / $email / $id = Username / email / user ID - check_userid_value().
  74. Output (JSON):
  75. $userdata = JSON string:
  76. {
  77. "firstname": [first name],
  78. "lastname": [last name],
  79. "city": [city]
  80. }
  81. Example: {"firstname":"Erik","lastname":"Bro\u010dko","city":"Trnava"}
  82. check_userid_value()
  83. Description:
  84. Input:
  85. Output:
Advertisement
Add Comment
Please, Sign In to add comment