API Account Parameters Validation

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

API Account Parameters Validation

Postby CanadaWest » Sat Sep 19, 2009 2:36 pm

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
CanadaWest
 
Posts: 107
Joined: Wed May 06, 2009 12:59 pm

Re: API Account Parameters Validation

Postby Kent Briggs » Sat Sep 19, 2009 2:58 pm

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.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3936
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Account Parameters Validation

Postby CanadaWest » Sat Sep 19, 2009 3:35 pm

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
CanadaWest
 
Posts: 107
Joined: Wed May 06, 2009 12:59 pm

Re: API Account Parameters Validation

Postby Kent Briggs » Sat Sep 19, 2009 3:49 pm

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"];
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3936
Joined: Wed Mar 19, 2008 8:47 pm

Re: API Account Parameters Validation

Postby CanadaWest » Sat Sep 19, 2009 4:33 pm

Thank you,

bummer,

and Thank you very much.
George
(CanadaWest)
www.playersclub.ca
CanadaWest
 
Posts: 107
Joined: Wed May 06, 2009 12:59 pm


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 7 guests

cron