Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. include_once ('../Database/DBConnection.php');
  2.  
  3. class DBConnection {
  4. //put your code here
  5. private $host;
  6. private $user;
  7. private $pass;
  8. private $database;
  9. private $conn;
  10.  
  11. function DBConnection() {
  12. $this->host = 'localhost';
  13. $this->user = 'root';
  14. $this->pass = '';
  15. $this->database = 'woodlands_away';
  16. }
  17.  
  18. public function getConnections() {
  19. $this->conn = new mysqli($this->host, $this->user, $this->pass, $this->database) or
  20. die($this->conn->error);
  21.  
  22. return $this->conn;
  23. }
  24.  
  25. include_once ('../Database/DBConnection.php');
  26.  
  27. class Admin extends DBConnection {
  28. public function Admin() {
  29. parent::DBConnection();
  30. }
  31.  
  32. public function signup($username, $password) {
  33. $sql = "insert into users values(".$username.", ".$password.")";
  34.  
  35. return $this->getConnections()->query($sql);
  36. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement