} $_POST['password'] = lovd_createPasswordHash($_POST['password_1']); if (ACTION == 'register') { $_POST['password_force_change'] = 0; $_POST['level'] = LEVEL_SUBMITTER; $_POST['login_attempts'] = 0; $aFields[] = 'last_login'; $_POST['last_login'] = $_POST['created_date'] = date('Y-m-d H:i:s'); } if (ACTION == 'create') { $_POST['login_attempts'] = $_POST['locked'] ? 3 : 0; $aFields[] = 'created_by'; $_POST['created_by'] = $_AUTH['id']; } $_POST['created_date'] = date('Y-m-d H:i:s'); $nID = $_DATA->insertEntry($_POST, $aFields); if (ACTION == 'register') { // Store that user has been created by himself. $_DB->query('UPDATE ' . TABLE_USERS . ' SET created_by = id WHERE id = ?', array($nID)); // Load authorization. $_SESSION['auth'] = $_DB->query('SELECT * FROM ' . TABLE_USERS . ' WHERE id = ?', array($nID))->fetchAssoc(); $_AUTH =& $_SESSION['auth']; // To prevent notices in the header for instance... $_AUTH['curates'] = array(); $_AUTH['collaborates'] = array(); // Write to log... lovd_writeLog('Event', LOG_EVENT, $_SERVER['REMOTE_ADDR'] . ' (' . gethostbyaddr($_SERVER['REMOTE_ADDR']) . ') successfully created own submitter account with ID ' . $nID); } else { // Write to log... lovd_writeLog('Event', LOG_EVENT, 'Created user ' . $nID . ' - ' . $_POST['username'] . ' (' . $_POST['name'] . ') - with level ' . $_SETT['user_levels'][$_POST['level']]); }