Development » API Functions » Login Functions

Login and other User related APIs

User related and login

userLogin($username, $password, $rememberme=0, $url="", $id="", $alias="")

  // Performs user login and permissions assignment
  // And combination of the following variables can be sent
  // Defaults to current document
  // $url   = and fully qualified URL (no validation performed)
  // $id    = an existing document ID (no validation performed)
  // $alias = any document alias (no validation performed)

userLogout($url="", $id="", $alias="")

  // Use the managers logout routine to end the current session
  // And combination of the following variables can be sent
  // Defaults to index.php in the current directory
  // $url   = any fully qualified URL (no validation performed)
  // $id    = an existing document ID (no validation performed)
  // $alias = any document alias (no validation performed)

userLoggedIn()

  // returns an array of user details if logged in else returns false
  // array components returned are self-explanatory

getAuthorData($internalKey)

  // returns a $key=>$value array of information from the user_attributes table
  // $internalKey which correlates with a documents createdby value.
  // Uasge: There are several ways in which this function can be called.
  //   To call this function from within a snippet you could use
  //   $author = $etomite->getAuthorData($etomite->documentObject['createdby'])
  //   or $author = $etomite->getAuthorData($row['createdby']) or $author = $etomite->getAuthorData($rs[$i]['createdby']).
  //   Once the $key=>$value variable, $author, has been populated you can access the data by using code similar to
  //   $name = $author['fullname'] or $output .= $author['email'] for example.
  //   There is also a snippet named GetAuthorData which uses the format:
  //  

checkUserRole($action="", $user="", $id="")

  //  determine document permissions for a user
  //  $action = any role action name (edit_document,delete_document,etc.)
  //  $user = user id or internalKey
  //  $id = id of document in question
  //  because user permissions are stored in the session data the users role is not required
  // Returns error on fialure.

checkPermissions()

  //  determines user permissions for the current document
  // Returns error on failure.

getCaptchaNumber($length, $alt='Captcha Number', $title='Security Code')

  // returns a Captcha Number image to caller and stores value in $_SESSION['captchNumber']
  // $length = number of digits to return
  // $alt = alternate text if image cannot be displayed
  // $title = message to display for onhover event

validCaptchaNumber($number)

  // returns Captcha Number validation back to caller - boolean (true|false)
  // $number = number entered by user for validation (example: $_POST['captchaNumber'])


Hosting Costs Generously Subsidized By:
Hydraulikservice | Andreas Lewicki