- Update functions.php for generic user names/keys
- Update README
This commit is contained in:
@@ -14,18 +14,19 @@ Uses the [Torn API](https://www.torn.com/api.html) to pul the most recent vault
|
||||
|
||||
### Installing
|
||||
|
||||
* Create folder in your server's web root, for example, 'tvt'
|
||||
* Upload/clone this repo into your folder
|
||||
* Edit `functions.php` to add API keys for you and your spouse
|
||||
* Open the tracker in any web browser
|
||||
* Style as you see fit in style.css (Optional, but if you make something cool, let ms know!)
|
||||
* Create folder in your server's web root, for example, 'tvt'.
|
||||
* Upload/clone this repo into your folder.
|
||||
* Edit `functions.php` to add API keys and Torn user names for you and your spouse.
|
||||
* Open the tracker in any web browser.
|
||||
* Style as you see fit in style.css (Optional, but if you make something cool, let me know!).
|
||||
|
||||
### Automating the API requests (TK)
|
||||
### Automating transaction updates
|
||||
|
||||
I recommend using an external site monitoring service such as [cronitor.io](https://cronitor.io) set to check the URL of your server. A check rate of 15 minutes should be more than enough, since you can always force a refresh by simply opening the site in your browser.
|
||||
|
||||
## Authors
|
||||
|
||||
Keith Solomon
|
||||
[ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) on [Torn](https://torn.com/)
|
||||
Keith Solomon / [ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) on [Torn](https://torn.com/)
|
||||
|
||||
## Version History
|
||||
|
||||
|
||||
+10
-8
@@ -14,9 +14,9 @@ foreach ($lines as $key => $value) {
|
||||
$csv[$key] = str_getcsv($value);
|
||||
}
|
||||
|
||||
// Get user log entries
|
||||
$zarTxn = getLog('zarathos', $csv);
|
||||
$symTxn = getLog('symos', $csv);
|
||||
// Get user log entries. Change 'user1' and 'user2' below to Torn usernames.
|
||||
$user1Txn = getLog('user1', $csv);
|
||||
$user2Txn = getLog('user2', $csv);
|
||||
|
||||
// Merge user arrays into transaction array
|
||||
$txnVault = array_merge($zarTxn, $symTxn);
|
||||
@@ -74,16 +74,18 @@ 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 == 'zarathos') {
|
||||
$usrKey = 'LDtibInYMdgVnM9n';
|
||||
$user = 'Zarathos';
|
||||
if ($user == 'user1') {
|
||||
$usrKey = 'user1Key';
|
||||
$user = 'User1';
|
||||
} else {
|
||||
$usrKey = 'lne9TZLuqvFXtK3V';
|
||||
$user = 'Symos';
|
||||
$usrKey = 'user2Key';
|
||||
$user = 'User2';
|
||||
}
|
||||
|
||||
$usrURL = $tornURL . $usrKey;
|
||||
|
||||
Reference in New Issue
Block a user