Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSTALLATION INSTRUCTIONS
- 1) Put all *.php files on your server.
- 2) Configure everything you wish on config.php.
- 3) Run the query users.sql on the database you chose in config.php.
- 4) Done! You may now test it to see if it works. If it doesn't, contact Mr.Helium via PM.
- You are free to use this as you wish, even claim it as your own.
- CLASS STRUCTURE
- User Class:
- Variables:
- $name
- $email
- Functions:
- setData($row)
- Used to set all the variables in this class based on the$row array
- given by the function isLoggedIn().
- login($username,$password)
- Logins a the username $username with the password $password and sets
- his session variables.
- Return Values:
- 0 - User logged in successfully
- 1 - Password mismatch
- 2 - Account is not active
- isLoggedIn()
- Checks if a user is logged in by his session variables.
- Return Values:
- 0 - User is logged in
- 1 - Account is not activated
- 2 - User is not logged in
- register()
- Registers an username $username, with the password $password and the
- 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.
- Return values:
- 0 - Register done
- 1 - A field is blank
- 2 - Username already exists
- 3 - Password doesn't match repeat
- logout()
- Logouts an user by using the session variables
- Return values:
- true - Session destroyed
- false - There is no session
- activate()
- Activates an account using the code $code.
- Return values:
- 0 - Account is activated
- 1 - That code doesn't exist
- MySQL class:
- Variables:
- $con
- Functions:
- __construct($host,$username,$password)
- Connects PHP with MySQL on the host $host with the username $username and the password $password. Defaults are $host="localhost", $username="root", $password="".
- chooseDB($db)
- Selects the database $db, returns true if fine, false if not.
- query($query)
- Does the query $query. You must have chosen a db before doing this.
- __destruct()
- No need to clean up, this will end your MySQL connection cleanly.
- Have fun
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement