Scodigo, Inc.

Log In | Register

Cart Items:
0

Am I properly inferring the Numeric Result to PHP_Register?

User icon

Hi All,

Since when I run PHP_Register [no params] in Testbet it returns:
"100 Plug-in is not registered"
before any registration...

And since the manual says that PHP_Register [no params] will return:
"Name: Beta Tester
Company: Beta
License Type: Temporary
User Count: 1
Expiration Date: 01-31-2007"

subsequent to a valid parameterized call of PHP_Register...

(And sunce I presume that another call to PHP_Register [no params] subsequent to an invalid parameterized call will result in the same value as never attempted to have been registered...)

Then can I be pretty certain that any call (with or without parameters) could accurately be evaluated by checking:

0 + GetAsNumber ( LeftWords ( $registration_result ; 1) )
[where $registration_result was set to the result of the call]

and that the result is the ERROR_CODE, that is 0 is no error and anything else is some kind of error
(not registered, invalid registration, expired registration, exceeds user count, whatever)?

I think this will work... although out of an abundance of caution I would appreciate confirmation.

Further, Is there an appendix to the manual that I am missing, or an additional document to download that I am missing that will give all various return values for the various states (not registered = 100; 101 = Invalid Registration; ??? = Expired Registration and so on)?

Thanks in advance for any assistance.

Thanks,
Brad

Partial Answer to my own Question...

Brad's picture

Hi All,

Responding to part of my own questions...

Well, looking at pg 22 continuing to pg 23 would seem to be an exhaustive list of the error codes that I was expecting in an appendix. It would seem that most of the "contextual" error returns would be the identical to calling PHP_GetLastError immediately after any other function call. My code would seem to successfully kludge out the numeric error code, but just as easily I guess I could call whatever I call and then call with selector 1 and 2 successively.

That is, I could run:
$error_both = PHP_Register( "Boogie Man" ; "BMI" ;"123456-123456-123456-123456-123456-123456" );
$error_number = PHP_GetLastError(1);
$error_descr = PHP_GetLastError(2);
rather than parsing myself.

However, my kludge also seems fine, and it would be trivial to write a Custom Function as Case statement for gathering the description from the number... Then again, the minute you start using fm_set_error perhaps letting SmartPill do the work makes most sense.

Which engenders a contextual wish-list item. The ability to set a "preference" (by session of by instance of SmartPill) to consistently return only the numeric error, or only the error description or both (reset to default essentially).

FWIW: $0.02,
Brad

Keep it simple

Micah Woods's picture

Hello Brad,

I think I'd keep it simple and just call PHP_Register to see if the plug-in is registered and if it's not registered, then call PHP_Register with the license parameters and check for the expected result of 0. If you get an error at this point, your license parameters are probably wrong and you need to handle this in your script.

Regards,
Micah