AccountSessionKey and Auto Logon

For discussion of the Poker Mavens server module and other administration topics

AccountSessionKey and Auto Logon

Postby pzero » Thu Nov 26, 2009 4:42 am

Hi,

I am hoping someone can help me out here. I am looking at purchasing PM shortly, im just playing around with trial and the API too see that I can intergrate it with my site. Im not much of PHP'r but have done some scripting in the past, guess I just need a helping hand.

I am wondering how I can automate a login using AccountSessionKey. From what I gather you need to find your AccountSessionKey first then pass it in to the PM site. I am able to do this by executing the following 2 URL's

http://192.168.0.100:8087/api?command=a ... er=Player1
http://192.168.0.100:8087/?LoginName=Pl ... y=whatever above url returns

I have the API.php include script working correctly (as provided on this forum), I am able to use the "chip leaders" php with no issues.

So I guess my question is, what PHP code do I need to get the session key of the logged on user, then pass that to the 2nd url?

Thanks.
pzero
 
Posts: 20
Joined: Thu Nov 26, 2009 3:59 am
Location: Australia

Re: AccountSessionKey and Auto Logon

Postby Kent Briggs » Thu Nov 26, 2009 10:38 am

pzero wrote:So I guess my question is, what PHP code do I need to get the session key of the logged on user, then pass that to the 2nd url?


This link you did manually:
http://192.168.0.100:8087/api?command=accountssessionkey&password=APIPW&player=Player1

Would look something like this via PHP (untested):

Code: Select all
include "API.php";  // API $url and $pw values set here
$player = "Player1";
$params = "Password=" . $pw . "&Command=AccountsSessionKey" . "&Player=" . $Player;
$api = Poker_API($url,$params,true);
$result = $api["Result"];
if ($result == "Error") die("Error: " . $api["Error"]);
$key = $api["SessionKey"];

// then build your login link:

echo "<a href='http://192.168.0.100:8087/?LoginName=" . $player . "SessionKey=" . $key . "'>Login Here</a>";


Instead of a login link, you could also make a login button via an html form. Of course, before doing any of this, it is assumed you've already confirmed the player's identity through your own login system.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3830
Joined: Wed Mar 19, 2008 8:47 pm

Re: AccountSessionKey and Auto Logon

Postby pzero » Sun Nov 29, 2009 11:29 pm

Thanks Kent. Hoping to try this soon. Im having issues trying to get joomla to register a user and send the http post command to add that user to the poker mavs system at the same time.
pzero
 
Posts: 20
Joined: Thu Nov 26, 2009 3:59 am
Location: Australia

Re: AccountSessionKey and Auto Logon

Postby pzero » Fri Dec 04, 2009 7:20 pm

Got this working successfully on my site now. Getting it working with joomla was fun.......not. I had heaps of issues getting a site rego to sync up with poker mavens rego. then some more fun getting a session key out to pass back in. If anyone is using joomla and needs some help let me know. We can fudge ourway thru :)
pzero
 
Posts: 20
Joined: Thu Nov 26, 2009 3:59 am
Location: Australia


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 7 guests

cron