<?php // Prevent to be loaded directly if (!isset($allowed_ops)) { die("ERROR"); } require_once "./setup/config.php"; require_once "./libraries/Locale.inc.php"; require_once "./libraries/MYSQLConnection.inc.php"; require_once "./libraries/Functions.inc.php"; $create_q = sprintf('CREATE DATABASE IF NOT EXISTS %s', mysql_real_escape_string($mysql_dbname)); $create_r = AssistedMYSQLQuery($create_q);
$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"); } } } } } // Closing the connection $ldapx = AssistedLDAPClose($ldapc); // Closing the connection
InvalidEMail(); } else { $val_q = 'DESCRIBE NewUser'; // 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/CreateUserTable.inc.php"; } // Encoding the password $userPassword = EncodePassword($userPassword, $ldap_enc); // 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 NewUser " . "(uid, givenName, sn, mail, userPassword, description, token) " . "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", mysql_real_escape_string($uid), mysql_real_escape_string($givenName), mysql_real_escape_string($sn), mysql_real_escape_string($mail), mysql_real_escape_string($userPassword), mysql_real_escape_string($description), mysql_real_escape_string($newtoken)); // 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("NewUserMail", $mail); } // If the mailing went OK ... if ($send) { // We log the event WriteLog("NewUserMail"); // Print the good news to the user Success("NewUserMail"); } else { // We fail nicely, at least Fail("NewUserMail"); } }