UberBots Website Documentation

Function Documentation - security.php



  • logEntry

    logEntry - writes a new entry to the security log, containing text supplied.

    Description

    void logEntry ( string $entry )

    This function writes a new entry to the log which will contain the text of entry.

    Parameters

    • entry

      This is the string which contains the information you want to write to the log.

    Return Values

    This function does not return a value.

    Notes

    The function will append some other data to the beginning of the log entry. The log is located at /logs/security.txt. It will append the user's email, the username, the IP where the action happened, the date and time of the action, and the entry supplied.

    Make sure all administrative actions involve the use of this function. It is very important administrative actions taken on the site are logged. Please do not forget to use this function.

    Examples

    
    //say an event was just added to the calendar above
    //now, the proper thing to do is log that action
    logEntry("Added an event to the calendar.");
    //this would write to the log: example@site.com:test:127.0.0.1:Mon Jan 3 18:10:43 EST 2011:Added an event to the calendar.

    Top of Page
  • userPermissions

    Returns weather or not the user has permissions for a certain page.

    Description

    boolean userPermissions ( int $type , [int $pageId] )

    This function will check if the current user has permissions of type on the pageId given. If no pageId is given, the function will check using the current page.

    Parameters

    • type

      This is the numerical identifier for type of permissions. Giving a 0 will check for read permissions (can the user see the private page), and a 1 will check for write permissions (can the user edit the page).

    • pageId

      This is the numerical identifier for the page to check permissions for. This is an optional parameter; if it's omitted, the function will check on the current page.

      Notes

      Use this function to check and make sure the user has permission to perform certain actions on a page. Don't assume anything. If it's administrative only, this function better be involved.

      Examples

      
      //use of this function with both arguments
      //will check if current user has write permissions on pageId 0
      if(userPermissions(1,0)){
      	echo "Yay! You're an editor!":
      }else{
      	echo "Oh no! You're not an editor!";
      }
      
      
      
      //use of function with one argument
      //checks if user can see the current page
      if(userPermissions(0)){
      	echo "You can see this page.";
      }else{
      	echo "You can't see this page.";
      }
      
      Top of Page

Upcoming Events

Events in the next week:

No upcoming events.

Connect With Us

Follow us on Twitter! Connect with us on Facebook! Add us to your circles on Google+