/** * Replace the default SetError * @param $msg (string) error message * @public * @return void */ public function SetError($msg) { $this->error_count++; $this->ErrorInfo = $msg; F_print_error('ERROR', $msg); exit; }
/** * Check Form Fields. * see: F_check_required_fields, F_check_fields_format * @return false in case of error, true otherwise */ function F_check_form_fields() { require_once '../config/tce_config.php'; global $l; $formfields = F_decode_form_fields(); //decode form fields //check missing fields if ($missing_fields = F_check_required_fields($formfields)) { F_print_error('WARNING', $l['m_form_missing_fields'] . ': ' . $missing_fields); F_stripslashes_formfields(); return FALSE; } //check fields format if ($wrong_fields = F_check_fields_format($formfields)) { F_print_error('WARNING', $l['m_form_wrong_fields'] . ': ' . $wrong_fields); F_stripslashes_formfields(); return FALSE; } return TRUE; }
/** * Add a new question if not exist. * @private */ private function addQuestion() { global $l, $db; require_once '../config/tce_config.php'; if ($this->level_data['module']['module_id'] === false) { return; } if ($this->level_data['subject']['subject_id'] === false) { return; } if (isset($this->level_data['question']['question_id']) and $this->level_data['question']['question_id'] > 0) { return; } // check if this question already exist $sql = 'SELECT question_id FROM ' . K_TABLE_QUESTIONS . ' WHERE '; if (K_DATABASE_TYPE == 'ORACLE') { $sql .= 'dbms_lob.instr(question_description,\'' . $this->level_data['question']['question_description'] . '\',1,1)>0'; } else { $sql .= 'question_description=\'' . $this->level_data['question']['question_description'] . '\''; } $sql .= ' AND question_subject_id=' . $this->level_data['subject']['subject_id'] . ' LIMIT 1'; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { // get existing question ID $this->level_data['question']['question_id'] = $m['question_id']; return; } } else { F_display_db_error(); } if (K_DATABASE_TYPE == 'MYSQL') { // this section is to avoid the problems on MySQL string comparison $maxkey = 240; $strkeylimit = min($maxkey, strlen($this->level_data['question']['question_description'])); $stop = $maxkey / 3; while (in_array(md5(strtolower(substr($this->level_data['subject']['subject_id'] . $this->level_data['question']['question_description'], 0, $strkeylimit))), $this->questionhash) and $stop > 0) { // a similar question was already imported from this XML, so we change it a little bit to avoid duplicate keys $this->level_data['question']['question_description'] = '_' . $this->level_data['question']['question_description']; $strkeylimit = min($maxkey, $strkeylimit + 1); $stop--; // variable used to avoid infinite loop } if ($stop == 0) { F_print_error('ERROR', 'Unable to get unique question ID'); return; } } $sql = 'START TRANSACTION'; if (!($r = F_db_query($sql, $db))) { F_display_db_error(); } // insert question $sql = 'INSERT INTO ' . K_TABLE_QUESTIONS . ' ( question_subject_id, question_description, question_explanation, question_type, question_difficulty, question_enabled, question_position, question_timer, question_fullscreen, question_inline_answers, question_auto_next ) VALUES ( ' . $this->level_data['subject']['subject_id'] . ', \'' . $this->level_data['question']['question_description'] . '\', ' . F_empty_to_null($this->level_data['question']['question_explanation']) . ', \'' . $this->qtype[$this->level_data['question']['question_type']] . '\', \'' . $this->level_data['question']['question_difficulty'] . '\', \'' . $this->boolval[$this->level_data['question']['question_enabled']] . '\', ' . F_zero_to_null($this->level_data['question']['question_position']) . ', \'' . $this->level_data['question']['question_timer'] . '\', \'' . $this->boolval[$this->level_data['question']['question_fullscreen']] . '\', \'' . $this->boolval[$this->level_data['question']['question_inline_answers']] . '\', \'' . $this->boolval[$this->level_data['question']['question_auto_next']] . '\' )'; if (!($r = F_db_query($sql, $db))) { F_display_db_error(false); } else { // get new question ID $this->level_data['question']['question_id'] = F_db_insert_id($db, K_TABLE_QUESTIONS, 'question_id'); if (K_DATABASE_TYPE == 'MYSQL') { $this->questionhash[] = md5(strtolower(substr($this->level_data['subject']['subject_id'] . $this->level_data['question']['question_description'], 0, $strkeylimit))); } } $sql = 'COMMIT'; if (!($r = F_db_query($sql, $db))) { F_display_db_error(); } }
} break; case 'add': // Add if ($formstatus = F_check_form_fields()) { // check submitted form fields // check for loop connection if ($cab_a_obj_id == $cab_b_obj_id) { F_print_error('WARNING', $l['m_connection_loop']); $formstatus = false; F_stripslashes_formfields(); break; } // check if the connection is unique if (!F_check_unique(K_TABLE_CABLES, 'cab_a_obj_id=' . $cab_a_obj_id . ' AND cab_b_obj_id=' . $cab_b_obj_id . ' AND cab_cbt_id=' . $cab_cbt_id)) { F_print_error('WARNING', $l['m_duplicate_connection']); $formstatus = false; F_stripslashes_formfields(); break; } $sql = 'INSERT INTO ' . K_TABLE_CABLES . ' ( cab_a_obj_id, cab_b_obj_id, cab_cbt_id, cab_color ) VALUES ( ' . $cab_a_obj_id . ', ' . $cab_b_obj_id . ', ' . $cab_cbt_id . ', \'' . F_escape_sql($cab_color) . '\' )';
/** * Display login page. * NOTE: This function calls exit() after execution. */ function F_login_form() { global $l, $thispage_title; global $xuser_name, $xuser_password; require_once '../config/tce_config.php'; require_once '../../shared/config/tce_httpbasic.php'; if (K_HTTPBASIC_ENABLED and (!isset($_SESSION['logout']) or !$_SESSION['logout'])) { // force HTTP Basic Authentication header('WWW-Authenticate: Basic realm="TCExam"'); header('HTTP/1.0 401 Unauthorized'); require_once '../code/tce_page_header.php'; F_print_error('WARNING', $l['m_authorization_denied']); require_once '../code/tce_page_footer.php'; exit; //break page here } require_once '../../shared/code/tce_functions_form.php'; $thispage_title = $l['t_login_form']; //set page title require_once '../code/tce_page_header.php'; echo F_loginForm($_SERVER['SCRIPT_NAME'], 'form_login', 'post', 'multipart/form-data', $xuser_name, $xuser_password, 20); require_once '../code/tce_page_footer.php'; exit; //break page here }
usrgrp_group_id ) VALUES ( \'' . $user_id . '\', \'' . $group_id . '\' )'; if (!($r = F_db_query($sql, $db))) { F_display_db_error(false); } } if (K_USRREG_EMAIL_CONFIRM) { // require email confirmation require_once '../../shared/code/tce_functions_user_registration.php'; F_send_user_reg_email($user_id, $user_email, $user_verifycode); F_print_error('MESSAGE', $user_email . ': ' . $l['m_user_verification_sent']); } else { F_print_error('MESSAGE', $l['m_user_registration_ok']); echo K_NEWLINE; } echo '<div class="container">' . K_NEWLINE; echo '<strong><a href="index.php" title="' . $l['h_index'] . '">' . $l['h_index'] . ' ></a></strong>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; exit; } } } //end of add // --- Initialize variables if (isset($_REQUEST['user_name'])) { $user_name = htmlspecialchars($_REQUEST['user_name'], ENT_COMPAT, $l['a_meta_charset']); } else {
$sts_id = 0; $rck_id = 0; } else { if (isset($_REQUEST['sts_id']) and (!isset($_REQUEST['change_datacenter']) or empty($_REQUEST['change_datacenter']))) { $sts_id = intval($_REQUEST['sts_id']); $sts_perm = F_getUserPermission($user_id, K_TABLE_SUITE_GROUPS, $sts_id); if ($sts_perm == 0) { F_print_error('ERROR', $l['m_not_authorized_to_view']); $sts_id = 0; $rck_id = 0; } else { if (isset($_REQUEST['rck_id']) and (!isset($_REQUEST['change_suite']) or empty($_REQUEST['change_suite']))) { $rck_id = intval($_REQUEST['rck_id']); $user_permissions = F_getUserPermission($user_id, K_TABLE_RACK_GROUPS, $rck_id); if ($user_permissions == 0) { F_print_error('ERROR', $l['m_not_authorized_to_view']); $rck_id = 0; } } else { $rck_id = 0; } } } else { $sts_id = 0; $rck_id = 0; } } } else { $dcn_id = 0; $sts_id = 0; $rck_id = 0;
cpsession_id, cpsession_expiry, cpsession_data ) VALUES ( \'' . $fingerprintkey . '\', \'' . date(K_TIMESTAMP_FORMAT, time() + $wait) . '\', \'' . $wait . '\' )'; if (!F_db_query($sqls, $db)) { F_display_db_error(); } $bruteforce = false; } } if ($bruteforce) { F_print_error('WARNING', $l['m_login_brute_force'] . ' ' . $wait); } else { $xuser_password = getPasswordHash($_POST['xuser_password']); // one-way password encoding // check if submitted login information are correct $sql = 'SELECT * FROM ' . K_TABLE_USERS . ' WHERE user_name=\'' . F_escape_sql($_POST['xuser_name']) . '\' AND user_password=\'' . $xuser_password . '\''; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { // check One Time Password $otp = false; if (K_OTP_LOGIN) { $mtime = microtime(true); if (isset($_POST['xuser_otpcode']) and !empty($_POST['xuser_otpcode']) and ($_POST['xuser_otpcode'] == F_getOTP($m['user_otpkey'], $mtime) or $_POST['xuser_otpcode'] == F_getOTP($m['user_otpkey'], $mtime - 30) or $_POST['xuser_otpcode'] == F_getOTP($m['user_otpkey'], $mtime + 30))) { // check if this OTP token has been alredy used $sqlt = 'SELECT cpsession_id FROM ' . K_TABLE_SESSIONS . ' WHERE cpsession_id=\'' . $_POST['xuser_otpcode'] . '\' LIMIT 1'; if ($rt = F_db_query($sqlt, $db)) {
$enddate = ''; } if (isset($_REQUEST['mode']) and $_REQUEST['mode'] > 0) { $mode = intval($_REQUEST['mode']); } else { $mode = 0; } if (isset($_REQUEST['display_mode'])) { $display_mode = max(0, min(5, intval($_REQUEST['display_mode']))); } else { $display_mode = 0; } if (isset($_REQUEST['show_graph'])) { $show_graph = intval($_REQUEST['show_graph']); if ($show_graph and $display_mode == 0) { $display_mode = 1; } } else { $show_graph = 0; } require_once 'tce_functions_email_reports.php'; echo '<div class="pagehelp">' . $l['hp_sending_in_progress'] . '</div>' . K_NEWLINE; flush(); // force browser output F_send_report_emails($test_id, $user_id, $testuser_id, $group_id, $startdate, $enddate, $mode, $display_mode, $show_graph); F_print_error('MESSAGE', $l['m_process_completed']); echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; //============================================================+ // END OF FILE //============================================================+
case 'deldir': F_stripslashes_formfields(); // Delete if ($_SESSION['session_user_level'] < K_AUTH_ADMIN_DIRS) { F_print_error('WARNING', $l['m_authorization_denied']); break; } if (!F_isAuthorizedDir($dir, $root_dir, $authdirs)) { F_print_error('WARNING', $l['m_authorization_denied']); break; } if (F_deleteMediaDir($dir)) { $dir = $root_dir; F_print_error('MESSAGE', $l['m_deleted']); } else { F_print_error('ERROR', $l['m_delete_file_error']); } break; default: break; } //end of switch echo '<div class="container">' . K_NEWLINE; echo '<div class="contentbox">' . K_NEWLINE; echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_filemanager">' . K_NEWLINE; echo '<div>' . K_NEWLINE; echo '<input type="hidden" name="frm" id="frm" value="' . $callingform . '" />' . K_NEWLINE; echo '<input type="hidden" name="fld" id="fld" value="' . $callingfield . '" />' . K_NEWLINE; // current dir echo '<input type="hidden" name="d" id="d" value="' . $dir . '" />' . K_NEWLINE; echo '<fieldset>' . K_NEWLINE;
F_display_db_error(false); break; } } break; case 'add': // Add if ($formstatus = F_check_form_fields()) { // check if alternate key is unique if (K_DATABASE_TYPE == 'ORACLE') { $chksql = 'dbms_lob.instr(question_description,\'' . F_escape_sql($question_description) . '\',1,1)>0'; } else { $chksql = 'question_description=\'' . F_escape_sql($question_description) . '\''; } if (!F_check_unique(K_TABLE_QUESTIONS, $chksql . ' AND question_subject_id=' . $question_subject_id . '')) { F_print_error('WARNING', $l['m_duplicate_question']); $formstatus = FALSE; F_stripslashes_formfields(); break; } $sql = 'START TRANSACTION'; if (!($r = F_db_query($sql, $db))) { F_display_db_error(false); break; } // adjust questions ordering if ($question_position > 0) { $sql = 'UPDATE ' . K_TABLE_QUESTIONS . ' SET question_position=question_position+1 WHERE question_subject_id=' . $question_subject_id . ' AND question_position>=' . $question_position . '';
} else { $sts_id = 0; $rck_id = 0; } } } else { $dcn_id = 0; $sts_id = 0; $rck_id = 0; } // selected or default object if (isset($_REQUEST['obj_id']) and (!isset($_REQUEST['change_datacenter']) or empty($_REQUEST['change_datacenter'])) and (!isset($_REQUEST['change_suite']) or empty($_REQUEST['change_suite'])) and (!isset($_REQUEST['change_rack']) or empty($_REQUEST['change_rack']))) { $obj_id = intval($_REQUEST['obj_id']); $user_permissions = F_getUserPermission($user_id, K_TABLE_OBJECT_GROUPS, $obj_id); if ($user_permissions == 0) { F_print_error('ERROR', $l['m_not_authorized_to_edit']); $obj_id = 0; } if ($obj_id > 0 and ($dcn_id == 0 or $sts_id == 0 or $rck_id == 0)) { // retrive location values $sql = 'SELECT dcn_id, sts_id, rck_id FROM ' . K_TABLE_DATACENTERS . ', ' . K_TABLE_SUITES . ', ' . K_TABLE_RACKS . ', ' . K_TABLE_LOCATIONS . ', ' . K_TABLE_OBJECTS . ' WHERE loc_obj_id=obj_id AND loc_rack_id=rck_id AND rck_sts_id=sts_id AND sts_dcn_id=dcn_id AND obj_id=' . $obj_id . ' LIMIT 1'; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { $dcn_id = $m['dcn_id']; $sts_id = $m['sts_id']; $rck_id = $m['rck_id']; } } else { F_display_db_error();
/** * returns the file size in bytes * @author Nicola Asuni * @since 2001-11-19 * @param $filetocheck (string) file to check (local path or URL) * @return mixed file size in bytes or false in case of error */ function F_read_file_size($filetocheck) { global $l; require_once '../config/tce_config.php'; $filesize = 0; if ($fp = fopen($filetocheck, 'rb')) { $s_array = fstat($fp); if ($s_array['size']) { $filesize = $s_array['size']; } else { //read size from remote file (very slow function) while (!feof($fp)) { $content = fread($fp, 1); $filesize++; } } fclose($fp); return $filesize; } F_print_error('ERROR', basename($filetocheck) . ': ' . $l['m_openfile_not']); return FALSE; }
/** * Custom PHP error handler function. * @param $errno (int) The first parameter, errno, contains the level of the error raised, as an integer. * @param $errstr (string) The second parameter, errstr, contains the error message, as a string. * @param $errfile (string) The third parameter is optional, errfile, which contains the filename that the error was raised in, as a string. * @param $errline (int) The fourth parameter is optional, errline, which contains the line number the error was raised at, as an integer. */ function F_error_handler($errno, $errstr, $errfile, $errline) { if (ini_get('error_reporting') == 0) { // this is required to ignore supressed error messages with '@' return; } $messagetoprint = '[' . $errno . '] ' . $errstr . ' | LINE: ' . $errline . ' | FILE: ' . $errfile . ''; switch ($errno) { case E_ERROR: case E_USER_ERROR: F_print_error('ERROR', $messagetoprint, true); break; case E_WARNING: case E_USER_WARNING: F_print_error('ERROR', $messagetoprint, false); break; case E_NOTICE: case E_USER_NOTICE: default: F_print_error('WARNING', $messagetoprint, false); break; } }
/** * Custom PHP error handler function. * @param $errno (int) The first parameter, errno, contains the level of the error raised, as an integer. * @param $errstr (string) The second parameter, errstr, contains the error message, as a string. * @param $errfile (string) The third parameter is optional, errfile, which contains the filename that the error was raised in, as a string. * @param $errline (int) The fourth parameter is optional, errline, which contains the line number the error was raised at, as an integer. */ function F_error_handler($errno, $errstr, $errfile, $errline) { $messagetoprint = '[' . $errno . '] ' . $errstr . ' | LINE: ' . $errline . ' | FILE: ' . $errfile . ''; switch ($errno) { case E_ERROR: case E_USER_ERROR: F_print_error('ERROR', $messagetoprint, true); break; case E_WARNING: case E_USER_WARNING: F_print_error('ERROR', $messagetoprint, false); break; case E_NOTICE: case E_USER_NOTICE: default: F_print_error('WARNING', $messagetoprint, false); break; } }
/** * Display user selection XHTML table (popup mode). * @author Nicola Asuni * @since 2012-04-14 * @param $order_field (string) Order by column name. * @param $orderdir (int) Order direction. * @param $firstrow (int) Number of first row to display. * @param $rowsperpage (int) Number of rows per page. * @param $group_id (int) ID of the group (default = 0 = no specific group selected). * @param $andwhere (string) Additional SQL WHERE query conditions. * @param $searchterms (string) Search terms. * @param string $cid ID of the calling form field. * @return false in case of empty database, true otherwise */ function F_show_select_user_popup($order_field, $orderdir, $firstrow, $rowsperpage, $group_id = 0, $andwhere = '', $searchterms = '', $cid = 0) { global $l, $db; require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_page.php'; require_once '../../shared/code/tce_functions_form.php'; $filter = 'cid=' . $cid; if ($l['a_meta_dir'] == 'rtl') { $txtalign = 'right'; $numalign = 'left'; } else { $txtalign = 'left'; $numalign = 'right'; } $order_field = F_escape_sql($db, $order_field); $orderdir = intval($orderdir); $firstrow = intval($firstrow); $rowsperpage = intval($rowsperpage); $group_id = intval($group_id); if (empty($order_field) or !in_array($order_field, array('user_id', 'user_name', 'user_password', 'user_email', 'user_regdate', 'user_ip', 'user_firstname', 'user_lastname', 'user_birthdate', 'user_birthplace', 'user_regnumber', 'user_ssn', 'user_level', 'user_verifycode'))) { $order_field = 'user_lastname,user_firstname'; } if ($orderdir == 0) { $nextorderdir = 1; $full_order_field = $order_field; } else { $nextorderdir = 0; $full_order_field = $order_field . ' DESC'; } if (!F_count_rows(K_TABLE_USERS)) { // if the table is void (no items) display message F_print_error('MESSAGE', $l['m_databasempty']); return FALSE; } $wherequery = ''; if ($group_id > 0) { $wherequery = ', ' . K_TABLE_USERGROUP . ' WHERE user_id=usrgrp_user_id AND usrgrp_group_id=' . $group_id . ''; $filter .= '&group_id=' . $group_id . ''; } if (empty($wherequery)) { $wherequery = ' WHERE'; } else { $wherequery .= ' AND'; } $wherequery .= ' (user_id>1)'; if ($_SESSION['session_user_level'] < K_AUTH_ADMINISTRATOR) { // filter for level $wherequery .= ' AND ((user_level<' . $_SESSION['session_user_level'] . ') OR (user_id=' . $_SESSION['session_user_id'] . '))'; // filter for groups $wherequery .= ' AND user_id IN (SELECT tb.usrgrp_user_id FROM ' . K_TABLE_USERGROUP . ' AS ta, ' . K_TABLE_USERGROUP . ' AS tb WHERE ta.usrgrp_group_id=tb.usrgrp_group_id AND ta.usrgrp_user_id=' . intval($_SESSION['session_user_id']) . ' AND tb.usrgrp_user_id=user_id)'; } if (!empty($andwhere)) { $wherequery .= ' AND (' . $andwhere . ')'; } $sql = 'SELECT * FROM ' . K_TABLE_USERS . $wherequery . ' ORDER BY ' . $full_order_field; if (K_DATABASE_TYPE == 'ORACLE') { $sql = 'SELECT * FROM (' . $sql . ') WHERE rownum BETWEEN ' . $firstrow . ' AND ' . ($firstrow + $rowsperpage) . ''; } else { $sql .= ' LIMIT ' . $rowsperpage . ' OFFSET ' . $firstrow . ''; } if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { // -- Table structure with links: echo '<div class="container">'; echo '<table class="userselect" style="font-size:80%;">' . K_NEWLINE; // table header echo '<tr>' . K_NEWLINE; if (strlen($searchterms) > 0) { $filter .= '&searchterms=' . urlencode($searchterms); } echo F_select_table_header_element('user_name', $nextorderdir, $l['h_login_name'], $l['w_user'], $order_field, $filter); echo F_select_table_header_element('user_lastname', $nextorderdir, $l['h_lastname'], $l['w_lastname'], $order_field, $filter); echo F_select_table_header_element('user_firstname', $nextorderdir, $l['h_firstname'], $l['w_firstname'], $order_field, $filter); echo F_select_table_header_element('user_email', $nextorderdir, $l['h_email'], $l['w_email'], $order_field, $filter); echo F_select_table_header_element('user_regnumber', $nextorderdir, $l['h_regcode'], $l['w_regcode'], $order_field, $filter); echo F_select_table_header_element('user_level', $nextorderdir, $l['h_level'], $l['w_level'], $order_field, $filter); echo F_select_table_header_element('user_regdate', $nextorderdir, $l['h_regdate'], $l['w_regdate'], $order_field, $filter); //echo '<th title="'.$l['h_group_name'].'">'.$l['w_groups'].'</th>'.K_NEWLINE; echo '</tr>' . K_NEWLINE; $itemcount = 0; do { $itemcount++; // on click the user ID will be returned on the calling form field $jsaction = 'javascript:window.opener.document.getElementById(\'' . $cid . '\').value=' . $m['user_id'] . ';'; $jsaction .= 'window.opener.document.getElementById(\'' . $cid . '\').onchange();'; $jsaction .= 'window.close();'; echo '<tr>' . K_NEWLINE; echo '<td style="text-align:' . $txtalign . ';"> <a href="#" onclick="' . $jsaction . '" title="[' . $l['w_select'] . ']">' . htmlspecialchars($m['user_name'], ENT_NOQUOTES, $l['a_meta_charset']) . '</a></td>' . K_NEWLINE; echo '<td style="text-align:' . $txtalign . ';"> ' . htmlspecialchars($m['user_lastname'], ENT_NOQUOTES, $l['a_meta_charset']) . '</td>' . K_NEWLINE; echo '<td style="text-align:' . $txtalign . ';"> ' . htmlspecialchars($m['user_firstname'], ENT_NOQUOTES, $l['a_meta_charset']) . '</td>' . K_NEWLINE; echo '<td style="text-align:' . $txtalign . ';"> ' . htmlspecialchars($m['user_email'], ENT_NOQUOTES, $l['a_meta_charset']) . '</td>' . K_NEWLINE; echo '<td style="text-align:' . $txtalign . ';"> ' . htmlspecialchars($m['user_regnumber'], ENT_NOQUOTES, $l['a_meta_charset']) . '</td>' . K_NEWLINE; echo '<td> ' . $m['user_level'] . '</td>' . K_NEWLINE; echo '<td> ' . htmlspecialchars($m['user_regdate'], ENT_NOQUOTES, $l['a_meta_charset']) . '</td>' . K_NEWLINE; /* // comma separated list of user's groups $grp = ''; $sqlg = 'SELECT * FROM '.K_TABLE_GROUPS.', '.K_TABLE_USERGROUP.' WHERE usrgrp_group_id=group_id AND usrgrp_user_id='.$m['user_id'].' ORDER BY group_name'; if ($rg = F_db_query($sqlg, $db)) { while ($mg = F_db_fetch_array($rg)) { $grp .= $mg['group_name'].', '; } } else { F_display_db_error(); } echo '<td style="text-align:'.$txtalign.';"> '.htmlspecialchars(substr($grp,0,-2), ENT_NOQUOTES, $l['a_meta_charset']).'</td>'.K_NEWLINE; */ echo '</tr>' . K_NEWLINE; } while ($m = F_db_fetch_array($r)); echo '</table>' . K_NEWLINE; echo '<input type="hidden" name="order_field" id="order_field" value="' . $order_field . '" />' . K_NEWLINE; echo '<input type="hidden" name="orderdir" id="orderdir" value="' . $orderdir . '" />' . K_NEWLINE; echo '<input type="hidden" name="firstrow" id="firstrow" value="' . $firstrow . '" />' . K_NEWLINE; echo '<input type="hidden" name="rowsperpage" id="rowsperpage" value="' . $rowsperpage . '" />' . K_NEWLINE; echo '<div class="row"><hr /></div>' . K_NEWLINE; // --------------------------------------------------------------- // -- page jumper (menu for successive pages) if ($rowsperpage > 0) { $sql = 'SELECT count(*) AS total FROM ' . K_TABLE_USERS . '' . $wherequery . ''; if (!empty($order_field)) { $param_array = '&order_field=' . urlencode($order_field) . ''; } if (!empty($orderdir)) { $param_array .= '&orderdir=' . $orderdir . ''; } if (!empty($group_id)) { $param_array .= '&group_id=' . $group_id . ''; } if (!empty($searchterms)) { $param_array .= '&searchterms=' . urlencode($searchterms) . ''; } $param_array .= '&submitted=1'; F_show_page_navigator($_SERVER['SCRIPT_NAME'], $sql, $firstrow, $rowsperpage, $param_array); } //echo '<div class="pagehelp">'.$l['hp_select_users'].'</div>'.K_NEWLINE; echo '</div>' . K_NEWLINE; } else { F_print_error('MESSAGE', $l['m_search_void']); } } else { F_display_db_error(); } return TRUE; }
$thispage_title = $l['t_all_results_user']; $enable_calendar = true; require_once 'tce_page_header.php'; require_once '../../shared/code/tce_functions_form.php'; require_once '../../shared/code/tce_functions_tcecode.php'; require_once '../../shared/code/tce_functions_test.php'; require_once '../../shared/code/tce_functions_test_stats.php'; require_once '../../shared/code/tce_functions_auth_sql.php'; require_once '../../shared/code/tce_functions_statistics.php'; $user_id = intval($_SESSION['session_user_id']); $filter = 'user_id=' . $user_id; if (isset($_REQUEST['test_id']) and $_REQUEST['test_id'] > 0) { $test_id = intval($_REQUEST['test_id']); // check user's authorization if (!F_isAuthorizedUser(K_TABLE_TESTS, 'test_id', $test_id, 'test_user_id')) { F_print_error('ERROR', $l['m_authorization_denied']); exit; } $filter .= '&test_id=' . $test_id . ''; $test_group_ids = F_getTestGroups($test_id); } else { $test_id = 0; } if (isset($_REQUEST['selectcategory'])) { $changecategory = 1; } if (isset($_REQUEST['group_id']) and !empty($_REQUEST['group_id'])) { $group_id = intval($_REQUEST['group_id']); $filter .= '&group_id=' . $group_id . ''; } else { $group_id = 0;
break; case 'backup': // backup switch (K_DATABASE_TYPE) { case 'POSTGRESQL': $filename = K_PATH_BACKUP . date('YmdHis') . '_tcexam_backup.tar'; $command = 'export PGUSER="******"; export PGPASSWORD="******"; pg_dump -h' . K_DATABASE_HOST . ' -p' . K_DATABASE_PORT . ' -U' . K_DATABASE_USER_NAME . ' -Ft ' . K_DATABASE_NAME . ' | gzip > ' . $filename . '.gz'; break; case 'MYSQL': default: $filename = K_PATH_BACKUP . date('YmdHis') . '_tcexam_backup.sql'; $command = 'mysqldump --opt -h' . K_DATABASE_HOST . ' -P' . K_DATABASE_PORT . ' -u' . K_DATABASE_USER_NAME . ' -p' . K_DATABASE_USER_PASSWORD . ' ' . K_DATABASE_NAME . ' | gzip > ' . $filename . '.gz'; break; } exec($command); F_print_error('MESSAGE', $l['m_backup_completed']); break; case 'download': if (K_DOWNLOAD_BACKUPS and isset($backup_file) and !empty($backup_file)) { $file_to_download = K_PATH_BACKUP . $backup_file; // send headers header('Content-Description: File Transfer'); header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // force download dialog header('Content-Type: application/force-download'); header('Content-Type: application/octet-stream', false);
$testlog_id = intval($matches[1]); break; } } } } } // confirmation form to terminate the test if (isset($_REQUEST['terminatetest']) and !empty($_REQUEST['terminatetest'])) { // check if some questions were omitted (undisplayed or unanswered). $num_omitted_questions = F_getNumOmittedQuestions($test_id); $omitted_msg = ''; if ($num_omitted_questions > 0) { $omitted_msg = '<br /><span style="color:#990000;font-size:120%;">[ ' . $l['h_questions_unanswered'] . ': ' . $num_omitted_questions . ' ]</span><br />'; } F_print_error('WARNING', $omitted_msg . '' . $l['m_confirm_test_termination']); ?> <div class="confirmbox"> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?> " method="post" enctype="multipart/form-data" id="form_test_terminate"> <div> <input type="hidden" name="testid" id="testid" value="<?php echo $test_id; ?> " /> <input type="hidden" name="testlogid" id="testlogid" value="<?php echo $testlog_id; ?> " />
/** * Display Pages navigation index. * @param $script_name (string) url of the calling page * @param $sql (string) sql used to select records * @param $firstrow (int) first row number * @param $rowsperpage (int) number of max rows per page * @param $param_array (string) parameters to pass on url via GET * @return mixed the number of pages in case of success, FALSE otherwise */ function F_show_page_navigator($script_name, $sql, $firstrow, $rowsperpage, $param_array) { global $l, $db; require_once '../config/tce_config.php'; $max_pages = 4; // max pages to display on page selector $indexbar = ''; // string for selection page html code $firstrow = intval($firstrow); $rowsperpage = intval($rowsperpage); if (!$sql or $rowsperpage < 1) { return FALSE; } if (!($r = F_db_query($sql, $db))) { F_display_db_error(); } // build base url for all links $baseaddress = $script_name; if (empty($param_array)) { $baseaddress .= '?'; } else { $param_array = substr($param_array, 5); // remove first "&" $baseaddress .= '?' . $param_array . '&'; } $count_rows = preg_match('/GROUP BY/i', $sql); //check if query contain a "GROUP BY" $all_updates = F_db_num_rows($r); if ($all_updates == 1 and !$count_rows) { list($all_updates) = F_db_fetch_array($r); } if (!$all_updates) { //no records F_print_error('MESSAGE', $l['m_search_void']); } else { if ($all_updates > $rowsperpage) { $indexbar .= '<div class="pageselector">' . $l['w_page'] . ': '; $page_range = $max_pages * $rowsperpage; if ($firstrow <= $page_range) { $page_range = 2 * $page_range - $firstrow + $rowsperpage; } elseif ($firstrow >= $all_updates - $page_range) { $page_range = 2 * $page_range - ($all_updates - 2 * $rowsperpage - $firstrow); } if ($firstrow >= $rowsperpage) { $indexbar .= '<a href="' . $baseaddress . 'firstrow=0">1</a> | '; $indexbar .= '<a href="' . $baseaddress . 'firstrow=' . ($firstrow - $rowsperpage) . '" title="' . $l['w_previous'] . '"><</a> | '; } else { $indexbar .= '1 | < | '; } $count = 2; $x = 0; for ($x = $rowsperpage; $x < $all_updates - $rowsperpage; $x += $rowsperpage) { if ($x >= $firstrow - $page_range and $x <= $firstrow + $page_range) { if ($x == $firstrow) { $indexbar .= $count . ' | '; } else { $indexbar .= '<a href="' . $baseaddress . 'firstrow=' . $x . '" title="' . $count . '">' . $count . '</a> | '; } } $count++; } if ($firstrow + $rowsperpage < $all_updates) { $indexbar .= '<a href="' . $baseaddress . 'firstrow=' . ($firstrow + $rowsperpage) . '" title="' . $l['w_next'] . '">></a> | '; $indexbar .= '<a href="' . $baseaddress . 'firstrow=' . $x . '" title="' . $count . '">' . $count . '</a>'; } else { $indexbar .= '> | ' . $count; } $indexbar .= '</div>'; } } echo $indexbar; // display the page selector return $all_updates; //return number of records found }
\'' . intval($atb_id) . '\' )'; if (!($r = F_db_query($sql, $db))) { F_display_db_error(false); } } } } break; case 'add': // Add if ($formstatus = F_check_form_fields()) { // check submitted form fields // check if name is unique if (!F_check_unique(K_TABLE_OBJECT_TYPES, 'obt_name=\'' . F_escape_sql($obt_name) . '\'')) { F_print_error('WARNING', $l['m_duplicate_name']); $formstatus = FALSE; F_stripslashes_formfields(); break; } $sql = 'INSERT INTO ' . K_TABLE_OBJECT_TYPES . ' ( obt_name, obt_description, obt_color, obt_virtual ) VALUES ( \'' . F_escape_sql($obt_name) . '\', ' . F_empty_to_null($obt_description) . ', ' . F_empty_to_null($obt_color) . ', \'' . $obt_virtual . '\' )';
case 2: // absolute redirect header('Location: ' . K_PATH_HOST . $_SERVER['SCRIPT_NAME']); break; case 3: // html redirect echo $htmlredir; break; case 4: default: // full redirect header('Location: ' . K_PATH_HOST . $_SERVER['SCRIPT_NAME']); echo $htmlredir; break; } exit; } // check for test password if (isset($_POST['testpswaction']) and $_POST['testpswaction'] == 'login' and isset($_POST['xtest_password']) and isset($_POST['testid'])) { require_once '../../shared/code/tce_functions_test.php'; $tph = F_getTestPassword($_POST['testid']); if (getPasswordHash($_POST['xtest_password']) == $tph) { // test password is correct, save status on a session variable $_SESSION['session_test_login'] = getPasswordHash($tph . $_POST['testid'] . $_SESSION['session_user_id'] . $_SESSION['session_user_ip']); } else { F_print_error('WARNING', $l['m_wrong_test_password']); } } //============================================================+ // END OF FILE //============================================================+
if (isset($testlog_score) and isset($max_score)) { // score cannot be greater than max_score $testlog_score = floatval($testlog_score); $max_score = floatval($max_score); if ($testlog_score > $max_score) { F_print_error('WARNING', $l['m_score_higher_than_max']); break; } $sql = 'UPDATE ' . K_TABLE_TESTS_LOGS . ' SET testlog_score=' . $testlog_score . ', testlog_comment=\'' . F_escape_sql($db, $testlog_comment) . '\' WHERE testlog_id=' . $testlog_id . ''; if (!($r = F_db_query($sql, $db))) { F_display_db_error(false); } else { F_print_error('MESSAGE', $l['m_updated']); $testlog_score = ''; $testlog_id = ''; $testlog_comment = ''; } } } break; default: break; } //end of switch // --- Initialize variables // flag to display/hide user info if (!isset($display_user_info)) { $display_user_info = 0;
} } $script .= $obj_template . "\n"; } } // add footer template $script .= F_get_template($footer_tmp_id); // save script $scriptfile = date('YmdHis') . '_' . md5($script) . '_' . $user_id . '.txt'; if (file_put_contents(K_PATH_CONFIG_SCRIPTS . $scriptfile, $script) !== false) { F_print_error('MESSAGE', $l['m_script_saved'] . ': <a href="' . K_PATH_URL_CONFIG_SCRIPTS . $scriptfile . '" title="' . $l['w_download'] . '" onclick="pdfWindow=window.open(\'' . K_PATH_URL_CONFIG_SCRIPTS . $scriptfile . '\',\'pdfWindow\',\'dependent,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes\'); return false;">' . $scriptfile . '</a>'); if (!empty($missing_tokens)) { F_print_error('ERROR', $l['m_missing_tokens'] . ': ' . substr($missing_tokens, 2)); } } else { F_print_error('ERROR', $l['m_file_save_error'] . ': ' . $scriptfile); } break; default: break; } //end of switch // ----------------------------------------------------------------------------- echo '<div class="container">' . K_NEWLINE; echo '<div class="tceformbox">' . K_NEWLINE; echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_editor">' . K_NEWLINE; // *** selection filter *** echo F_getDataFilter($dcn_id, $sts_id, $rck_id, $obt_id, $obj_owner_id, $obj_tenant_id, $keywords); // display selected objects with checkboxes for selection if ($filtered === true) { echo F_getSelectedObject($dcn_id, $sts_id, $rck_id, $obt_id, $obj_owner_id, $obj_tenant_id, $keywords);
F_print_error('MESSAGE', $l['m_user_registration_ok']); echo K_NEWLINE; echo '<div class="container">' . K_NEWLINE; if (K_OTP_LOGIN) { require_once '../../shared/tcpdf/tcpdf_barcodes_2d.php'; $host = preg_replace('/[h][t][t][p][s]?[:][\\/][\\/]/', '', K_PATH_HOST); $qrcode = new TCPDF2DBarcode('otpauth://totp/' . $m['user_name'] . '@' . $host . '?secret=' . $m['user_otpkey'], 'QRCODE,H'); echo '<p>' . $l['m_otp_qrcode'] . '</p>' . K_NEWLINE; echo '<h2>' . $m['user_otpkey'] . '</h2>' . K_NEWLINE; echo '<div style="margin:40px 40px 40px 40px;">' . K_NEWLINE; echo $qrcode->getBarcodeHTML(6, 6, 'black'); echo '</div>' . K_NEWLINE; } echo '<p><strong><a href="index.php" title="' . $l['h_index'] . '">' . $l['h_index'] . ' ></a></strong></p>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; exit; } } } else { F_display_db_error(false); } F_print_error('ERROR', 'USER VERIFICATION ERROR'); echo K_NEWLINE; echo '<div class="container">' . K_NEWLINE; echo '<strong><a href="index.php" title="' . $l['h_index'] . '">' . $l['h_index'] . ' ></a></strong>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once '../code/tce_page_footer.php'; //============================================================+ // END OF FILE //============================================================+
mt_srand((double) microtime() * 1000000); $user_verifycode = md5(uniqid(mt_rand(), true)); // verification code $sql = 'UPDATE ' . K_TABLE_USERS . ' SET user_email=\'' . F_escape_sql($user_email) . '\', user_level=\'0\', user_verifycode=\'' . $user_verifycode . '\' WHERE user_id=' . $user_id . ' AND user_password=\'' . getPasswordHash($currentpassword) . '\''; if (!($r = F_db_query($sql, $db))) { F_display_db_error(false); } else { F_print_error('MESSAGE', $l['m_email_updated']); // require email confirmation require_once '../../shared/code/tce_functions_user_registration.php'; F_send_user_reg_email($user_id, $user_email, $user_verifycode); F_print_error('MESSAGE', $user_email . ': ' . $l['m_user_verification_sent']); echo '<div class="container">' . K_NEWLINE; echo '<strong><a href="index.php" title="' . $l['h_index'] . '">' . $l['h_index'] . ' ></a></strong>' . K_NEWLINE; echo '</div>' . K_NEWLINE; require_once 'tce_page_footer.php'; exit; } } break; default: break; } //end of switch echo '<div class="container">' . K_NEWLINE; echo '<div class="tceformbox">' . K_NEWLINE; echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_editor">' . K_NEWLINE;
if ($uploadedfile !== false) { $xmlimporter = false; switch ($type) { case 1: // standard TCExam XML format require_once '../code/tce_class_import_xml.php'; $xmlimporter = new XMLQuestionImporter(K_PATH_CACHE . $uploadedfile); break; case 2: // Custom TCExam XML format require_once '../code/tce_import_custom.php'; $xmlimporter = new CustomQuestionImporter(K_PATH_CACHE . $uploadedfile); break; } if ($xmlimporter) { F_print_error('MESSAGE', $l['m_importing_complete']); } } } } echo '<div class="container">' . K_NEWLINE; echo '<div class="tceformbox">' . K_NEWLINE; echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_importquestions">' . K_NEWLINE; echo '<div class="row">' . K_NEWLINE; echo '<span class="label">' . K_NEWLINE; echo '<label for="userfile">' . $l['w_upload_file'] . '</label>' . K_NEWLINE; echo '</span>' . K_NEWLINE; echo '<span class="formw">' . K_NEWLINE; echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . K_MAX_UPLOAD_SIZE . '" />' . K_NEWLINE; echo '<input type="file" name="userfile" id="userfile" size="20" title="' . $l['h_upload_file'] . '" />' . K_NEWLINE; echo '</span>' . K_NEWLINE;
$info['type'] = 'ILO'; $info['name'] = 'ILO'; } } if (!empty($info['serial'])) { $retdata[$info['serial']] = $info; } } } } // delete uploaded file unlink($datafile); // DEBUG print_r($retdata); exit; // get number of records $num_items = count($retdata); F_print_error('MESSAGE', $l['m_items_found'] . ': ' . $num_items); // get ID of MAC attribute type $sql = 'SELECT atb_id FROM ' . K_TABLE_ATTRIBUTE_TYPES . ' WHERE atb_name=\'MAC\' LIMIT 1'; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { $mac_type_id = $m['atb_id']; } } else { F_display_db_error(); } // get ID of IP attribute type $sql = 'SELECT atb_id FROM ' . K_TABLE_ATTRIBUTE_TYPES . ' WHERE atb_name=\'IP\' LIMIT 1'; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { $ip_type_id = $m['atb_id']; }
echo '<meta name="language" content="' . $l['a_meta_language'] . '" />' . K_NEWLINE; echo '<meta name="tcexam_level" content="' . $pagelevel . '" />' . K_NEWLINE; echo '<meta name="description" content="' . htmlspecialchars($thispage_description, ENT_COMPAT, $l['a_meta_charset']) . ' [' . base64_decode(K_KEY_SECURITY) . ']" />' . K_NEWLINE; echo '<meta name="author" content="nick"/>' . K_NEWLINE; echo '<meta name="reply-to" content="' . htmlspecialchars($thispage_reply, ENT_COMPAT, $l['a_meta_charset']) . '" />' . K_NEWLINE; echo '<meta name="keywords" content="' . htmlspecialchars($thispage_keywords, ENT_COMPAT, $l['a_meta_charset']) . '" />' . K_NEWLINE; echo '<link rel="stylesheet" href="' . $thispage_style . '" type="text/css" />' . K_NEWLINE; echo '<link rel="stylesheet" href="../styles/color.css" type="text/css" />' . K_NEWLINE; echo '<link rel="shortcut icon" href="' . $thispage_icon . '" />' . K_NEWLINE; echo '<script src="../../scripts/cookie.js"></script>' . K_NEWLINE; // calendar if (isset($enable_calendar) and $enable_calendar) { echo '<style type="text/css">@import url(' . K_PATH_SHARED_JSCRIPTS . 'jscalendar/calendar-blue.css);</style>' . K_NEWLINE; echo '<script type="text/javascript" src="' . K_PATH_SHARED_JSCRIPTS . 'jscalendar/calendar.js"></script>' . K_NEWLINE; if (file_exists('' . K_PATH_SHARED_JSCRIPTS . 'jscalendar/lang/calendar-' . $l['a_meta_language'] . '.js')) { echo '<script type="text/javascript" src="' . K_PATH_SHARED_JSCRIPTS . 'jscalendar/lang/calendar-' . $l['a_meta_language'] . '.js"></script>' . K_NEWLINE; } else { echo '<script type="text/javascript" src="' . K_PATH_SHARED_JSCRIPTS . 'jscalendar/lang/calendar-en.js"></script>' . K_NEWLINE; } echo '<script type="text/javascript" src="' . K_PATH_SHARED_JSCRIPTS . 'jscalendar/calendar-setup.js"></script>' . K_NEWLINE; } echo '<!-- T' . 'CE' . 'x' . 'am1' . '97' . '30' . '10' . '4 -->' . K_NEWLINE; echo '</head>' . K_NEWLINE; echo '<body>' . K_NEWLINE; global $login_error; if (isset($login_error) and $login_error) { F_print_error('WARNING', $l['m_login_wrong']); } //============================================================+ // END OF FILE //============================================================+
/** * Send a registration verification email to user. * @param $user_id (int) User ID * @param $user_email (string) User email * @param $user_verifycode (string) user verification code */ function F_send_user_reg_email($user_id, $user_email, $user_verifycode) { global $l, $db; require_once '../config/tce_config.php'; require_once '../../shared/code/tce_class_mailer.php'; require_once '../../shared/config/tce_email_config.php'; require_once '../../shared/config/tce_user_registration.php'; require_once '../../shared/code/tce_functions_html2txt.php'; $user_id = intval($user_id); // Instantiate C_mailer class $mail = new C_mailer(); //Load default values $mail->language = $l; $mail->Priority = $emailcfg['Priority']; $mail->ContentType = $emailcfg['ContentType']; $mail->Encoding = $emailcfg['Encoding']; $mail->WordWrap = $emailcfg['WordWrap']; $mail->Mailer = $emailcfg['Mailer']; $mail->Sendmail = $emailcfg['Sendmail']; $mail->UseMSMailHeaders = $emailcfg['UseMSMailHeaders']; $mail->Host = $emailcfg['Host']; $mail->Port = $emailcfg['Port']; $mail->Helo = $emailcfg['Helo']; $mail->SMTPAuth = $emailcfg['SMTPAuth']; $mail->SMTPSecure = $emailcfg['SMTPSecure']; $mail->Username = $emailcfg['Username']; $mail->Password = $emailcfg['Password']; $mail->Timeout = $emailcfg['Timeout']; $mail->SMTPDebug = $emailcfg['SMTPDebug']; $mail->PluginDir = $emailcfg['PluginDir']; $mail->Sender = $emailcfg['Sender']; $mail->From = $emailcfg['From']; $mail->FromName = $emailcfg['FromName']; if ($emailcfg['Reply']) { $mail->AddReplyTo($emailcfg['Reply'], $emailcfg['ReplyName']); } $mail->CharSet = $l['a_meta_charset']; if (!$mail->CharSet) { $mail->CharSet = $emailcfg['CharSet']; } $mail->Subject = $l['w_registration_verification']; $mail->Body = $l['m_email_registration']; $mail->IsHTML(TRUE); // Sets message type to HTML. //$userverifycode //compose confirmation URL $subscribe_url = K_PATH_URL . 'admin/code/tce_user_verification.php?a=' . $user_email . '&b=' . $user_verifycode . '&c=' . $user_id . ''; //--- Elaborate Templates --- $mail->Body = str_replace('#EMAIL#', $user_email, $mail->Body); $mail->Body = str_replace('#USERIP#', $_SERVER['REMOTE_ADDR'], $mail->Body); $mail->Body = str_replace('#SUBSCRIBEURL#', $subscribe_url, $mail->Body); $mail->Body = str_replace('#RACKMAPURL#', K_PATH_URL, $mail->Body); //compose alternative TEXT message body $mail->AltBody = F_html_to_text($mail->Body, false, true); $mail->AddAddress($user_email, ''); //Adds a "To" address if (strlen(K_USRREG_ADMIN_EMAIL) > 0) { // add administrator to BCC field $mail->AddBCC(K_USRREG_ADMIN_EMAIL); } if (!$mail->Send()) { //send email to user F_print_error('ERROR', 'EMAIL ERROR'); } $mail->ClearAddresses(); // Clear all addresses for next loop $mail->ClearCustomHeaders(); // Clears all custom headers $mail->ClearAllRecipients(); // Clears all recipients assigned in the TO, CC and BCC $mail->ClearAttachments(); // Clears all previously set filesystem, string, and binary attachments $mail->ClearReplyTos(); // Clears all recipients assigned in the ReplyTo array }