API reset balances on monthly basis

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

API reset balances on monthly basis

Postby Mr.Victor » Thu Dec 31, 2009 12:37 pm

I've been looking into the API stuff and with my basic knowledge of php (much better with html and css) I was able to get a leaderboard displayed on my website so that's some progress :D . Now my next project is to get account balances reset to 10k every month. With my league we will be having a monthly challenge. The top 3 bankrolls at the end of each month will win prizes. One of my concerns is that I need to make sure I have a record of all balances right before they are reset. Also, I'm not sure what would happen if there are players in a ring game or in a SnG during the reset process. Can anyone help me get this done? It seems simple but still slightly beyond my capabilities.
Mr.Victor
 
Posts: 88
Joined: Tue Dec 22, 2009 8:27 am

Re: API reset balances on monthly basis

Postby Kent Briggs » Thu Dec 31, 2009 1:22 pm

Mr.Victor wrote:I've been looking into the API stuff and with my basic knowledge of php (much better with html and css) I was able to get a leaderboard displayed on my website so that's some progress :D . Now my next project is to get account balances reset to 10k every month. With my league we will be having a monthly challenge. The top 3 bankrolls at the end of each month will win prizes. One of my concerns is that I need to make sure I have a record of all balances right before they are reset. Also, I'm not sure what would happen if there are players in a ring game or in a SnG during the reset process. Can anyone help me get this done? It seems simple but still slightly beyond my capabilities.


By the way, you can reset all balances manually in one fell swoop without writing any code. From the Accounts tab, click in the list, Ctrl-A to select all, click Chips button, then Set Balance. I'd suggest doing this with the server offline or at least with no one logged in, however. As you mentioned if someone is at a ring table, they have other chips that are on the table and will get added back to their accounts when they leave. Same is true of a tournament player that makes it into the money. To backup the account balances with code, you would need to loop through the accounts and then store that somewhere such as a database.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3832
Joined: Wed Mar 19, 2008 8:47 pm

Re: API reset balances on monthly basis

Postby Mr.Victor » Thu Dec 31, 2009 1:58 pm

Kent,

Thanks for the quick reply. I was initially planning on doing it manually as I have seen this function in the accounts tab but I'm not sure I'm going to be around at midnight on the first of every month and I want to make sure I have the proper balances recorded and that the reset is done right when it should be done to be fair to all the players. I have linux hosting with php and mysql for my website so that is available to me.
Mr.Victor
 
Posts: 88
Joined: Tue Dec 22, 2009 8:27 am

Re: API reset balances on monthly basis

Postby Kent Briggs » Thu Dec 31, 2009 3:01 pm

Mr.Victor wrote:I have linux hosting with php and mysql for my website so that is available to me.


The general procedure would be to write a PHP script that calls AccountsList to get a list of all player accounts. Then loop through that list calling AccountsGet for each player to get their current balance and store that in your mysql database, then call AccountsEdit to reset the balance. You can go into your web account's cPanel and select Cron Jobs and set it to run that script on the 1st day of every month at 12:00 AM (or whenever). As your script finishes, it would be a probably be good idea if it emailed a message to you letting your know that it ran, how many accounts were reset, if any errors where encountered, etc.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3832
Joined: Wed Mar 19, 2008 8:47 pm

Re: API reset balances on monthly basis

Postby Mr.Victor » Thu Dec 31, 2009 4:07 pm

Ok I'm going to try and make it happen. I just set up putty and contacted my hosting provider and they will have cron jobs enabled for me within 24-48 hours. I'm going to try and get help from a friend that is more proficient in php but I may post some of my code to see if I'm on the right track.
Mr.Victor
 
Posts: 88
Joined: Tue Dec 22, 2009 8:27 am


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 6 guests