- 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
|
### Installing
|
||||||
|
|
||||||
* Create folder in your server's web root, for example, 'tvt'
|
* Create folder in your server's web root, for example, 'tvt'.
|
||||||
* Upload/clone this repo into your folder
|
* Upload/clone this repo into your folder.
|
||||||
* Edit `functions.php` to add API keys for you and your spouse
|
* Edit `functions.php` to add API keys and Torn user names for you and your spouse.
|
||||||
* Open the tracker in any web browser
|
* 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!)
|
* 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
|
## Authors
|
||||||
|
|
||||||
Keith Solomon
|
Keith Solomon / [ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) on [Torn](https://torn.com/)
|
||||||
[ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) on [Torn](https://torn.com/)
|
|
||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
|||||||
+10
-8
@@ -14,9 +14,9 @@ foreach ($lines as $key => $value) {
|
|||||||
$csv[$key] = str_getcsv($value);
|
$csv[$key] = str_getcsv($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user log entries
|
// Get user log entries. Change 'user1' and 'user2' below to Torn usernames.
|
||||||
$zarTxn = getLog('zarathos', $csv);
|
$user1Txn = getLog('user1', $csv);
|
||||||
$symTxn = getLog('symos', $csv);
|
$user2Txn = getLog('user2', $csv);
|
||||||
|
|
||||||
// Merge user arrays into transaction array
|
// Merge user arrays into transaction array
|
||||||
$txnVault = array_merge($zarTxn, $symTxn);
|
$txnVault = array_merge($zarTxn, $symTxn);
|
||||||
@@ -74,16 +74,18 @@ function formatMoney($number, $cents = 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getLog(): Get log entries for user. Returns array.
|
// 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) {
|
function getLog($user, $csv) {
|
||||||
$tornURL = 'https://api.torn.com/user/?selections=log&key=';
|
$tornURL = 'https://api.torn.com/user/?selections=log&key=';
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($user == 'zarathos') {
|
if ($user == 'user1') {
|
||||||
$usrKey = 'LDtibInYMdgVnM9n';
|
$usrKey = 'user1Key';
|
||||||
$user = 'Zarathos';
|
$user = 'User1';
|
||||||
} else {
|
} else {
|
||||||
$usrKey = 'lne9TZLuqvFXtK3V';
|
$usrKey = 'user2Key';
|
||||||
$user = 'Symos';
|
$user = 'User2';
|
||||||
}
|
}
|
||||||
|
|
||||||
$usrURL = $tornURL . $usrKey;
|
$usrURL = $tornURL . $usrKey;
|
||||||
|
|||||||
Reference in New Issue
Block a user