Location: PHPKode > projects > Meeting Request Scheduling and Booking System > mrsbs/php/lib/auth.pamacea.inc
<?PHP

   // getenv Auth, for use with .htaccess
   //
   // Version: $Revision: 1.1 $
   // Date: $Date: 2006/09/05 02:55:48 $
   //
   // Copyright (c) 2006 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.

// Does this auth handler support logout?

$auth_logout_provided = true;

function auth_handler()
{
  // Perform the local authentication.  Session information is set here.

  // Returns: true if auth is successful, false otherwise.

  // An auth handler needs to set three variables:

  if(getenv("REMOTE_USER") != "")
  {
    // Using unvalidated input ($_GET) here is unsafe
    
    // (1) The user logged in as
    $_SESSION['user'] = getenv("REMOTE_USER");
  
    // (2) An array of groups for the user
    $_SESSION['groups'] = preg_split("/ /", getenv("USER_AFFILIATIONS"));

    // (3) The email address of the logged in user
    // There isn't a standard way to get the mail address, so we guess
    $_SESSION['mail'] = getenv("USER_EMAIL");
  }

  return(true);
}

function auth_logout()
{
  // Perform the local logout and clear session information.

  // Returns: true if auth is successful, false otherwise.

  // On logout, an auth handler needs to clear the session variables.

  clear_session_vars();

  // Redirect to system logout page

  print '
<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" CONTENT="0;URL=/pamacea/logout.html">
</HEAD>
<BODY BGCOLOR=gray>
</BODY>
</HTML>
    ';

  exit;
}

?>
Return current item: Meeting Request Scheduling and Booking System