Skip to content

Commit

Permalink
Functionify the post handler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
o-psi committed Mar 17, 2024
1 parent a599362 commit 1a80e5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/api_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1a80e5b

Please sign in to comment.