if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        echo '<p><form method=post action="grades.php?gscaleid=' . $f_gscaleid . '&action=settings">';
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        $i_rowno = 0;
        writeTR2($lngstr['page_grades_gscaleid'], $i_rSet1->fields["gscaleid"]);
        writeTR2($lngstr['page_grades_gradename'], getInputElement('gscale_name', $i_rSet1->fields["gscale_name"]));
        writeTR2($lngstr['page_grades_gradedescription'], getTextArea('gscale_description', $i_rSet1->fields["gscale_description"]));
        $i_scale_text = "";
        $i_rSet3 = $g_db->Execute("SELECT gscale_gradeid, grade_name, grade_from, grade_to FROM " . $srv_settings['table_prefix'] . "gscales_grades WHERE gscaleid=" . $f_gscaleid);
        if (!$i_rSet3) {
            showDBError(__FILE__, 3);
        } else {
            while (!$i_rSet3->EOF) {
                $i_scale_text .= sprintf("%.1f", $i_rSet3->fields['grade_from']) . '% - ' . sprintf("%.1f", $i_rSet3->fields['grade_to']) . '% <b>' . $i_rSet3->fields['grade_name'] . '</b> [<a href="grades.php?action=edits&gscaleid=' . $f_gscaleid . '&gscale_gradeid=' . $i_rSet3->fields['gscale_gradeid'] . '">' . $lngstr['page_grades']['edit_grade'] . '</a>]<br>';
                $i_rSet3->MoveNext();
            }
            $i_rSet3->Close();
        }
        if ($i_scale_text) {
            $i_scale_text .= '<br>';
        }
        writeTR2($lngstr['page_grades_gradescale'], $i_scale_text . '<a href="grades.php?action=edit&gscaleid=' . $i_rSet1->fields["gscaleid"] . '">' . $lngstr['page_grades_gradescale_text'] . '</a>');
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
}
$f_subjectid = isset($_GET['subjectid']) ? (int) readGetVar('subjectid') : '';
writeTR2($lngstr['page_edittests_subjectid'], getSelectElement('subjectid', $f_subjectid, $i_subjects, ' onchange="document.location.href=\'test-manager.php?subjectid=\'+this.value+\'' . $i_testid_addon . $i_order_addon . $i_url_limitto_addon . '\';"'));
$i_tests = array('' => $lngstr['label_none']);
$i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "tests");
if (!$i_rSet2) {
    showDBError(__FILE__, 2);
} else {
    while (!$i_rSet2->EOF) {
        $i_tests[$i_rSet2->fields['testid']] = $i_rSet2->fields['test_name'];
        $i_rSet2->MoveNext();
    }
    $i_rSet2->Close();
}
$f_testid = isset($_GET['testid']) ? (int) readGetVar('testid') : '';
writeTR2($lngstr['page_edittests_testname'], getSelectElement('testid', $f_testid, $i_tests, ' onchange="document.location.href=\'test-manager.php?testid=\'+this.value+\'' . $i_subjectid_addon . $i_order_addon . $i_url_limitto_addon . '\';"'));
echo '</table>';
echo '</div></td></tr>';
echo '</table></p>';
echo '<p><form name=testsForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="test-manager.php?action=create"><img src="images/button-new-big.gif" width=32 height=32 border=0 title="' . $lngstr['label_action_create_test'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-groups-big.gif" border=0 title="' . $lngstr['label_action_groups'] . '" style="cursor: hand;" onclick="f=document.testsForm;f.action=\'test-manager.php?action=groups\';f.submit();"></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_tests_delete'] . '" style="cursor: hand;" onclick="f=document.testsForm;if (confirm(\'' . $lngstr['qst_delete_tests'] . '\')) { f.action=\'test-manager.php?action=delete&confirmed=1\';f.submit();}"></td>';
echo '<td width=3><img src="images/1x1.gif" width=3 height=1></td>';
echo '<td width="100%">&nbsp;</td>';
if ($i_limitcount > 0) {
    $i_url_pages_addon = $i_url_limitto_addon . $i_order_addon . $i_testid_addon . $i_subjectid_addon;
    echo '<td vAlign=middle width=32><nobr>&nbsp;' . sprintf($lngstr['label']['KtoLofN'], $nRecordFrom, $nRecordTo, $i_recordcount) . '&nbsp;</nobr></td>';
    echo '<td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td>';
    echo '<td vAlign=middle width=32><nobr>&nbsp;';
    for ($i = $nStartPage; $i <= $nEndPage; $i++) {
        if ($i != $i_pageno) {
            echo '&nbsp;<a href="test-manager.php?pageno=' . $i . $i_url_pages_addon . '">' . $i . '</a>&nbsp;';
            break;
        case QUESTION_TYPE_ESSAY:
            echo '<tr><td width=23 valign=top><nobr><img src="images/select_' . ($i_result_answer_iscorrect == IGT_ANSWER_IS_UNDEFINED ? '13' : ($i_result_answer_iscorrect == IGT_ANSWER_IS_CORRECT ? '12' : ($i_result_answer_iscorrect == IGT_ANSWER_IS_PARTIALLYCORRECT ? '11' : '10'))) . '.gif" width=13 height=15><img src="image/1x1.gif" width=9 height=1></nobr></td>';
            echo '<td>' . nl2br($i_result_answer_text) . '</td></tr>';
            if ($G_SESSION['access_reportsmanager'] > 2) {
                echo '<tr>';
                echo '<td width=23></td>';
                echo '<td width="100%">';
                echo '<p><form method=post action="reports-manager.php?resultid=' . $f_resultid . '&answerid=' . $f_answerid . '&action=setpoints">';
                echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
                $i_rowno = 0;
                if ($i_result_answer_iscorrect == IGT_ANSWER_IS_UNDEFINED) {
                    $i_result_answer_points = '';
                }
                writeTR2($lngstr['page_editquestion_points'], getInputElement('points', $i_result_answer_points, 3));
                writeTR2($lngstr['page_reportsmanager']['answerfeedback'], getTextArea('feedback', $i_result_answer_feedback));
                echo '</table>';
                echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_set'] . ' "></p></form>';
                echo '</td></tr>';
            } else {
                echo '<tr>';
                echo '<td width=23></td>';
                echo '<td width="100%"><strong>';
                echo nl2br($i_result_answer_feedback);
                echo '</strong></td></tr>';
            }
            break;
    }
    echo '</table>';
}
displayTemplate('_footer');
writeErrorsWarningsBar();
$i_rSet1 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "subjects WHERE subjectid={$f_subjectid}");
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        $i_subjects = array('' => $lngstr['label_none']);
        $i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "subjects");
        if (!$i_rSet2) {
            showDBError(__FILE__, 2);
        } else {
            while (!$i_rSet2->EOF) {
                if ($i_rSet2->fields['subjectid'] != $f_subjectid) {
                    $i_subjects[$i_rSet2->fields['subjectid']] = $i_rSet2->fields['subject_name'];
                }
                $i_rSet2->MoveNext();
            }
            $i_rSet2->Close();
        }
        echo '<p><form method=post action="subjects.php?subjectid=' . $f_subjectid . '&action=edit">';
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        $i_rowno = 0;
        writeTR2($lngstr['page_subjects_subjectid'], $i_rSet1->fields['subjectid']);
        writeTR2($lngstr['page_subjects_subjectname'], getInputElement('subject_name', $i_rSet1->fields['subject_name']));
        writeTR2($lngstr['page_subjects_subjectdescription'], getTextArea('subject_description', $i_rSet1->fields['subject_description']));
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
                        $i_answer_text = $i_rSet3->fields['answer_text'];
                    }
                    writeTR2(sprintf($lngstr['label_answer_text'], $i), getTextEditor(0, 'answer_text[' . $i . ']', $i_answer_text, 3));
                    break;
                case QUESTION_TYPE_ESSAY:
                    writeTR2($lngstr['page_editquestion_answer_count'], $lngstr['label_notapplicable']);
                    writeTR2($lngstr['page_editquestion_question_text'], getTextEditor($G_SESSION['config_editortype'], 'question_text', !empty($i_rSet1->fields['question_text']) ? $i_rSet1->fields['question_text'] : $lngstr['page_editquestion_emptyquestion']));
                    break;
                case QUESTION_TYPE_RANDOM:
                    writeTR2($lngstr['page_editquestion_question_name'], getInputElement('question_text', !empty($i_rSet1->fields['question_text']) ? $i_rSet1->fields['question_text'] : $lngstr['label_atype_random'] . ' (' . $i_subjects[$f_subjectid] . ')'));
                    break;
            }
            $i_rSet3->Close();
        }
        if ($f_question_type != QUESTION_TYPE_RANDOM) {
            writeTR2($lngstr['page_editquestion_points'], getInputElement('question_points', $i_rSet1->fields['question_points'], 3));
        }
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bsubmit2 value=" ' . $lngstr['button_update_and_create_new_question'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
        echo '<script language=JavaScript type="text/javascript">
function updateQuestion() {
ctlQuestionType = document.getElementById("question_type");
nQuestionType = ctlQuestionType ? document.getElementById("question_type").options[document.getElementById("question_type").selectedIndex].value : "";
ctlSubjectID = document.getElementById("subjectid");
nSubjectID = ctlSubjectID ? ctlSubjectID.options[ctlSubjectID.selectedIndex].value : "";
ctlAnswerCount = document.getElementById("answercount");
nAnswerCount = ctlAnswerCount ? ctlAnswerCount.options[ctlAnswerCount.selectedIndex].value : "";
window.open("question-bank.php' . getURLAddon('', array('question_type', 'subjectid', 'answercount')) . '&question_type="+nQuestionType+"&subjectid="+nSubjectID+"&answercount="+nAnswerCount,"_top");
}
</script>';
    }
$i_rSet1 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "etemplates WHERE etemplateid={$f_etemplateid}");
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        echo '<p><form name=etemplateForm method=post action="email-templates.php?etemplateid=' . $f_etemplateid . '&action=edit">';
        echo '<table cellpadding=0 cellspacing=1 border=0 width="100%">';
        echo '<tr vAlign=top><td>';
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        $i_rowno = 0;
        writeTR2($lngstr['page_etemplates_etemplateid'], $i_rSet1->fields["etemplateid"]);
        writeTR2($lngstr['page_etemplates_etemplatename'], getInputElement('etemplate_name', $i_rSet1->fields["etemplate_name"]));
        writeTR2($lngstr['page_etemplates_etemplatedescription'], getTextArea('etemplate_description', $i_rSet1->fields["etemplate_description"]));
        writeTR2($lngstr['page_etemplates_etemplatefrom'], getInputElement('etemplate_from', $i_rSet1->fields["etemplate_from"]));
        writeTR2($lngstr['page_etemplates_etemplatesubject'], getInputElement('etemplate_subject', $i_rSet1->fields["etemplate_subject"]));
        writeTR2($lngstr['page_etemplates_etemplatebody'], getTextArea('etemplate_body', $i_rSet1->fields["etemplate_body"], '', 30));
        echo '</table>';
        echo '</td><td>';
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        echo '<tr><td class=rowhdr1>' . $lngstr['page_etemplates_template_tags'] . '</td></tr>';
        echo '<tr class=rowone><td>';
        writeTemplateTag(ETEMPLATE_TAG_USERNAME);
        echo '<br>';
        writeTemplateTag(ETEMPLATE_TAG_USER_PASSWORD);
        echo '<br>';
        writeTemplateTag(ETEMPLATE_TAG_USER_TITLE);
        echo '<br>';
        writeTemplateTag(ETEMPLATE_TAG_USER_FIRST_NAME);
        echo '<br>';
        writeTemplateTag(ETEMPLATE_TAG_USER_LAST_NAME);
        echo '<br>';
//9917
$i_rSet1 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "groups WHERE groupid={$f_groupid}");
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        echo '<p><form method=post action="groups.php?groupid=' . $f_groupid . '&action=edit">';
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        $i_rowno = 0;
        writeTR2($lngstr['page_managegroups_groupid'], $i_rSet1->fields["groupid"]);
        writeTR2($lngstr['page_managegroups_groupname'], getInputElement('group_name', $i_rSet1->fields["group_name"]));
        writeTR2($lngstr['page_managegroups_groupdescription'], getTextArea('group_description', $i_rSet1->fields["group_description"]));
        echo '<tr valign=top><td class=rowhdr2 colspan=2>' . $lngstr['page_groups_access_rights'] . '</td></tr>';
        writeTR2($lngstr['page_groups_access_tests'], getSelectElement('access_tests', $i_rSet1->fields["access_tests"], $lngstr['page_groups_access_tests_select']));
        writeTR2($lngstr['page_groups_access_questionbank'], getSelectElement('access_questionbank', $i_rSet1->fields["access_questionbank"], $lngstr['page_groups_access_questionbank_select']));
        writeTR2($lngstr['page_groups_access_subjects'], getSelectElement('access_subjects', $i_rSet1->fields["access_subjects"], $lngstr['page_groups_access_subjects_select']));
        writeTR2($lngstr['page_groups_access_testmanager'], getSelectElement('access_testmanager', $i_rSet1->fields["access_testmanager"], $lngstr['page_groups_access_testmanager_select']));
        writeTR2($lngstr['page_groups_access_gradingsystems'], getSelectElement('access_gradingsystems', $i_rSet1->fields["access_gradingsystems"], $lngstr['page_groups_access_gradingsystems_select']));
        writeTR2($lngstr['page_groups_access_emailtemplates'], getSelectElement('access_emailtemplates', $i_rSet1->fields["access_emailtemplates"], $lngstr['page_groups_access_emailtemplates_select']));
        writeTR2($lngstr['page_groups_access_reporttemplates'], getSelectElement('access_reporttemplates', $i_rSet1->fields["access_reporttemplates"], $lngstr['page_groups_access_reporttemplates_select']));
        writeTR2($lngstr['page_groups_access_reportsmanager'], getSelectElement('access_reportsmanager', $i_rSet1->fields["access_reportsmanager"], $lngstr['page_groups_access_reportsmanager_select']));
        writeTR2($lngstr['page_groups_access_users'], getSelectElement('access_users', $i_rSet1->fields["access_users"], $lngstr['page_groups_access_users_select']));
        writeTR2($lngstr['page_groups_access_groups'], getSelectElement('access_groups', $i_rSet1->fields["access_groups"], $lngstr['page_groups_access_groups_select']));
        writeTR2($lngstr['page_groups_access_config'], getSelectElement('access_config', $i_rSet1->fields["access_config"], $lngstr['page_groups_access_config_select']));
        writeTR2($lngstr['page_groups_access_visitors'], getSelectElement('access_visitors', $i_rSet1->fields["access_visitors"], $lngstr['page_groups_access_visitors_select']));
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
    }
}
$nRecordFrom = ($i_pageno - 1) * $i_limitcount + 1;
if ($i_pageno != $i_pageno_count) {
    $nRecordTo = $i_pageno * $i_limitcount;
} else {
    $nRecordTo = $i_recordcount;
}
$g_vars['page']['filter_url_addon'] = getURLAddon('?action=filter', array('action'));
echo '<p><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="">';
echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_filter_administration_users\')">' . $lngstr['label_filter_header'] . '</td></tr>';
echo '<tr valign=top><td class=rowone colspan=2><div id=div_filter_administration_users style="display:' . (isset($_COOKIE['div_filter_administration_users']) && $_COOKIE['div_filter_administration_users'] == 'Y' ? 'block' : 'none') . '"><form name=filterForm method=post action="users.php' . $g_vars['page']['filter_url_addon'] . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
$g_vars['page']['user_lastname_content'] = getInputElement('user_lastname', $f_user_lastname);
writeTR2($lngstr['label_lastname'], $g_vars['page']['user_lastname_content']);
$g_vars['page']['user_department_content'] = getInputElement('user_department', $f_user_department);
writeTR2($lngstr['label_department'], $g_vars['page']['user_department_content']);
echo '</table>';
echo '<br><input class=btn type=submit name=bsetfilter value=" ' . $lngstr['button_set_filter'] . ' "> <input class=btn type=submit name=bremovefilter value=" ' . $lngstr['button_remove_filter'] . ' "></form>';
echo '</div></td></tr>';
echo '</table></p>';
echo '<p><form name=usersForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="users.php?action=create"><img src="images/button-new-big.gif" border=0 title="' . $lngstr['label_action_create_user'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-groups-big.gif" border=0 title="' . $lngstr['label_action_groups'] . '" style="cursor: hand;" onclick="f=document.usersForm;f.action=\'users.php?action=groups\';f.submit();"></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_users_delete'] . '" style="cursor: hand;" onclick="f=document.usersForm;if (confirm(\'' . $lngstr['qst_delete_users'] . '\')) { f.action=\'users.php?action=delete&confirmed=1\';f.submit();}"></td><td width="100%">&nbsp;</td>';
if ($i_limitcount > 0) {
    $i_url_pages_addon = $i_url_limitto_addon . $i_order_addon;
    echo '<td vAlign=middle width=32><nobr>&nbsp;' . sprintf($lngstr['label']['KtoLofN'], $nRecordFrom, $nRecordTo, $i_recordcount) . '&nbsp;</nobr></td>';
    echo '<td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td>';
    echo '<td vAlign=middle width=32><nobr>&nbsp;';
    for ($i = $nStartPage; $i <= $nEndPage; $i++) {
        if ($i != $i_pageno) {
            echo '&nbsp;<a href="users.php?pageno=' . $i . $i_url_pages_addon . '">' . $i . '</a>&nbsp;';
        } else {
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD2) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD3) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD4) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD5) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD6) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD7) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD8) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_USER_USERFIELD9) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_TEST_NAME) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_ID) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_DATE) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_TIME_SPENT) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_TIME_EXCEEDED) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_POINTS_SCORED) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_POINTS_POSSIBLE) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_PERCENTS) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_GRADE) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_GRADE_FEEDBACK) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_ATTACHMENT_REPORT_PDF) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_DETAILED_1) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_DETAILED_2) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_DETAILED_3) . ', ';
        $i_addon .= getTemplateTag(ETEMPLATE_TAG_RESULT_DETAILED_4);
        $i_addon .= '];';
        writeTR2($lngstr['page-rtemplates']['rtemplatebody'], getTextEditor($G_SESSION['config_editortype'], 'rtemplate_body', $i_rSet1->fields['rtemplate_body'], NULL, NULL, $i_addon));
        echo '</table>';
        echo '<p class=center><input class=btn type=submit name=bsubmit value=" ' . $lngstr['button_update'] . ' "> <input class=btn type=submit name=bcancel value=" ' . $lngstr['button_cancel'] . ' "></form>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
