Displaying Balance??

For discussion of the Poker Mavens server module and other administration topics

Displaying Balance??

Postby lildamien09 » Sat Oct 03, 2009 11:48 pm

Okay i have been playing around with the api in which ever way i can figure out and im clue less.. im trying to display in my bank section on my site the balance of the current user logged in.. I have there bank balanca and the other is balance in game.. the balance in game which would be called via api.. how would i call this balance via api by itself.. any suggestions??
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX

Re: Displaying Balance??

Postby Kent Briggs » Sat Oct 03, 2009 11:53 pm

lildamien09 wrote:Okay i have been playing around with the api in which ever way i can figure out and im clue less.. im trying to display in my bank section on my site the balance of the current user logged in.. I have there bank balanca and the other is balance in game.. the balance in game which would be called via api.. how would i call this balance via api by itself.. any suggestions??


Call AccountsGet with "Player" set the player's name and look at "Balance" in the result. There's also a "RingChips" parameter returned if you want to see how many chips above that balance that they currently have in play.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3763
Joined: Wed Mar 19, 2008 8:47 pm

Re: Displaying Balance??

Postby lildamien09 » Sun Oct 04, 2009 12:04 am

well i know i can do that.. but i only want to display the balance by itself and not for me..its for the player who is logged into the bank on my site..so they can see there own balance and decide how much money they want to deposit into there savings account. (i.e call the balance via api.. and echo it with my php function to show it in there bank account info..)
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX

Re: Displaying Balance??

Postby lildamien09 » Sun Oct 04, 2009 12:08 am

ill create a test account with the username test and the password testing so you can login and click bank link and see more or less what im trying to do..its pretty self explanitory when you look at the main bank page..
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX

Re: Displaying Balance??

Postby lildamien09 » Sun Oct 04, 2009 12:20 am

i tried using the account get command to retrieve the balance of xuser and using php function bbalance=balance and echoing balance to page but i guess im doing something wrong as far as calling the balance using api commands.. if im able to call the balance alone using api in a php page, could you give me an example code of this action..
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX

Re: Displaying Balance??

Postby Kent Briggs » Sun Oct 04, 2009 12:30 am

lildamien09 wrote:well i know i can do that.. but i only want to display the balance by itself and not for me..its for the player who is logged into the bank on my site..so they can see there own balance and decide how much money they want to deposit into there savings account. (i.e call the balance via api.. and echo it with my php function to show it in there bank account info..)


It's up to your code to just pull the balance out of the result and display it to you user. You normally wouldn't just echo the entire thing. And if this is outside of the game on your own web site, it's up to you to verify who the player is. Inside the game, they can just click the Account Balance button on the Login page of the Lobby (or on the Account menu).
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3763
Joined: Wed Mar 19, 2008 8:47 pm

Re: Displaying Balance??

Postby lildamien09 » Sun Oct 04, 2009 12:35 am

well im not trying to echo the whole thing.. just the balance..yes its on my website..i would set $logged=Player in player and have it put the logged player name value for the api &player=$logged, but how would i call just the balance in my website. could you post an example api code possibly that i could work with and figure this out
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX

Re: Displaying Balance??

Postby Kent Briggs » Sun Oct 04, 2009 12:37 am

lildamien09 wrote:i tried using the account get command to retrieve the balance of xuser and using php function bbalance=balance and echoing balance to page but i guess im doing something wrong as far as calling the balance using api commands.. if im able to call the balance alone using api in a php page, could you give me an example code of this action..


Something like this (untested):

Code: Select all
include "API.php";
$player = "test";
$params = "Password=" . $pw . "&Command=AccountsGet&Player=" . $player;
$api = Poker_API($url,$params,true);
$result = $api["Result"];
if ($result == "Error") die("Error: " . $api["Error"]);
$balance = $api["Balance"];
echo "Current balance for " . $player . " is " . $balance;
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3763
Joined: Wed Mar 19, 2008 8:47 pm

Re: Displaying Balance??

Postby lildamien09 » Sun Oct 04, 2009 12:48 am

okay i will work with that and let you know the outcome of it.. thanks for the sample..
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX

Re: Displaying Balance??

Postby lildamien09 » Sun Oct 04, 2009 12:56 am

works perfect..modified it as followed
Code: Select all
$check = mysql_query("SELECT * FROM xbankx WHERE xusername = '$username'")or die(mysql_error());

include "API.php";
$player = "$username";
$params = "Password=" . $pw . "&Command=AccountsGet&Player=" . $player;
$api = Poker_API($url,$params,true);
$result = $api["Result"];
if ($result == "Error") die("Error: " . $api["Error"]);
$balance = $api["Balance"];

then echo'd it into my site for the ingame balance as follows
Code: Select all
<?php echo $balance; ?>


thanks for all the help at such a late hour bud.. heh, this is my peak time to work on my site without affecting users lol..
lildamien09
 
Posts: 71
Joined: Sun Sep 13, 2009 7:08 pm
Location: TX


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 4 guests

cron