From 1380628215a06ab7981776280943f99ae3512a8b Mon Sep 17 00:00:00 2001 From: LinuxMint4Ever <> Date: Fri, 3 Jan 2020 15:28:17 +0100 Subject: [PATCH] First try at database interaction --- admin.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/admin.php b/admin.php index 766fd9f..1dca0fe 100644 --- a/admin.php +++ b/admin.php @@ -1 +1,67 @@ - +Error: Not all values populated.

"; + } + if ($_POST['password'] != $_POST['password_confirmation']) { + $error = true; + $error_message = "

Error: Password confirmation does not match password.

"; + } + if (!$error) { + $statement = $pdo->prepare('INSERT INTO users (name, authentication_string, authentication_salt, authentication_algorithm) VALUES (:name, :authentication_string, :authentication_salt, :authentication_algorithm)'); + $result = $statement->execute(array('name' => $_POST['name'], 'authentication_string' => hash($password_hash_method, $_POST['password'] . $random_salt), 'authentication_salt' => $random_salt, 'authentication_algorithm' => $password_hash_method)); + if (!$result) { + $error_message = "

Error: SQL error.

" . $statement->queryString . "
" . $statement->errorInfo()[2] . "
"; + } + } + } + } +?> + + + + LostCave Admin Page + + + +

Users

+ + + query($query) as $row) { + echo ""; + } + ?> +
User IDNameAuthentication algorithm
".$row['id']."".$row['name']."".$row['authentication_algorithm']."
+

Add user

+
+ + + + + +
+ +