Profile_Page.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. /**
  4. * User profile page.
  5. */
  6. class Profile_Page extends Page{
  7. public $name;
  8. public $mail;
  9. public $api_key;
  10. /**
  11. * Constructor.
  12. *
  13. * Retrieves the data and initializes the variables.
  14. *
  15. * @param SQLite3 $db Connection to the database.
  16. */
  17. public function __construct($db){
  18. global $path;
  19. global $root;
  20. global $UID;
  21. parent::__construct($db);
  22. $this->view = $path["view"] . "profile.php";
  23. $s = "
  24. SELECT
  25. name,
  26. mail,
  27. api_key
  28. FROM player
  29. WHERE uid = '$UID';
  30. ";
  31. $q = $this->db->query($s);
  32. if ($r = $q->fetchArray(SQLITE3_ASSOC)){
  33. $this->name = $r["name"];
  34. $this->mail = $r["mail"];
  35. $this->api_key = $r["api_key"];
  36. }
  37. $this->title = $this->name ." - SWDB";
  38. $this->description = $this->name . " user profile";
  39. $this->canonical = $root . "profile/";
  40. }
  41. }
  42. ?>