From 1a80e5b7165fd0e3ae50ba2f2a82f9f196ca5141 Mon Sep 17 00:00:00 2001 From: o-psi Date: Sun, 17 Mar 2024 00:37:35 +0000 Subject: [PATCH] Functionify the post handler This draft PR shows the work to attempt to make all actions in post.php occur via functions. This enables easier management of a CRUD API --- functions/api_functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/api_functions.php b/functions/api_functions.php index 4f274a718..95a4ccaa1 100644 --- a/functions/api_functions.php +++ b/functions/api_functions.php @@ -6,12 +6,12 @@ function createAPIKey($secret, $name, $expire, $client) { global $mysqli, $session_name, $session_ip, $session_user_agent, $session_user_id; mysqli_query($mysqli,"INSERT INTO api_keys SET api_key_name = '$name', api_key_secret = '$secret', api_key_expire = '$expire', api_key_client_id = $client"); - $api_key = mysqli_insert_id($mysqli); + $api_key_id = mysqli_insert_id($mysqli); // Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'API', log_action = 'Create', log_description = '$session_name created API Key $name set to expire on $expire', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client, log_user_id = $session_user_id, log_entity_id = $api_key_id"); - return $api_key; + return $api_key_id; } function deleteAPIKey($api_key_id) {