diff options
author | Thomas Citharel <tcit@tcit.fr> | 2015-03-01 21:56:01 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2015-03-01 21:56:01 +0100 |
commit | 5395d7f8f59ffa54996f908c48925fcc635cc92a (patch) | |
tree | 5c123f0f0ef2044f8c232108e27b9717e0556310 /install | |
parent | 6269df8df94c812ae95cc84fb5644415693a9f65 (diff) | |
download | wallabag-5395d7f8f59ffa54996f908c48925fcc635cc92a.tar.gz wallabag-5395d7f8f59ffa54996f908c48925fcc635cc92a.tar.zst wallabag-5395d7f8f59ffa54996f908c48925fcc635cc92a.zip |
fix eventual bugs when user exists in database and connection doesn't work
Diffstat (limited to 'install')
-rwxr-xr-x | install/index.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/install/index.php b/install/index.php index d514eb2a..24577aaa 100755 --- a/install/index.php +++ b/install/index.php | |||
@@ -127,6 +127,13 @@ else if (isset($_POST['install'])) { | |||
127 | } | 127 | } |
128 | // create database structure | 128 | // create database structure |
129 | $query = $handle->exec($sql_structure); | 129 | $query = $handle->exec($sql_structure); |
130 | |||
131 | $usertest = executeQuery($handle,"SELECT * from users WHERE username = ?", array($username)); | ||
132 | if (!empty($usertest)) { | ||
133 | $continue = false; | ||
134 | $errors[] = "An user already exists with this username in database."; | ||
135 | } | ||
136 | |||
130 | } catch (PDOException $e) { | 137 | } catch (PDOException $e) { |
131 | $errors[] = $e->getMessage(); | 138 | $errors[] = $e->getMessage(); |
132 | $continue = false; | 139 | $continue = false; |
@@ -134,13 +141,6 @@ else if (isset($_POST['install'])) { | |||
134 | } | 141 | } |
135 | } | 142 | } |
136 | 143 | ||
137 | $usertest = executeQuery($handle,"SELECT * from users WHERE username = ?", array($username)); | ||
138 | if (!empty($usertest)) { | ||
139 | $continue = false; | ||
140 | $errors[] = "An user already exists with this username in database."; | ||
141 | } | ||
142 | |||
143 | |||
144 | if ($continue) { | 144 | if ($continue) { |
145 | $sql = "INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, ?)"; | 145 | $sql = "INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, ?)"; |
146 | $params = array($username, $salted_password, $username, $email); | 146 | $params = array($username, $salted_password, $username, $email); |