Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isUserLoggedIn() {
- if(isset($_SESSION['USER']) && !empty($_SESSION['USER'])) {
- return true;
- } else {
- return false;
- }
- }
- function getUsername() {
- $stmt = $this->conn->prepare("SELECT username FROM accounts WHERE UID=?");
- $stmt->bind_param("d", $this->UID);
- $stmt->execute();
- $stmt->bind_result($username);
- while($stmt->fetch()) {
- $stmt->close();
- return $username;
- }
- $stmt->close();
- return false;
- }
- function getMembershipType() {
- $stmt = $this->conn->prepare("SELECT type FROM memberships WHERE UID=? AND end > NOW()");
- $stmt->bind_param("d", $this->UID);
- $stmt->execute();
- $stmt->bind_result($type);
- $num = 0;
- while($stmt->fetch()) {
- if($type > $num) {
- $num = $type;
- }
- }
- $stmt->close();
- return $num;
- }
- function getMembershipTypeWithUID($UID) {
- $stmt = $this->conn->prepare("SELECT type FROM memberships WHERE UID=? AND end > NOW()");
- $stmt->bind_param("d", $UID);
- $stmt->execute();
- $stmt->bind_result($type);
- $num = 0;
- while($stmt->fetch()) {
- if($type > $num) {
- $num = $type;
- }
- }
- $stmt->close();
- return $num;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement