Exemplo n.º 1
0
    DifferentPasswords();
} else {
    // VALIDATION PASSED -------------------------------------------------------
    // Encoding the passwords
    $userPassword = EncodePassword($userPassword, $ldap_enc);
    $userPasswordOld = EncodePassword($userPasswordOld, $ldap_enc);
    // We are going to search for a user entry matching the data provided by
    // the user on the form
    // We stablish what attributes are going to be retrieved from each entry
    $search_limit = array("dn");
    // The filter string to search through LDAP
    $search_string = "(&(mail=" . $mail . ")(userPassword="******")(uid=" . $uid . "))";
    // The attribute the array of entries is going to be sorted by
    $sort_string = 'dn';
    // Searching ...
    $search_entries = AssistedLDAPSearch($ldapc, $ldap_base, $search_string, $search_limit, $sort_string);
    // How much did we get?
    $result_count = $search_entries['count'];
    // If we didn't get any entries, there are no user entries matching the
    // data provided by the user. Maybe the user doesn't exist or the user made
    // a mistake entering the data
    if ($result_count == 0) {
        NoResults();
        // If we got more than one entry, then something is really messed up with
        // the database, there must not be more than one entry with the same data
    } elseif ($result_count > 1) {
        MultipleResults();
        // If we got one coincidence, then we can proceed to modification
    } elseif ($result_count == 1) {
        // What dn are we going to modify?
        $moddn = $search_entries['0']['dn'];
Exemplo n.º 2
0
 // The filter string to search through LDAP
 $search_string1 = "(uid=" . $uid . ")";
 // The attribute the array of entries is going to be sorted by
 $sort_string1 = 'uid';
 // Searching ...
 $search_entries1 = AssistedLDAPSearch($ldapc, $ldap_base, $search_string1, $search_limit1, $sort_string1);
 // How much did we get?
 $result_count1 = $search_entries1['count'];
 // We stablish what attributes are going to be retrieved from each entry
 $search_limit2 = array("mail");
 // The filter string to search through LDAP
 $search_string2 = "(mail=" . $mail . ")";
 // The attribute the array of entries is going to be sorted by
 $sort_string2 = 'mail';
 // Searching ...
 $search_entries2 = AssistedLDAPSearch($ldapc, $ldap_base, $search_string2, $search_limit2, $sort_string2);
 // How much did we get?
 $result_count2 = $search_entries2['count'];
 // If we get one or more entries, then the selected username exists
 if ($result_count1 > 0) {
     UserExists();
     // If we get one or more entries, then the e-mail provided is in use
 } elseif ($result_count2 > 0) {
     UsedEMail();
     // The cookie has expired
 } elseif (!isset($session_captcha)) {
     ExpiredCaptcha();
     // We compare the cookie hash with the user entry
     // If they are different, the user messed up
 } elseif ($session_captcha != $image_captcha) {
     WrongCaptcha();