Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. INSTALLATION INSTRUCTIONS
  2.  
  3. 1) Put all *.php files on your server.
  4.  
  5. 2) Configure everything you wish on config.php.
  6.  
  7. 3) Run the query users.sql on the database you chose in config.php.
  8.  
  9. 4) Done! You may now test it to see if it works. If it doesn't, contact Mr.Helium via PM.
  10.  
  11. You are free to use this as you wish, even claim it as your own.
  12.  
  13. CLASS STRUCTURE
  14.  
  15. User Class:
  16. Variables:
  17. $name
  18. $email
  19. Functions:
  20. setData($row)
  21. Used to set all the variables in this class based on the$row array
  22. given by the function isLoggedIn().
  23. login($username,$password)
  24. Logins a the username $username with the password $password and sets
  25. his session variables.
  26. Return Values:
  27. 0 - User logged in successfully
  28. 1 - Password mismatch
  29. 2 - Account is not active
  30. isLoggedIn()
  31. Checks if a user is logged in by his session variables.
  32. Return Values:
  33. 0 - User is logged in
  34. 1 - Account is not activated
  35. 2 - User is not logged in
  36. register()
  37. Registers an username $username, with the password $password and the
  38. e-mail $email. If no $email is given, $email is set to "none". Generates an activation code and sends it to the email $email by using the mail() function if activation is set to true.
  39. Return values:
  40. 0 - Register done
  41. 1 - A field is blank
  42. 2 - Username already exists
  43. 3 - Password doesn't match repeat
  44. logout()
  45. Logouts an user by using the session variables
  46. Return values:
  47. true - Session destroyed
  48. false - There is no session
  49. activate()
  50. Activates an account using the code $code.
  51. Return values:
  52. 0 - Account is activated
  53. 1 - That code doesn't exist
  54.  
  55. MySQL class:
  56. Variables:
  57. $con
  58. Functions:
  59. __construct($host,$username,$password)
  60. Connects PHP with MySQL on the host $host with the username $username and the password $password. Defaults are $host="localhost", $username="root", $password="".
  61. chooseDB($db)
  62. Selects the database $db, returns true if fine, false if not.
  63. query($query)
  64. Does the query $query. You must have chosen a db before doing this.
  65. __destruct()
  66. No need to clean up, this will end your MySQL connection cleanly.
  67.  
  68. Have fun
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement