<?php
session_start ();
require_once 'class.PHPLdap.php';
$ldap = new PHPLdap();
$ldap->setLDAPServer('123.123.123.123'); // LDAP Server Address
$ldap->setLDAPTLD(''); // Top-level domain such as .com and .net and .org
$ldap->setLDAPDomain(''); //Second-level domain (SLD) names. These are the names directly to the left of .com, .net
$ldap->setLDAPUser(''); // LDAP user to perform LDAP requests
$ldap->setLDAPPassword(''); // pass word for the LDAP user
$ldap->connect(); // connect to the ldap server
// Simple logi script using the PHPLdap class
$groupName = 'IT';
include ('login.php');
if ($ldap->loggedIn ())
{
?>You are logged in <?php
if ($ldap->isMemberOfGroup ( $_SESSION ['username'], $groupName )){
?>to the given group <?=$groupName?><?php
}else{
?>but you are not a member of the given group <?=$groupName?><?php
}
}else{
?>You are not logged in. Please use the form above to gain access<?php
}
?>
|