Sure. I thought you said up above that you wanted the username to be remembered.KillerxKen wrote:I cant just have them submit their name and password to a login/form and just have it send back that info?
Player Info API
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Player Info API
-
- Posts: 27
- Joined: Mon Aug 12, 2013 7:18 pm
Re: Player Info API
how would that form look? Ive made several but they all come back as unknown account
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Player Info API
Show your code.KillerxKen wrote:how would that form look? Ive made several but they all come back as unknown account
-
- Posts: 27
- Joined: Mon Aug 12, 2013 7:18 pm
Re: Player Info API
<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>
<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>
-
- Posts: 27
- Joined: Mon Aug 12, 2013 7:18 pm
Re: Player Info API
I know ive got it all wrong, I just want them to be able to input name and password and see their balances ect
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Player Info API
Here's your problem: you are looking for a parameter named "Player" yet down in your form you called it "LoginName":KillerxKen wrote:$player = $_POST["Player"];
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.<input type="text" name="LoginName">
-
- Posts: 27
- Joined: Mon Aug 12, 2013 7:18 pm
Re: Player Info API
Thank you sir, in regard to password call, is that not this $params = "Command=AccountsGet&Password=$pw&Player=$player";
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Player Info API
No, that is your API password ($pw) that is sent with every API call.KillerxKen wrote:Thank you sir, in regard to password call, is that not this $params = "Command=AccountsGet&Password=$pw&Player=$player";
-
- Posts: 27
- Joined: Mon Aug 12, 2013 7:18 pm
Re: Player Info API
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.
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Player Info API
Check out the very last example (SessionKey3.php) in the Automated Logins section on the API Examples page: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}?
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.