Browse Source

update password if adding but user exists

Andrew Dolgov 1 year ago
parent
commit
76760cffe0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      useradm.php

+ 5 - 1
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 (?, ?)");