From 31435f55203c6f2e89a3dec1df432db96267f8fb Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Sat, 31 Dec 2022 12:51:07 -0600 Subject: [PATCH] - Update functions.php --- functions.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/functions.php b/functions.php index 7925f6c..41a74cb 100644 --- a/functions.php +++ b/functions.php @@ -1,4 +1,11 @@ $value) { $csv[$key] = str_getcsv($value); } -// Get user log entries. Change 'user1' and 'user2' below to Torn usernames. -$user1Txn = getLog('user1', $csv); -$user2Txn = getLog('user2', $csv); +// Get user log entries. +$user1Txn = getLog(USER1_NAME, $csv); +$user2Txn = getLog(USER2_NAME, $csv); // Merge user arrays into transaction array -$txnVault = array_merge($zarTxn, $symTxn); +$txnVault = array_merge($user1Txn, $user2Txn); // Build array of entries not already in the CSV foreach ($txnVault as $key => $value) { @@ -74,18 +81,16 @@ function formatMoney($number, $cents = 1) { } // getLog(): Get log entries for user. Returns array. -// Change 'user1' and 'user2' below to Torn usernames -// Change 'user1Key' and 'user2Key' below to Torn API keys function getLog($user, $csv) { $tornURL = 'https://api.torn.com/user/?selections=log&key='; $i = 0; - if ($user == 'user1') { - $usrKey = 'user1Key'; - $user = 'User1'; + if ($user == USER1_NAME) { + $usrKey = USER1_KEY; + $user = USER1_NAME; } else { - $usrKey = 'user2Key'; - $user = 'User2'; + $usrKey = USER2_KEY; + $user = USER2_NAME; } $usrURL = $tornURL . $usrKey;