Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. function isUserLoggedIn() {
  2. if(isset($_SESSION['USER']) && !empty($_SESSION['USER'])) {
  3. return true;
  4. } else {
  5. return false;
  6. }
  7. }
  8.  
  9. function getUsername() {
  10. $stmt = $this->conn->prepare("SELECT username FROM accounts WHERE UID=?");
  11. $stmt->bind_param("d", $this->UID);
  12. $stmt->execute();
  13. $stmt->bind_result($username);
  14. while($stmt->fetch()) {
  15. $stmt->close();
  16. return $username;
  17. }
  18. $stmt->close();
  19. return false;
  20. }
  21.  
  22. function getMembershipType() {
  23. $stmt = $this->conn->prepare("SELECT type FROM memberships WHERE UID=? AND end > NOW()");
  24. $stmt->bind_param("d", $this->UID);
  25. $stmt->execute();
  26. $stmt->bind_result($type);
  27. $num = 0;
  28. while($stmt->fetch()) {
  29. if($type > $num) {
  30. $num = $type;
  31. }
  32. }
  33. $stmt->close();
  34. return $num;
  35. }
  36.  
  37. function getMembershipTypeWithUID($UID) {
  38. $stmt = $this->conn->prepare("SELECT type FROM memberships WHERE UID=? AND end > NOW()");
  39. $stmt->bind_param("d", $UID);
  40. $stmt->execute();
  41. $stmt->bind_result($type);
  42. $num = 0;
  43. while($stmt->fetch()) {
  44. if($type > $num) {
  45. $num = $type;
  46. }
  47. }
  48. $stmt->close();
  49. return $num;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement