Help api

For discussion of the Poker Mavens server module and other administration topics
Post Reply
coyote
Posts: 29
Joined: Wed Sep 30, 2009 4:10 am

Help api

Post by coyote »

Hi
I do not understand the problem to a form of creation of ring game
I have this error message

Error: No table name specified

Here is my code

Code: Select all

<?php

 {   include "API.php";

    if (isset($_REQUEST["Submit"]))
    {
      $Name = $_REQUEST["Name"];
      $Game = $_REQUEST["Game"];
	  $PW = $_REQUEST["PW"];
	  $Private = $_REQUEST["Private"];
	  $ObserverChat = $_REQUEST["ObserverChat"];
	  $Seats = $_REQUEST["Seats"];
	  $BuyInMin = $_REQUEST["BuyInMin"];
	  $BuyInMax = $_REQUEST["BuyInMax"];
	  $BuyInDef = $_REQUEST["BuyInDef"];
	  $Rake = $_REQUEST["Rake"];
	  $RakeEvery = $_REQUEST["RakeEvery"];
	  $RakeMax = $_REQUEST["RakeMax"];
	  $TurnClock = $_REQUEST["TurnClock"];
	  $TimeBank = $_REQUEST["TimeBank"];
	  $SmallBlind = $_REQUEST["SmallBlind"];
	  $BigBlind = $_REQUEST["BigBlind"];
	  $Description = $_REQUEST["Description"];
      $Auto = $_REQUEST["Auto"];
      $params = "Password=$pw&Command=RingGamesAdd" .
                "&Name" .   urlencode($Name) .
                "&Game" .   urlencode($Game) .
                "&PW" .   urlencode($PW) .
                "&Private" .   urlencode($Private) .
                "&ObserverChat" .   urlencode($ObserverChat) .
                "&Seats" .   urlencode($Seats) .
                "&BuyInMin" .   urlencode($BuyInMin) .
                "&BuyInMax" .   urlencode($BuyInMax) .
                "&BuyInDef" .   urlencode($BuyInDef) .
                "&Rake" .   urlencode($Rake) .
                "&RakeEvery" .   urlencode($RakeEvery) .
                "&RakeMax" .   urlencode($RakeMax) .
                "&TurnClock" .   urlencode($TurnClock) .
                "&TimeBank" .   urlencode($TimeBank) .
                "&SmallBlind" .   urlencode($SmallBlind) .
                "&BigBlind" .   urlencode($BigBlind) .
                "&Description" .   urlencode($Description) .
                "&Auto" .   urlencode($Auto) .
                "&Note=" .     urlencode("Cach game via API");
      $api = Poker_API($url,$params,true);
      if ($api["Result"] == "Ok") echo "Cash game successfully created ";
      else echo "Erreur: " . $api["Error"] . "<br>Click Back Button to correct.";
      exit;
}

?>

<form method="POST">
<table>

<tr><th colspan="2">New Ring Game</th></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td>Name:</td><td><input type="text" name="Name" value=""></td></tr>
<tr><td>Game:</td><td><select name="Game">
<option value="Limit Hold'em">Limit Hold'em</option>
<option value="Pot Limit Hold'em">Pot Limit Hold'em</option>
<option value="No Limit Hold'em" selected>No Limit Hold'em</option>
</select></td></tr>
<tr><td>Password:</td><td><input type="text" name="PW" value=""></td></tr>
<tr><td>Private:</td><td><select name="PrivateGame">

<option value="Yes">Yes</option>
<option value="No" selected>No</option>
</select></td></tr>
<tr><td>Observer Chat:</td><td><select name="ObserverChat">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></td></tr>
<tr><td>Seats:</td><td><select name="Seats">
<option value="2">2</option>
<option value="3">3</option>

<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10" selected>10</option>
</select></td></tr>
<tr><td>Min buy-in:</td><td><input type="text" name="MinBuyIn" value="400"></td></tr>

<tr><td>Max buy-in:</td><td><input type="text" name="MaxBuyIn" value="2000"></td></tr>
<tr><td>Default buy-in:</td><td><input type="text" name="DefBuyIn" value="1200"></td></tr>
<tr><td>Rake:</td><td><input type="text" name="Rake" value="0"></td></tr>
<tr><td>Rake every:</td><td><input type="text" name="RakeEvery" value="0"></td></tr>
<tr><td>Rake max:</td><td><input type="text" name="RakeMax" value="0"></td></tr>
<tr><td>Turn clock:</td><td><input type="text" name="Turn" value="30"></td></tr>
<tr><td>Time bank:</td><td><input type="text" name="Bank" value="60"></td></tr>
<tr><td>Small blind:</td><td><input type="text" name="SmallBlind" value="10"></td></tr>
<tr><td>Big blind:</td><td><input type="text" name="BigBlind" value="20"></td></tr>

<tr><td>Description:</td><td><textarea rows="3" name="Description"></textarea></td></tr>
<tr><td colspan="2" align="center">
<input type="checkbox" name="Auto" value="Yes" checked>Auto online</td></tr>
<tr><td colspan="2" align="center" height="60">
<input type="submit" name="Submit" value="Submit" />
 
&nbsp; 
<input  type="reset" style="width: 100px" value="Cancel">
</td></tr>
</table>
</form>
Any help will be welcomev :D
Thanks
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Help api

Post by Kent Briggs »

Just glancing at your code, I see you are missing a bunch of equal signs building the params list. You have them on Password and Command at the top and Note at the bottom but none in between:
$params = "Password=$pw&Command=RingGamesAdd" .
"&Name" . urlencode($Name) .
"&Game" . urlencode($Game) .
"&PW" . urlencode($PW) .
"&Private" . urlencode($Private) .
"&ObserverChat" . urlencode($ObserverChat) .
"&Seats" . urlencode($Seats) .
"&BuyInMin" . urlencode($BuyInMin) .
"&BuyInMax" . urlencode($BuyInMax) .
"&BuyInDef" . urlencode($BuyInDef) .
"&Rake" . urlencode($Rake) .
"&RakeEvery" . urlencode($RakeEvery) .
"&RakeMax" . urlencode($RakeMax) .
"&TurnClock" . urlencode($TurnClock) .
"&TimeBank" . urlencode($TimeBank) .
"&SmallBlind" . urlencode($SmallBlind) .
"&BigBlind" . urlencode($BigBlind) .
"&Description" . urlencode($Description) .
"&Auto" . urlencode($Auto) .
"&Note=" . urlencode("Cach game via API");
coyote
Posts: 29
Joined: Wed Sep 30, 2009 4:10 am

Re: Help api

Post by coyote »

I have noted that I miss them =
but I still have errors with the form

Erreur: Invalid Game Type specified

Code: Select all


 $params = "Password=$pw&Command=RingGamesAdd" .
                "&Name=" . urlencode($Name) .
                "&Game=" . urlencode($Game) .

<form method="post">
<select name="Game" size="1" class="stretch">
<option value="Limit Hold'em">Limit Hold'em</option>
<option value="Pot Limit Hold'em">Pot Limit Hold'em</option>
<option value="No Limit Hold'em" selected>No Limit Hold'em</option>
</select>
but when I spend hard there is no problem?
Ok

Code: Select all

     $params = "Password=$pw&Command=RingGamesAdd" .
                "&Name=" . urlencode($Name) .
                "&Game=" . urlencode("No Limit Hold'em") .
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Help api

Post by Kent Briggs »

The Form is escaping the apostrophe in Hold'em by inserting a backslash in from of it so that No Limit Hold'em is getting sent as No Limit Hold\'em. The fix is to strip that out before sending it like this:

"&Game=" . urlencode(stripslashes($Game)) .
coyote
Posts: 29
Joined: Wed Sep 30, 2009 4:10 am

Re: Help api

Post by coyote »

Thank you for everything here is the file that can be used to the other. ;)
Attachments
api-ring-game.zip
(1.29 KiB) Downloaded 423 times
Post Reply