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']; // We fill in our attribute modificator array $in['userPassword'] = $userPassword; // Modifying ... $mod = AssistedLDAPModify($ldapc, $moddn, $in); // If the modifying went OK, we send the notification e-mail to the user if ($mod) { $send = AssistedEMail("ChangePasswordDo", $mail); } // If the mailing went OK ... if ($send) { // We log the event WriteLog("ChangePasswordDo"); // Print the good news to the user Success("ChangePasswordDo"); } else { // We fail nicely, at least Fail("ChangePasswordDo"); } } } // Closing the connection $ldapx = AssistedLDAPClose($ldapc);
$in['loginShell'] = "/bin/false"; $in['description'] = $row['description']; // Adding ... $add = AssistedLDAPAdd($ldapc, $newdn, $in); // If the adding went OK, we increment the maxUID if ($add) { // Building the maxUID entry to modify $moddn = "uid=maxUID," . $ldap_base; // We build up the array that's going to modify the maxUID entry $in2['uidNumber'] = $in['uidNumber']; // Incrementing maxUID entry $mod = AssistedLDAPModify($ldapc, $moddn, $in2); } // If the modification went OK, we send the notification e-mail to the user if ($mod) { $send = AssistedEMail("NewUserDo", $mail); } // If the mailing went OK ... if ($send) { // We need to get rid of the temporary entry $del_q = sprintf("DELETE FROM NewUser" . " WHERE uid='%s'" . " AND token='%s'", mysql_real_escape_string($uid), mysql_real_escape_string($token)); // Deleting the row from the table ... $del_r = AssistedMYSQLQuery($del_q); // We log the event WriteLog("NewUserDo"); // Print the good news to the user Success("NewUserDo"); } else { // We fail nicely, at least Fail("NewUserDo"); }
NoRequests(); // More than one result is IMPOSSIBLE, didn't we already limit it to 1 on // the SQL query? } elseif ($sel_n > 1) { RuntimeError(); // If there is at least one resend petition, we continue } elseif ($sel_n == 1) { // Reading query result while ($row = mysql_fetch_array($sel_r, MYSQL_ASSOC)) { // Getting user info to use it on mail $uid = $row['uid']; $mail = $row['mail']; $token = $row['token']; $givenName = $row['givenName']; // Sending e-mail ... $send = AssistedEMail("ResendMailDo", $mail); // If the mailing went OK ... if ($send) { // We log the event WriteLog("ResendMailDo"); // Print the good news to the user Success("ResendMailDo"); } else { // We fail nicely, at least Fail("ResendMailDo"); } } } } // Closing the connection $mysqlx = AssistedMYSQLClose($mysqlc);
// provided wrong 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 deletion } elseif ($result_count == 1) { // Assigning DN to delete $dn = $search_entries[0]["dn"]; // Deleting ... $del = AssistedLDAPDelete($ldapc, $dn); // If the deleting went OK, we send the notification e-mail to the user if ($del) { $send = AssistedEMail("DeleteUserDo", $mail); } // If the mailing went OK ... if ($send) { // We log the event WriteLog("DeleteUserDo"); // Print the good news to the user Success("DeleteUserDo"); } else { // We fail nicely, at least Fail("DeleteUserDo"); } } } // Closing the connection $ldapx = AssistedLDAPClose($ldapc);
} elseif ($result_count == 1) { $val_q = 'DESCRIBE ResetPassword'; // Let's see if our table exists $val_r = AssistedMYSQLQuery($val_q); // Create the table if we don't have it if (!$val_r) { require_once "./libraries/CreatePasswordTable.inc.php"; } // We build up our query to insert the user data into a temporary MYSQL Database // while the user gets the confirmation e-mail and clicks the link $ins_q = sprintf("INSERT INTO ResetPassword " . "(uid, mail, token, description) " . "VALUES ('%s', '%s', '%s', '%s')", mysql_real_escape_string($uid), mysql_real_escape_string($mail), mysql_real_escape_string($newtoken), mysql_real_escape_string($description)); // Inserting the row on the table ... $ins_r = AssistedMYSQLQuery($ins_q); // If the insert went OK, we send the notification e-mail to the user if ($ins_r) { $send = AssistedEMail("ResetPasswordMail", $mail); } // If the mailing went OK ... if ($send) { // We log the event WriteLog("ResetPasswordMail"); // Print the good news to the user Success("ResetPasswordMail"); } else { // We fail nicely, at least Fail("ResetPasswordMail"); } } } // Closing the connection $ldapx = AssistedLDAPClose($ldapc);