-
Notifications
You must be signed in to change notification settings - Fork 1
User.php
Strongbeard edited this page Nov 28, 2014
·
6 revisions
A User class that serves as a middle-man between the database and the front-end and other back-end scripts.
- fromDatabase
- withValues
- getEmail
- getIsAdmin
- getIsStudent
- getIsTA
- getIsTutor
- getUserId
- getUsername
- setEmail
- setIsAdmin
- setIsStudent
- setIsTA
- setIsTutor
- setPassword
- setUserId
- setUsername
- login
- logout
- store
- verify_password
Constructor that draws user information from the database using a unique column key and value.
USER::fromDatabase( string $email );
- $email = String. Must be a valid email address.
Constructor that builds a new user from the provided parameters. Does NOT add the user to the database.
- $username = Unique username, used to log the user into the system.
- $password = Password in plain-text. The constructor will encrypt it for storage.
- $email = User email address.
- $isStudent = Boolean. Optional. Specifies if user is a student or not. Used to determine what content to show the user.
- $isTA = Boolean. Optional. Specifies if user is a TA or not. Used to determine what content to show the user.
- $isTutor = Boolean. Optional. Specifies if user is a private Tutor or not. Used to determine what content to show the user.
- $isAdmin = Boolean. Optional. Specifies if user is a system admin or not. Allows the users to access tools to directly edit the site's data.
Creates a user session and adds the user object to the $_SESSION['user'] variable.
- $password = String. Plain-text password the user entered to verify their identity. Will be hashed and checked against the hashed password form the database.
Destroys the current user session.
Adds/Updates the user in the database. If new user to the database, gets a new userid from MYSQL's auto_increment and sets $uid with the value.
Password verification. Use Login instead.
- $password = String. Plain-text password the user entered to verify their identity. Will be hashed and checked against the hashed password form the database.