IOPLEX
Communications Software
Plexcel for PHP - Active Directory PHP Integration
plexcel_new
plexcel_status
plexcel_find_authorities_by_domain
plexcel_get_authority
plexcel_get_domain
plexcel_log
plexcel_preamble
plexcel_authenticate
plexcel_sso
plexcel_logon
plexcel_logoff
plexcel_accept_token
plexcel_is_member_of
plexcel_set_password
plexcel_change_password
plexcel_gen_service_keytab
plexcel_search_objects
plexcel_get_account
plexcel_add_object
plexcel_modify_object
plexcel_delete_object
plexcel_set_attrdefs
plexcel_get_attrdefs
plexcel_set_conv_attrdefs

plexcel_status

Printer Friendly Format

Synopsis

string plexcel_status(resource $px, [string $status])

Description

The plexcel_status function returns a string indicating the current status of the specified Plexcel context resource.

The $px parameter is the Plexcel context resource to be queried or NULL if no such context is appropriate (e.g. the plexcel_new function returned FALSE ).

If the optional $status parameter is supplied, the status string for $px is set to $status .

The strings returned by plexcel_status are, under normal circumstances, predefined constants with values equal to that of the symbol name (e.g. the constant PLEXCEL_NO_CREDS is defined as a string ' PLEXCEL_NO_CREDS '). These constants may be logically tested in a conditional expression. The following is a list of only some of these constants (the full list includes many more PLEXCEL_LDAP_* status constants).

PLEXCEL_SUCCESS
PLEXCEL_FAILURE
PLEXCEL_CONTINUE_NEEDED
PLEXCEL_NO_CREDS
PLEXCEL_LOGON_FAILED
PLEXCEL_PRINCIPAL_UNKNOWN
PLEXCEL_LDAP_SUCCESS
PLEXCEL_LDAP_OPERATIONS_ERROR
PLEXCEL_LDAP_PROTOCOL_ERROR
PLEXCEL_LDAP_TIMELIMIT_EXCEEDED

        ...
      
A small subset of plexcel_status codes.

If a plexcel function is being use inappropriately or if an exceptional error occurs, the plexcel_status function may also return detailed failure information. Below is an example of this type of status string.

src/creds.c:322:psec_logon_with_password: KRB5: Clients credentials have been revoked
  src/set_password.c:204:psec_gen_service_keytab: 
  src/plexcel.c:1416:plexcel_gen_service_keytab:
A sample exception returned by plexcel_status

Returns

The plexcel_status function returns a string constant or diagnostic string regarding the status of the specified Plexcel context resource.

Example

The following PHP fragment illustrates how one might handle a failure of the plexcel_authenticate function.

if (plexcel_authenticate($px, session_id(), $options) == FALSE) {
    if (plexcel_status($px) == PLEXCEL_NO_CREDS) {
        // creds gone, fallback to logon form
    } else if (plexcel_status($px) == PLEXCEL_PRINCIPAL_UNKNOWN) {
        $username = plexcel_get_param('p_username');
        $err = "<p/>Principal unknown: $username";
    } else if (plexcel_status($px) == PLEXCEL_LOGON_FAILED) {
        $err = '<p/>Logon failed (e.g. bad password)';
    } else {
        $err = '<p/>Plexcel error: <pre>' . plexcel_status($px) . '</pre>';
    }
    ...
A plexcel_authenticate example with error handling
© 2008 IOPLEX Software | Contact Us | Policies