Jump to content

djollie029

New Members
  • Posts

    4
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by djollie029

  1. I've finally managed to get what I need working with the adLDAP and SSO. For future reference for anyone else looking for similar solution to get the firstname and lastname from Active Directory that matches the logged on users username... <?php session_start(); $username = explode('\\',$_SERVER["LOGON_USER"]); $_SESSION['username'] = strtolower($username[1]); ?> <?php include ("/../src/adLDAP.php"); $ldap=new adLDAP(); $userinfo = $ldap->user()->info($_SESSION['username'],array("givenname","sn")); $_SESSION['firstname'] = $userinfo[0][givenname][0]; $_SESSION['lastname'] = $userinfo[0][sn][0]; $firstname = $_SESSION['firstname']; $lastname = $_SESSION['lastname']; ?> <br /> <strong>Welcome </strong><?php printf("<b><i>$firstname $lastname</i></b>"); ?>
  2. Thanks @Barand for your help. I have also been playing around with adLDAP for a couple of days but cannot quite get the SSO element to work. In the adLDAP I have set useSSO variable to True. I have then tried multiple ways to call that file and authenticate a user with no luck. Below I have posted the cutdown code I am trying to test with. What am I doing wrong please? php_ldap.dll is enabled in the PHP ini file. Thanks in advance! <?php require_once(dirname(FILE) . '/../src/adLDAP.php'); $adldap = new adLDAP(); $adldap->user($username, $password); $result=$adldap->user()->infoCollection("username", array("*")); echo $result->displayName; echo $result->mail; ?>
  3. Any help would be really appreciated!
  4. Hi all, I have been trying to find the answer to this for the past 3 days by searching many forums and am resorting to asking the question myself now as I'm totally stuck! Quite simply I need to do the following for a new Staff Intranet I'm building that uses Windows Authentication in IIS... I am a system administrator and so have full access to our Active Directory on Server 2012. I need a simple PHP script that takes the username of the current logged on user $_SERVER["AUTH_USER"] and connects to our local Active Directory (LDAP) for which I can provide administrator credentials for (so it does not need to be an anonymous connection). I then need the script to look up the user based on the Auth_User result above for the user looking at the Intranet Site, and return the DisplayName and Email Address for that user and store them in a session to be used elsewhere on the Intranet Site. In theory I imagine this is quite simple, however I have struggled to get other scripts working to what I need. Any help would be really appreciated!! Thank you :-)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.