aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Database.class.php')
-rw-r--r--inc/poche/Database.class.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 0662581b..1d3ff0c2 100644
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -87,6 +87,17 @@ class Database {
87 return $user_config; 87 return $user_config;
88 } 88 }
89 89
90 public function userExists($username) {
91 $sql = "SELECT * FROM users WHERE username=?";
92 $query = $this->executeQuery($sql, array($username));
93 $login = $query->fetchAll();
94 if (isset($login[0])) {
95 return true;
96 } else {
97 return false;
98 }
99 }
100
90 public function login($username, $password) { 101 public function login($username, $password) {
91 $sql = "SELECT * FROM users WHERE username=? AND password=?"; 102 $sql = "SELECT * FROM users WHERE username=? AND password=?";
92 $query = $this->executeQuery($sql, array($username, $password)); 103 $query = $this->executeQuery($sql, array($username, $password));
@@ -108,8 +119,8 @@ class Database {
108 public function updatePassword($userId, $password) 119 public function updatePassword($userId, $password)
109 { 120 {
110 $sql_update = "UPDATE users SET password=? WHERE id=?"; 121 $sql_update = "UPDATE users SET password=? WHERE id=?";
111 $params_update = array($password, $id); 122 $params_update = array($password, $userId);
112 $this->updateUserConfig($userId, 'password', $password); 123 $query = $this->executeQuery($sql_update, $params_update);
113 } 124 }
114 125
115 public function updateUserConfig($userId, $key, $value) { 126 public function updateUserConfig($userId, $key, $value) {