diff options
author | Andrew Dolgov <[email protected]> | 2018-04-01 19:35:06 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-04-01 19:35:06 +0300 |
commit | 76760cffe09083f31e51e81a3ec121c15b2126fc (patch) | |
tree | 1fd8e119412a216a9529b8850cf0442e68829bd6 | |
parent | 68e4d8ef48113efdb136ccf6eceb56c5786b097c (diff) |
update password if adding but user exists
-rw-r--r-- | useradm.php | 6 |
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 (?, ?)"); |