autmated login

For discussion of the Poker Mavens server module and other administration topics
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: autmated login

Post by Kent Briggs »

antmar904 wrote:the i frame was working but when i put in iframe attributes (width/height) its giving me a : Unknown player: $player ERROR
Did you include those two $_GET statements before that?
antmar904
Posts: 30
Joined: Sun Oct 07, 2012 7:24 pm

Re: autmated login

Post by antmar904 »

yes i did here is what i have:

Code: Select all

  <?php
  $player = $_GET["LoginName"];
  $key = $_GET["SessionKey"];
  echo('<iframe src="http://184.82.171.17:80?LoginName=$player&SessionKey=$key" width="1200" height="700"></iframe>');
  ?>
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: autmated login

Post by Kent Briggs »

antmar904 wrote:yes i did here is what i have:

Code: Select all

echo('<iframe src="http://184.82.171.17:80?LoginName=$player&SessionKey=$key" width="1200" height="700"></iframe>');
I see what's happening. You reversed the quotes so that the whole echo string was in single quotes instead of double quotes. When PHP sees a $var inside single quotes, it treats that as a literal and leaves it as-is. When it sees a $var inside double quotes, it replaces that with the actual value. So replace those two outer single quote marks with doubles and all the inner doubles with singles. Also you can drop the :80 port number since 80 is the default port for http.

Code: Select all

echo("<iframe src='http://184.82.171.17?LoginName=$player&SessionKey=$key' width='1200' height='700'></iframe>");
FYI, you can also use concatenation to get around the whole $var inside quote issue. Then the inner/outer order doesn't matter since the $vars will be on the outside:

Code: Select all

echo("<iframe src='http://184.82.171.17?LoginName=" . $player . "&SessionKey=" . $key . "' width='1200' height='700'></iframe>");
echo('<iframe src="http://184.82.171.17?LoginName=' . $player . '&SessionKey=' . $key . '" width="1200" height="700"></iframe>');
antmar904
Posts: 30
Joined: Sun Oct 07, 2012 7:24 pm

Re: autmated login

Post by antmar904 »

got it i don't know how i messed up on the quotes.

also is there a way to integrate the email validation into the create new account api?
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: autmated login

Post by Kent Briggs »

antmar904 wrote:also is there a way to integrate the email validation into the create new account api?
Use the AccountsEdit API command to set a random ValCode for the player. Then use the mail() command in PHP to send that to them.
antmar904
Posts: 30
Joined: Sun Oct 07, 2012 7:24 pm

Re: autmated login

Post by antmar904 »

can you help me out with this i wouldn't even know where to begin and i would really like to implement this for extra security.

thank you again.
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: autmated login

Post by Kent Briggs »

antmar904 wrote:can you help me out with this i wouldn't even know where to begin and i would really like to implement this for extra security.
Have you implemented code to create a new player account?
antmar904
Posts: 30
Joined: Sun Oct 07, 2012 7:24 pm

Re: autmated login

Post by antmar904 »

yes I have but using your example API and tweaking it.

I would like for a validation box to appear after the user hits the submit button on the new account creation page so then the user would have to check there email for the validation code and enter it into the validation box to verify there identity.

Any help is much appreciated and I do understand that you have been going outside your realm of support. :)

Thank you
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: autmated login

Post by Kent Briggs »

antmar904 wrote: I would like for a validation box to appear after the user hits the submit button on the new account creation page so then the user would have to check there email for the validation code and enter it into the validation box to verify there identity.
You can create a random validation code like this to duplicate the internal system than Poker Mavens uses:

Code: Select all

$ValCode = "";
for ($i = 0; $i < 8; $i++) $ValCode = $ValCode . strtoupper(dechex(rand(0, 15)));
The rand(0, 15) function creates a random number from 0 to 15, which is the range of hex digit. The dechex() converts it from decimal to hex (0..f). The strtoupper makes it uppercase (0..F). And the for() loop appends 8 of those together.

If you want Poker Mavens to handle the login/validation process then use the AccountsEdit API command to set the ValCode field like this:

Code: Select all

$params = "Password=$pw&Command=AccountsEdit" . "&Player=" .   urlencode($Player) . "&ValCode=" .  $ValCode;
$api = Poker_API($url,$params,true);
And use the PHP mail() command to send the email:

Code: Select all

$to = $Email;
$subject = "Validation code for our poker site";
$message = "Enter validation code " . $ValCode . " on the Login dialog to activate your account.";
$other = "From: [email protected]";
mail($to, $subject, $message, $other);
If you're going to handle the logins and validation on your web site then you can use the AccountsGet API command to fetch the ValCode for the player. If it's blank, then complete the login process. Otherwise prompt them for it and make sure it matches.
antmar904
Posts: 30
Joined: Sun Oct 07, 2012 7:24 pm

Re: autmated login

Post by antmar904 »

thank you, so i got it to the point that when the user fills out the register form it then creates the validation code and emails a 8 char code to them.

how would i then verify if that is the right verification code for that particular user also deny log in until there email has been validated?
Post Reply