summaryrefslogtreecommitdiff
path: root/useradm.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-04-01 19:35:06 +0300
committerAndrew Dolgov <[email protected]>2018-04-01 19:35:06 +0300
commit76760cffe09083f31e51e81a3ec121c15b2126fc (patch)
tree1fd8e119412a216a9529b8850cf0442e68829bd6 /useradm.php
parent68e4d8ef48113efdb136ccf6eceb56c5786b097c (diff)
update password if adding but user exists
Diffstat (limited to 'useradm.php')
-rw-r--r--useradm.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/useradm.php b/useradm.php
index e9005a8..30a7a06 100644
--- a/useradm.php
+++ b/useradm.php
@@ -66,7 +66,11 @@
$sth->execute([$user]);
if ($line = $sth->fetch()) {
- print "User already exists.\n";
+ print "User already exists, updating password.\n";
+
+ $sth = $dbh->prepare("UPDATE epube_users SET pass = ? WHERE user = ?");
+ $sth->execute([$pass_hash, $user]);
+
} else {
$sth = $dbh->prepare("INSERT INTO epube_users (user, pass)
VALUES (?, ?)");