Here's the entire PHP file just for the sake of it:
See line 128 to 150 and 207
I've created a PHP code specially designed to check 2 variables:
Code:
require_once(DIR . '/includes/functions_steamconnect.php');
// Steam Level Information API
$steam_id = get_user_steamid($stc_userinfo);
$steam_info = fetch_steam_info($steam_id, $vbulletin->options['stc_apikey']);
var_dump($steam_info['player_level']);
var_dump($steam_info['tradeban']);
This is the result at the top of the page:
The first, showing my steam level, 36. Which is correct. The steam_level API always has worked.. so I copy/pasted the code to see if I can get it to work for tradeban API as well. However, the second tradeban var_dump shows NULL, thus no information was grabbed.
Using:
Code:
var_dump($steam_info['EconomyBan'])
Result in: int(-1)
[s]It 'might' be possible its giving NULL results as the results are being cached within files (for each user) that is defined in another PHP file:
[/s]
^- Striped above, I've edited this post as I've posted the var_dump results on a separated plugin calling the right information. Left the edit intact, just in case.
---EDIT:
Does this have something to do with it? Seeing -1 is mentioned here, as a matching value.
line 184 to 200 (first pastebin)
Code:
$values = $match[1];
foreach ($values AS $val) {
$match = array();
preg_match("/\"(.+)\": ([^,]*),?/", $val, $match);
if (is_array($match) && count($match) == 3) {
$name = $match[1];
$value = trim($match[2]);
if (!in_array($name, $whitelist)) continue; // Not a setting we're looking for. skip..
// Strip quotes and slashes
if ($value{0} == '"' && $value{strlen($value)-1} == '"')
$value = stripslashes(substr($value, 1, -1));
$steam_info[$name] = $value;
}
}
I'm unsure, still checking into the code why I'm not getting the 'banned' value back.
Really would like to know why.
----SOLVED IT-----
Wanted to share, got it to work with some help.
First, URL near the end had to be "steamids" rather than "steamid"
Second:
Code:
$steam_info['EconomyBan'] = is_array($tradeban) && isset($tradeban['players'], $tradeban['players']['EconomyBan']) ? $tradeban['players']['EconomyBan'] : -1;
Had to be:
Code:
$steam_info['EconomyBan'] = is_array($tradeban) && isset($tradeban['players'], $tradeban['players'][0]['EconomyBan']) ? $tradeban['players'][0]['EconomyBan'] : -1;
I appreciate the replies however!