Example #1
0
function SMBCHANGECOMPUTERS()
{
    $ldap = new clladp();
    $filter_search = "(&(objectClass=ArticaComputerInfos)(|(cn=*)(ComputerIP=*)(uid=*))(gecos=computer))";
    $attrs = array("uid", "ComputerIP", "ComputerOS");
    $dn = "{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, $filter_search, $attrs);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $realuid = $hash[$i]["uid"][0];
        if (preg_match("#[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+#", $realuid)) {
            continue;
        }
        $cp = new computers($realuid);
        $cp->UpdateComputerSID();
        if (posix_getuid() != 0) {
            echo "<hr>";
        }
    }
}