function echoall($string) { echo "<span class='normal'>"; if (is_array($string) or is_object($string)) { echo count($string) . " elements"; echoarray($string); } switch ($string) { case NULL: echo "*NULL"; break; case "": echo "*empty"; break; case FALSE: echo "*FALSE"; break; default: echo $string; break; } echo "<br></span>"; }
} $i++; } // Sort the array by newest date first. $sort_array = array(); foreach ($lan_dataresults as $record) { $sort_array[] = $record['date']; } array_multisort($sort_array, SORT_DESC, $lan_dataresults); /* Normally disabled... useful for debugging. */ //if ($debug == 1) { echoarray $p_match_addesc); }; if ($debug == 1) { echoarray($lan_dataresults); } if ($debug == 1) { echoarray($sql_query); } // Start building the table to display. echo "<br />\n\t\t\t\t<small><table class=\"table\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Decision</th>\n\t\t\t\t\t\t\t<th>MAC Address</th>\n\t\t\t\t\t\t\t<th>AD Description</th>\n\t\t\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t\t\t<th>Switch</th>\n\t\t\t\t\t\t\t<th>Port</th>\n\t\t\t\t\t\t\t<th>Decision Info</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t"; // Get how many records are in the array and start the displaying process. $i = 0; $count = sizeof($lan_dataresults); while ($i < $count) { // Change the row colour via CSS depending on whether the decision was to // accept or reject. if ($lan_dataresults[$i]['decision'] == "Rejected") { echo "<tr class=\"danger\">"; } else { echo "<tr class=\"success\">"; } // Stuff array record into table.
if (isset($sql_lan_results[0]['tagid'])) { $tagid = $sql_lan_results[0]['tagid']; } elseif (!isset($sql_lan_results[0]['tagid']) and isset($sql_wlan_results[0]['tagid'])) { $tagid = $sql_wlan_results[0]['tagid']; } if (!isset($tagid) or $tagid == "") { $tagid = "none"; } // Open the AD connection up. ad_start(); // Determine which properties we want to return from the AD query and then set it off finding. $keep = array('cn', 'displayname', 'department', 'physicaldeliveryofficename', 'memberof', 'description', 'useraccountcontrol'); $ldap_results = ad_findattributes($l_device, $keep); $ldap_result_usergroups = ad_usergroups($l_device); if ($debug == 1) { echoarray($ldap_results); } // Debug details. // Close the AD connection ad_end(); // Remove DN tags and replace with something a bit more friendly. $l_rgx_ou = array(array('/(CN=)\\w+,|(OU=)|(,DC=[^;]*)/', '/,/'), array(' ', ' <b><</b>')); $l_rgx_memberof = array(array('/(CN=)|(,OU=[^;]*)/'), array('')); $ou = preg_replace($l_rgx_ou[0], $l_rgx_ou[1], $ldap_results['dn']); // Changed this slightly so it gets the PrimaryGroupID from the user aswell as it's groups. For // some reason the Primary Group is stored differently in AD - *shrugs* (JRT 05/11/15). // Check to see if user is part of any groups. /* if (isset($ldap_results['memberof']['count'])) { $i = 0; $memberof = null;