daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. class Dbh {
  3. private $servername;
  4. private $username;
  5. private $password;
  6. private $dbname;
  7. private $charset;
  8.  
  9. public function connect() {
  10. $this->servername = 'localhost';
  11. $this->username = 'root';
  12. $this->password = 'exh05t9a';
  13. $this->dbname = 'hash';
  14. $this->charset = 'utf8';
  15.  
  16. try {
  17.     $dsn = "mysql:host=".$this->servername.";dbname=".$this->dbname.";charset=".$this->charset;
  18.     $pdo = new PDO($dsn, $this->username, $this->password);
  19.     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  20.     return $dpo;
  21. } catch (PDOExeption $e) {
  22.     echo "Connection failed: ".$e->getMessage();
  23. }
  24. }
  25. }
  26. ?>
  27.      
  28. <?php
  29.  
  30. class Password extends Dbh {
  31. public function getUserPassword() {
  32.     $stmt = $this->connect()->query("SELECT password FROM users");
  33.     while ( $row = $stmt->fetch() ) {
  34.         $password = $row['password'];
  35.         return $password;
  36.     }
  37. }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top