Example #1
0
<?php

require_once 'init.php';
$ldap = get_ldap_connection();
include 'tableau_trusted.php';
if (add_tableau_user($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"], get_ldap_cn($_SERVER["PHP_AUTH_USER"]), 'interactor', 'none', '0', 0)) {
    $trusted_url = login_tableau($_SERVER["PHP_AUTH_USER"], TABLEAU_SERVER, 'workbooks');
    // echo '<meta http-equiv="refresh" content="2;url=' . $trusted_url . '">';
} else {
    echo "Failed attempt to create user: "******"PHP_AUTH_USER"];
}
Example #2
0
        $dn = "mail={$user}, o=com, dc=mozilla";
        //the object itself instead of the top search level as in ldap_search
        $filter = "(objectclass=inetOrgPerson)";
        // this command requires some filter
        $justthese = array("cn");
        //the attributes to pull, which is much more efficient than pulling all attributes if you don't do this
        if (!($sr = ldap_read($ds, $dn, $filter, $justthese))) {
            throw new Exception('Incorrect Username or filter');
        }
        if (!($entry = ldap_get_entries($ds, $sr))) {
            throw new Exception('Unable to find LDAP entry for ' . $user);
        }
        if ($debug != 0) {
            echo $entry[0]["cn"][0] . " is the name in LDAP for " . $user;
        }
        ldap_close($ds);
        return $entry[0]["cn"][0];
    } catch (Exception $e) {
        echo 'Oops! I countered the following error: ', $e->getMessage(), "\n";
    }
}
get_ldap_cn("*****@*****.**");
require_once 'templates/footer.php';
?>