$users_to_insert = $user_id_error = array(); if (is_array($errors)) { foreach ($errors as $my_errors) { $user_id_error[] = $my_errors['UserName']; } } if (is_array($users)) { foreach ($users as $my_user) { if (!in_array($my_user['UserName'], $user_id_error)) { $users_to_insert[] = $my_user; } } } $inserted_in_course = array(); if (strcmp($file_type, 'csv') === 0) { updateUsers($users_to_insert); } if (count($errors) > 0) { $see_message_import = get_lang('FileImportedJustUsersThatAreNotRegistered'); } else { $see_message_import = get_lang('FileImported'); } if (count($errors) != 0) { $warning_message = '<ul>'; foreach ($errors as $index => $error_user) { $warning_message .= '<li><b>' . $error_user['error'] . '</b>: '; $warning_message .= '<strong>' . $error_user['UserName'] . '</strong> (' . api_get_person_name($error_user['FirstName'], $error_user['LastName']) . ')'; $warning_message .= '</li>'; } $warning_message .= '</ul>'; }
} else { $responseOK = send_email($generalConfig); outputStatus('Email sent status: ' . $responseOK); $counter[$section]++; } usleep(10); //die(' one ok '); } usleep(10); } } //die('finished one session'); // update the last sent values if NOT in test mode otherwise just dont do this outputStatus('Update DB (last_sent) '); if (USE_TEST_MAIL_ARRAY == FALSE) { updateUsers($liveDB, $idsToUpdate); } // clear lists $finalResults = array(); $idsToUpdate = array(); outputStatus('Fetch more alerts from DB ... '); } outputStatus('Try next section '); } outputStatus('Try next region '); } outputStatus('Finish retention backend. '); outputStatus('Creating report. '); $to = array('*****@*****.**'); $time_s = date("d/m/y : H:i:s", time()); $total = $counter['realestate'] + $counter['jobs'] + $counter['vehicles'];
function updateDatabase($data, $database) { updateGames($data, $database); updateUsers($data, $database); }
function create_fake_db($formattedFieldList) { $extIdField = Config::getInstance()->getValue(Config::id_customField_ExtId); $stProjTypeProject = Config::getInstance()->getValue(Config::id_externalTasksProject); // 1 updateUsers(); updateTeams(); updateProjects(); echo "- Clean issues...\n"; flush(); $j = 0; // all prj except SideTasksProjects (and externalTasksPrj) $resProjects = execQuery("SELECT * from `mantis_project_table` WHERE id NOT IN (SELECT DISTINCT project_id FROM `codev_team_project_table` WHERE type = {$stProjTypeProject})"); while ($rowPrj = SqlWrapper::getInstance()->sql_fetch_object($resProjects)) { $projid = $rowPrj->id; if ($stProjTypeProject === $projid) { continue; } // skip externalTasksPrj // change project name execQuery("UPDATE `mantis_project_table` SET `name`='Project_" . $projid . "' where `id`='{$projid}'"); $j++; execQuery("DELETE FROM `mantis_email_table` "); // clean project issues $result1 = execQuery("SELECT * from `mantis_bug_table` WHERE `project_id`='{$projid}'"); $i = 0; while ($row = SqlWrapper::getInstance()->sql_fetch_object($result1)) { $i++; #echo "process project $projid issue $row->id"; $query = "UPDATE `mantis_bug_table` SET `summary`='task p" . $projid . "_" . $row->id . " ' WHERE `id`='{$row->id}' "; execQuery($query); $query = "UPDATE `mantis_bug_text_table` SET `description`='this is a fake issue...' WHERE `id`='{$row->bug_text_id}' "; execQuery($query); $query = "DELETE FROM `mantis_bugnote_table` WHERE `bug_id`='{$row->id}' "; execQuery($query); $query = "UPDATE `mantis_bug_revision_table` SET `value` = 'revision on fake issue' WHERE `bug_id`='{$row->id}' "; execQuery($query); $query = "DELETE FROM `mantis_bug_history_table` WHERE `bug_id`='{$row->id}' AND `field_name` IN ({$formattedFieldList})"; execQuery($query); $query = "UPDATE `mantis_custom_field_string_table` SET `value`='R" . $projid * 2 . $i * 231 . "' WHERE `field_id`='" . $extIdField . "' AND `bug_id`='{$row->id}' AND `value` <> '' "; execQuery($query); } // issue } // proj // commands echo "- Clean commands...\n"; flush(); execQuery("UPDATE codev_command_table SET `reporter` = 'Joe the customer'"); execQuery("UPDATE codev_command_table SET `description` = 'fake description...'"); $result1 = execQuery("SELECT * from `codev_command_table`"); $i = 0; while ($row = SqlWrapper::getInstance()->sql_fetch_object($result1)) { $i++; execQuery("UPDATE codev_command_table set `name` = 'cmd_{$row->id}' WHERE `id` ='{$row->id}' "); execQuery("UPDATE codev_command_table set `reference` = 'Ref_{$row->id}" . $i * 4 . "' WHERE `id` ='{$row->id}'"); // $query = "UPDATE `codev_command_table` SET `cost` = '".($i*123+1001200)."00' WHERE `id` ='$row->id' "; // execQuery($query); } // commandSets execQuery("UPDATE `codev_commandset_table` SET `description` = 'fake description...'"); $result1 = execQuery("SELECT * from `codev_commandset_table`"); $i = 0; while ($row = SqlWrapper::getInstance()->sql_fetch_object($result1)) { $i++; execQuery("UPDATE codev_commandset_table set `name` = 'cset_{$row->id}' WHERE `id` ='{$row->id}'"); execQuery("UPDATE codev_commandset_table SET `reference` = 'Ref_{$row->id}" . $i * 3 . "' WHERE `id` ='{$row->id}' "); //$query = "UPDATE `codev_commandset_table` SET `budget` = '".($i*623+2001200)."50' WHERE `id` ='$row->id' "; //execQuery($query); } // ServiceContract execQuery("UPDATE `codev_servicecontract_table` SET `reporter` = 'Joe the customer'"); execQuery("UPDATE `codev_servicecontract_table` SET `description` = 'fake description...'"); $result1 = execQuery("SELECT * from `codev_servicecontract_table`"); $i = 0; while ($row = SqlWrapper::getInstance()->sql_fetch_object($result1)) { $i++; execQuery("UPDATE codev_servicecontract_table set `name` = 'sc_{$row->id}' WHERE `id` ='{$row->id}'"); execQuery("UPDATE codev_servicecontract_table SET `reference` = 'OTP_{$row->id}" . $i * 3 . "' WHERE `id` ='{$row->id}' "); } }
<input type="text" name="fullname"></label> <label for="">Username <input type="text" name="username"></label> <label for="">Password <input type="password" name="password"></label> <label for="">Email <input type="text" name="email"></label> <input type="submit" name="submit"> </form> <?php if (isset($_POST['submit'])) { updateUsers(); } ?> </div> </div> <script src="bower_components/jquery/dist/jquery.min.js"></script> <script src="bower_components/foundation/js/foundation.min.js"></script> <script src="js/app.js"></script> </body> </html>