Page 3 of 3

Re: Player Info API

Posted: Mon Aug 19, 2013 11:43 pm
by KillerxKen
What about the part that says header? and those variables?

Re: Player Info API

Posted: Mon Aug 19, 2013 11:59 pm
by KillerxKen
Here is a completed PHP(you still need to add dressing) for a PlayerInfo Page. You can echo back whatever information you wish to the player now.(see AccountsGet in API for complete list), Thanks Mr Briggs for all your help in getting it working.This will not log them into your poker software, but simply request the information requiring a password to see it.

Code: Select all

<?php

  $server = "http://ur.site.numbers.here/api";   // set your url here
  include "API.php";  // $pw and $url set in this file

  if (isset($_POST["Login"]))
  {
    $player = $_POST["Player"];
    $password = $_POST["Password"];
    $params = "Password=$pw&Command=AccountsPassword" . "&Player=" . urlencode($player) . "&PW=" . urlencode($password);
    $api = Poker_API($url,$params,true);
    if ($api["Result"] != "Ok") die($api["Error"] . "<br/>" . "Click Back Button to retry.");
    if ($api["Verified"] != "Yes") die("Password is incorrect. Click Back Button to retry.");
    $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>";
    exit;
  }
?>

<html>
<body>
 
  <h3>Poker Login</h3>
  <form method="post">
    <table>
      <tr>
        <td>Player Name:</td>
        <td><input type="text" name="Player"></td>
      </tr>
      <tr>
        <td>Password:</td>
        <td><input type="password" name="Password"></td>
      </tr>
      <tr>
        <th colspan="2"><input type="submit" name="Login" value="Login"></th>
      </tr>
    </table>
  </form>

</body>
</html>