March 28th, 2012, 12:19 PM
Help with code not working
Hope someone can help me with this. Here is what I am trying to do... I am using a wordpress plugin that authenticates to Active Directory, however when the user logs in I need to php page to check for the group the user belongs to and if they are part of a particular group they will have certain access on the site. Here is the part of the code that I am using which does not seem to work, when they login it does not detect the group that they are in...
$str = shell_exec('./grouptestfull.php -u'.$LoggedInUsername);
calls grouptestfull.php which is this...
I get no errors in the php error log, but just can't figure out why this is not working.
Version 1 - inital version
$arguments = getopt("u:");
// clear the flags
$validhr = false;
$validinf = false;
$validroot = false;
//print "username as receved by function ".$gtfusernamein."<br>";
$gtfusername = "";
$gtfusername = $gtfusernamein."";
//print "processed username ".$gtfusername."<br><hr>";
$gtfadldapedit = new adLDAP();
catch (adLDAPException $e)
echo $e; exit();
//check group membership
$validhr = true;
$validinf = true;
$validroot = true;
//sort and return highest lvl group membership
March 28th, 2012, 12:43 PM
Please edit your post and enclose your code in PHP tags. See ManiacDan's New User Guide for details and many good tips on debugging your own code. That having been said, I suggest you try using PHP's builtin LDAP API.
There are 10 kinds of people in the world. Those that understand binary and those that don't.