Page 2 of 3

Re: Player Info API

Posted: Sun Aug 18, 2013 9:15 am
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.

Re: Player Info API

Posted: Sun Aug 18, 2013 4:02 pm
by KillerxKen
how would that form look? Ive made several but they all come back as unknown account

Re: Player Info API

Posted: Sun Aug 18, 2013 5:01 pm
by Kent Briggs
KillerxKen wrote:how would that form look? Ive made several but they all come back as unknown account
Show your code.

Re: Player Info API

Posted: Sun Aug 18, 2013 10:59 pm
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>

Re: Player Info API

Posted: Sun Aug 18, 2013 11:05 pm
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

Re: Player Info API

Posted: Sun Aug 18, 2013 11:14 pm
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.

Re: Player Info API

Posted: Mon Aug 19, 2013 12:15 am
by KillerxKen
Thank you sir, in regard to password call, is that not this $params = "Command=AccountsGet&Password=$pw&Player=$player";

Re: Player Info API

Posted: Mon Aug 19, 2013 12:19 am
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.

Re: Player Info API

Posted: Mon Aug 19, 2013 1:47 am
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.

Re: Player Info API

Posted: Mon Aug 19, 2013 9:18 am
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.