API Account Parameters Validation

For discussion of the Poker Mavens server module and other administration topics
Post Reply
CanadaWest
Posts: 107
Joined: Wed May 06, 2009 12:59 pm
Contact:

API Account Parameters Validation

Post by CanadaWest »

Creating an account via API the server appears to validate some parameters and not others.

It doesn't, for instance, check to see if the email address is alredy in use. But it does check the format of the PlayerName.

Is there a list somewhere of what the server does/doesn't check when creating a new account via API?
George
(CanadaWest)
www.playersclub.ca
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Account Parameters Validation

Post by Kent Briggs »

CanadaWest wrote:Creating an account via API the server appears to validate some parameters and not others.
It doesn't, for instance, check to see if the email address is alredy in use. But it does check the format of the PlayerName.
Is there a list somewhere of what the server does/doesn't check when creating a new account via API?
The AccountsAdd API command just uses the same validation routine as if you were manually creating the account from the server console. It's not as thorough as the routine that checks a player-created account. Specifically it looks at the following:

Name is 3 to 12 characters and only includes letters, numbers, dashes, or underscores.

Name cannot be Dealer, System, or Administrator.

Title cannot exceed 15 characters in length.

Level cannot exceed 50 characters in length.

Real Name cannot exceed 25 characters in length.

Password must be from 6 to 30 characters in length.

Location must be from 1 to 30 characters in length.

Email address cannot exceed 80 characters in length and must contain an @ sign and a period.

Avatar index must be from 0 to 64.

If Avatar is 0 then you must specify an avatar file and that file must currently exist.

Custom field cannot exceed 50 character limit.

Note field cannot exceed 250 character limit.
CanadaWest
Posts: 107
Joined: Wed May 06, 2009 12:59 pm
Contact:

Re: API Account Parameters Validation

Post by CanadaWest »

Thanks Kent.

So we need to check for a duplicate email address and run our own email validation?

Will api AccountsAdd write to the "ValCode" field? I don't see that parameter on the list.

And, whats wrong with this? It is returning "Notice: Undefined index: Email ... on line 26"

$params = "Password=$pw&Command=AccountsList&Fields=Email" ;
$api = Poker_API($url,$params,true);
$n = $api["Email"]; // This is line 26
$found = false;
for ($i = 1; $i <= $n; $i++)
{
$REmail = $api["Email" . $i];
if ($REmail == $Email)
{
$found = true;
}}
if ($found == true) die ("<p align=\"center\" font=\"arial\">
That Email address already has an account associated with it.
Click Back Button on your browser to correct the form.</font></p>");
George
(CanadaWest)
www.playersclub.ca
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Account Parameters Validation

Post by Kent Briggs »

CanadaWest wrote: So we need to check for a duplicate email address and run our own email validation?
Yes.
Will api AccountsAdd write to the "ValCode" field? I don't see that parameter on the list.
No, that field is disabled on creation so you'll have to do an AccountsEdit to write a value there.
And, whats wrong with this? It is returning "Notice: Undefined index: Email ... on line 26"
There is no "Email" field returned by AccountsList. There's an Email1, Email2, Email3, etc. You want the total count returned so change this:

$n = $api["Email"];

to this:

$n = $api["Accounts"];
CanadaWest
Posts: 107
Joined: Wed May 06, 2009 12:59 pm
Contact:

Re: API Account Parameters Validation

Post by CanadaWest »

Thank you,

bummer,

and Thank you very much.
George
(CanadaWest)
www.playersclub.ca
Post Reply