Player Info API

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

Re: Player Info API

Postby Kent Briggs » Sun Aug 18, 2013 9:15 am

KillerxKen wrote:I cant just have them submit their name and password to a login/form and just have it send back that info?


Sure. I thought you said up above that you wanted the username to be remembered.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3931
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Postby KillerxKen » Sun Aug 18, 2013 4:02 pm

how would that form look? Ive made several but they all come back as unknown account
KillerxKen
 
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Postby Kent Briggs » Sun Aug 18, 2013 5:01 pm

KillerxKen wrote:how would that form look? Ive made several but they all come back as unknown account


Show your code.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3931
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Postby KillerxKen » Sun Aug 18, 2013 10:59 pm

<html>
<body>
<?php

include "API.php"; // $url, $pw, and Poker_API() defined here

$player = $_POST["Player"];
$password = $_POST["Password"];
$params = "Command=AccountsGet&Password=$pw&Player=$player";
$api = Poker_API($url, $params, true);
if ($api["Result"] != "Ok") die($api["Error"]);
echo "Chip balance for $player is " . $api["Balance"] . "<br>";
echo "Email for $player is " . $api["Email"] . "<br>";

?>
</body>
</html>


<html>
<body>
<h3> Login</h3>
<form method="post" action=""http://mysite.com/myaccount.php"
<table>
<tr>
<td>Player Name:</td>
<td><input type="text" name="LoginName"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="LoginPassword"></td>
</tr>
<tr>
<th colspan="2"><input type="submit" value="submit"></th>
</tr>
</table>
</form>
</body>
</html>
KillerxKen
 
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Postby KillerxKen » Sun Aug 18, 2013 11:05 pm

I know ive got it all wrong, I just want them to be able to input name and password and see their balances ect
KillerxKen
 
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Postby Kent Briggs » Sun Aug 18, 2013 11:14 pm

KillerxKen wrote:$player = $_POST["Player"];


Here's your problem: you are looking for a parameter named "Player" yet down in your form you called it "LoginName":

<input type="text" name="LoginName">


Those need to match. Also, be sure to verify that password using the AccountsPassword call before displaying any private info. Otherwise anyone could type in any name if that form is on a public page.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3931
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Postby KillerxKen » Mon Aug 19, 2013 12:15 am

Thank you sir, in regard to password call, is that not this $params = "Command=AccountsGet&Password=$pw&Player=$player";
KillerxKen
 
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Postby Kent Briggs » Mon Aug 19, 2013 12:19 am

KillerxKen wrote:Thank you sir, in regard to password call, is that not this $params = "Command=AccountsGet&Password=$pw&Player=$player";


No, that is your API password ($pw) that is sent with every API call.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3931
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Postby KillerxKen » Mon Aug 19, 2013 1:47 am

Im sorry Mr Briggs im clearly doing something fundamentally wrong, as Im a novice at best. Would you be so kind as to show a complete login form(usrname+password feilds) that will simply return the results (username,balance, ect) {on the same page if its easier}? As you said I want to have them verify user and pass first. Sorry for all this mess, after we get this figged Ill post the correct one so others can just copy it and have a basic my account page.
KillerxKen
 
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Postby Kent Briggs » Mon Aug 19, 2013 9:18 am

KillerxKen wrote:Im sorry Mr Briggs im clearly doing something fundamentally wrong, as Im a novice at best. Would you be so kind as to show a complete login form(usrname+password feilds) that will simply return the results (username,balance, ect) {on the same page if its easier}?


Check out the very last example (SessionKey3.php) in the Automated Logins section on the API Examples page:

http://www.briggsoft.com/docs/pmavens/API_Examples.htm

It shows a form that prompts for the player name and password and then verifies that before moving on. Just replace the last part about generating a session key with the chip balance code you already have.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3931
Joined: Wed Mar 19, 2008 8:47 pm

PreviousNext

Return to Site Administration

Who is online

Users browsing this forum: No registered users and 10 guests

cron