$i_rSet1 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "visitors WHERE visitorid={$f_visitorid}");
if (!$i_rSet1) {
    showDBError(__FILE__, 1);
} else {
    if (!$i_rSet1->EOF) {
        echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
        $i_rowno = 0;
        writeTR2($lngstr['page_visitordetails_visitorid'], $i_rSet1->fields["visitorid"]);
        writeTR2($lngstr['page_visitordetails_timespent'], getTimeFormatted($i_rSet1->fields["enddate"] - $i_rSet1->fields["startdate"]));
        $i_username = '';
        $i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "users WHERE id=" . $i_rSet1->fields["id"]);
        if ($i_rSet2) {
            if (!$i_rSet2->EOF) {
                $i_username = $i_rSet2->fields["username"];
            }
        }
        writeTR2($lngstr['page_visitordetails_username'], $i_username);
        writeTR2($lngstr['page_visitordetails_hits'], $i_rSet1->fields["hits"]);
        writeTR2($lngstr['page_visitordetails_startdate'], getDateLocal($lngstr['language']['date_format_full'], $i_rSet1->fields["startdate"]));
        writeTR2($lngstr['page_visitordetails_inurl'], '<a href="' . $i_rSet1->fields["inurl"] . '" target=_blank>' . $i_rSet1->fields["inurl"] . '</a>');
        writeTR2($lngstr['page_visitordetails_enddate'], getDateLocal($lngstr['language']['date_format_full'], $i_rSet1->fields["enddate"]));
        writeTR2($lngstr['page_visitordetails_outurl'], '<a href="' . $i_rSet1->fields["outurl"] . '" target=_blank>' . $i_rSet1->fields["outurl"] . '</a>');
        writeTR2($lngstr['page_visitordetails_ipaddress'], $i_rSet1->fields["ip1"] . '.' . $i_rSet1->fields["ip2"] . '.' . $i_rSet1->fields["ip3"] . '.' . $i_rSet1->fields["ip4"]);
        writeTR2($lngstr['page_visitordetails_host'], $i_rSet1->fields["host"]);
        writeTR2($lngstr['page_visitordetails_referer'], '<a href="' . $i_rSet1->fields["referer"] . '" target=_blank>' . $i_rSet1->fields["referer"] . '</a>');
        writeTR2($lngstr['page_visitordetails_useragent'], $i_rSet1->fields["useragent"]);
        echo '</table>';
    }
    $i_rSet1->Close();
}
displayTemplate('_footer');
echo '<p><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="">';
echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_filter_questionbank\')">' . $lngstr['label_filter_header'] . '</td></tr>';
echo '<tr valign=top><td class=rowone colspan=2><div id=div_filter_questionbank style="display:' . (isset($_COOKIE['div_filter_questionbank']) && $_COOKIE['div_filter_questionbank'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
$i_subjects = array('' => $lngstr['label_none']);
$i_rSet2 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "subjects");
if (!$i_rSet2) {
    showDBError(__FILE__, 2);
} else {
    while (!$i_rSet2->EOF) {
        $i_subjects[$i_rSet2->fields['subjectid']] = $i_rSet2->fields['subject_name'];
        $i_rSet2->MoveNext();
    }
    $i_rSet2->Close();
}
$f_subjectid = isset($_GET['subjectid']) ? (int) readGetVar('subjectid') : '';
writeTR2($lngstr['page_editquestion_subjectid'], getSelectElement('subjectid', $f_subjectid, $i_subjects, ' onchange="document.location.href=\'question-bank.php?subjectid=\'+this.value+\'' . $i_order_addon . $i_url_limit_addon . '\';"'));
echo '</table>';
echo '</div></td></tr>';
echo '</table></p>';
echo '<p><form name=qbankForm class=iactive method=post><table cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td>';
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%" style="background: url(images/toolbar-background.gif) repeat-x"><tr vAlign=center><td width=2><img src="images/toolbar-left.gif" width=2 height=32></td><td width=32><a href="question-bank.php?action=createq"><img src="images/button-new-big.gif" border=0 title="' . $lngstr['label_action_create_question'] . '"></a></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-stats-big.gif" border=0 title="' . $lngstr['label_action_questions_stats'] . '" style="cursor: hand;" onclick="f=document.qbankForm;f.action=\'question-bank.php?action=statsq\';f.submit();"></td><td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td><td width=32><img src="images/button-cross-big.gif" border=0 title="' . $lngstr['label_action_questions_delete'] . '" style="cursor: hand;" onclick="f=document.qbankForm;if (confirm(\'' . $lngstr['qst_delete_questions'] . '\')) { f.action=\'question-bank.php?action=deleteq&confirmed=1\';f.submit();}"></td>';
echo '<td width="100%">&nbsp;</td>';
if ($i_limitcount > 0) {
    $i_url_pages_addon = $i_url_limitto_addon . $i_order_addon . $i_subjectid_addon;
    echo '<td vAlign=middle width=32><nobr>&nbsp;' . sprintf($lngstr['label']['KtoLofN'], $nRecordFrom, $nRecordTo, $i_recordcount) . '&nbsp;</nobr></td>';
    echo '<td width=3><img src="images/toolbar-separator.gif" width=3 height=32 border=0></td>';
    echo '<td vAlign=middle width=32><nobr>&nbsp;';
    for ($i = $nStartPage; $i <= $nEndPage; $i++) {
        if ($i != $i_pageno) {
            echo '&nbsp;<a href="question-bank.php?pageno=' . $i . $i_url_pages_addon . '">' . $i . '</a>&nbsp;';
        } else {