예제 #1
0
파일: hntest.php 프로젝트: noikiy/zays
function hntest_question_modify()
{
    $table = $GLOBALS['dbTablePre'] . 'test_question';
    //$tc_id = MooGetGPC('tc_id','integer');
    $qid = MooGetGPC('qid', 'integer');
    if ($_POST) {
        $tc_id = MooGetGPC('father_id', 'integer', 'P');
        $ctype = MooGetGPC('tc_id', 'integer', 'P');
        $question = trim(MooGetGPC('question', 'string', 'P'));
        $parent = MooGetGPC('parent', 'integer', 'P');
        $option = MooGetGPC('option', 'array', 'P');
        $scores = MooGetGPC('scores', 'array', 'P');
        $option_box = MooGetGPC('option_box', 'string', 'P');
        $show_type = MooGetGPC('show_type', 'integer', 'P');
        //str_scores
        $str_scores = '';
        if ($show_type != 1) {
            $str_scores = implode(',', $scores);
        }
        $sql = "INSERT INTO {$table} (`tc_id`,`question`,`ctype`,`show_type`,`str_scores`) \n\t\t\tVALUES('{$tc_id}','{$question}','{$ctype}','{$show_type}','{$str_scores}') ";
        //echo $sql;exit;
        $msg = '添加成功。';
        if ($qid > 0) {
            $sql = "UPDATE {$table} \n\t\t\t\tSET `question`='{$question}', \n\t\t\t\t\t`ctype`='{$ctype}', \n\t\t\t\t\t`show_type`='{$show_type}', \n\t\t\t\t\t`str_scores`='{$str_scores}' \n\t\t\t\tWHERE `qid`='{$qid}' ";
            $msg = '修改成功。';
        } else {
            if ($tc_id == 0) {
                MooMessageAdmin('题目类别错误', '', 1);
            }
        }
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        if ($qid == 0) {
            $qid = $GLOBALS['_MooClass']['MooMySQL']->insertId();
        }
        if ($show_type == 1) {
            //只有为自定义的时候才写表
            check_option($qid, $option, $scores, $option_box);
        }
        MooMessageAdmin($msg, '', 1);
    }
    $parent_class = get_father_class();
    $sql = "SELECT * FROM {$table} WHERE `qid`='{$qid}' ";
    $question = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    //测试题目选项
    if ($question['show_type'] == 1 || $question['show_type'] == 0) {
        $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question_option \n\t\tWHERE `qid`='{$qid}' ";
        $options = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    } else {
        //赋值个页面js变量
        $arr = array('', '', 'fuhe', 'tongyi', 'zhongyao');
        $targ = $arr[$question['show_type']];
        $str_scores = '[' . $question['str_scores'] . ']';
    }
    require adminTemplate('hntest_question_modify');
}
<hr style="border:0;color:#6699CC;height:1px;background-color:#6699CC;"/>
<h3>Referer Spam</h3>

<p>Each of the following lines is indicative of referer spam when BAStats finds it anywhere in the referer header field:</p>
<textarea name="bas_settings[referer_spam]" style="width:50%;height:5em;"><?php 
echo $settings['referer_spam'];
?>
</textarea>
<p>What to do about referer spam:</p>
<ul>
	<li><label><input type="checkbox" name="bas_options[]" value="log_spam" <?php 
check_option('log_spam');
?>
/> Don't log referers that match the spam entries.</label></li>
	<li><label><input type="checkbox" name="bas_options[]" value="die_spam" <?php 
check_option('die_spam');
?>
/> Immediately stop further script processing of requests that match the spam list.</label></li>
</ul>
<p class="submit"><input type="submit" value="Update Options"></p>
</form>
</div>

<div class="wrap">
<h2>Label Page</h2>
<p>Submit the values in this form to provide a recognizable label for a page that typically appears only as a URI.</p>
<p>For example, you might want to label the page <code>/index.php</code> as "<code>Home Page</code>".</p>
<form method="post">
<input type="hidden" name="action" value="label" />
<label for="label_URI">URI to label: <input type="text" id="label_URI" name="URI" /></label>
<label for="label_text">Label to use: <input type="text" id="label_text" name="Label" /></label>