Player Info API

For discussion of the Poker Mavens server module and other administration topics
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Post by Kent Briggs »

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.
KillerxKen
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Post by KillerxKen »

how would that form look? Ive made several but they all come back as unknown account
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Post by Kent Briggs »

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

Re: Player Info API

Post by KillerxKen »

<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

Post by KillerxKen »

I know ive got it all wrong, I just want them to be able to input name and password and see their balances ect
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Post by Kent Briggs »

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.
KillerxKen
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Post by KillerxKen »

Thank you sir, in regard to password call, is that not this $params = "Command=AccountsGet&Password=$pw&Player=$player";
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Post by Kent Briggs »

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.
KillerxKen
Posts: 27
Joined: Mon Aug 12, 2013 7:18 pm

Re: Player Info API

Post by KillerxKen »

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.
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Player Info API

Post by Kent Briggs »

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.
Post Reply