}
    //filter reports
    if ($_GET['admin_data'] == 'customer') {
        $rs = get_customers($common_filter, $opts);
    }
    //get filter customers
}
//segment
$totals = mysql_fetch_array($rs);
if (mysql_num_rows($rs)) {
    mysql_data_seek($rs, 0);
}
//reset mysql
$total_pages = isset($totals['total_results']) ? total_pages($totals['total_results'], $num) : 0;
//get total pages
push_messages('Tìm thấy <b>' . (isset($totals['total_results']) ? $totals['total_results'] : 0) . '</b> kết quả.');
//result
$data['rs'] = $rs;
extract($data);
//show messages
show_messages();
if (is_resource($rs) && mysql_num_rows($rs)) {
    $first = mysql_fetch_array($rs);
    mysql_data_seek($rs, 0);
    //reset
    if (isset($first['today_trans'])) {
        ?>
<div>Ngày hôm naycó: <strong><?php 
        echo $first['today_trans'] ? $first['today_trans'] : 0;
        ?>
</strong> giao dịch.</div>
<div id='vcn_wrap'>
    <div id="header"><h1>Vaycanhan.com</h1></div>
    <div class="main-left1">
<?php 
include 'include/functions.php';
if (isset($_POST['submit_group'])) {
    //submit group
    $post = array('group_title' => $_POST['group_title'], 'group_desc' => $_POST['group_desc'], 'group_image' => $_POST['group_img'], 'active' => isset($_POST['active']) ? '1' : '0');
    if (isset($_POST['group']) && $_POST['group']) {
        //update group
        save_question_group($post, $_POST['group']);
        push_messages('updated group with id=' . $_POST['group']);
    } else {
        //add new group
        save_question_group($post);
        push_messages('Added new group !');
    }
}
if (isset($_GET['del'])) {
    //del group
    del_group($_GET['del']);
}
if (isset($_GET['group'])) {
    //edit group
    $edit_group = get_question_group($_GET['group']);
    if (!$edit_group) {
        show_error('Not Found Group', 'Khong tim thay group id=' . $_GET['group']);
    }
}
//message
show_messages();
function del_history($id)
{
    global $conn;
    $rs = mysql_query('select id,result from vcn_histories where id="' . $id . '"');
    if (!mysql_num_rows($rs)) {
        push_messages('Không tìm thấy history này (Delete task).');
        return;
        //not found this history
    }
    $result = mysql_fetch_array($rs);
    //history data
    mysql_query('delete from vcn_histories where id="' . $id . '"');
    //delete history branch1
    mysql_query('delete from vcn_histories1 where hid="' . $id . '" and answer_id="' . $result['result'] . '"');
    //delete history branch2
}
 /**
  *action form
 */
 if (_POST('submit')) {
     //save data
     //add question
     $data_q = array('group_id' => $current_group->id, 'question' => _POST('question'), 'action' => _POST('action'), 'link_question' => _POST('link_question'), 'default_question_css' => _POST('default_question_css') ? '1' : '0');
     if (_POST('modify') && is_numeric(_POST('modify'))) {
         //modify question
         do_update($data_q, array('id' => _POST('modify')), 'vcn_data');
         //update question
         push_messages('Cập nhật thành công !');
     } else {
         do_insert($data_q, 'vcn_data');
         //add question
         push_messages('Đã thêm thành công !');
     }
     //answers
     $answers = array();
     $new_answers = array();
     //new answer to be added
     if (_POST('modify_answers')) {
         $answer_ids = explode(',', trim(_POST('modify_answers'), ','));
     }
     for ($i = 0; $i < _POST('qcount'); $i++) {
         if (!_POST('answer-' . $i)) {
             break;
         }
         //detect end data
         $answer = array();
         //answer
                $new_faqs[] = $faq;
            }
        }
    }
    do_update(array('has_faq' => '1'), array('id' => _POST('group')), 'vcn_data');
    //turn on faq for this question
    if (count($new_faqs) && _POST('modify') && is_numeric(_POST('modify'))) {
        //new faq to be added when update
        do_insert($new_faqs, 'vcn_faq');
    }
    //add faq
    if (!_POST('modify') || !is_numeric(_POST('modify'))) {
        do_insert($faqs, 'vcn_faq');
        push_messages('Thêm faq thành công.');
    } else {
        push_messages('Cập nhật faq thành công.');
    }
    //delete answers
    if (_POST('deletes')) {
        do_delete(explode(',', trim(_POST('deletes'), ',')), 'vcn_faq', 'id');
        //delete old answers
    }
}
if (_GET('del')) {
    //del faq item
    delete_faq(_GET('del'));
}
if (_GET('edit')) {
    $data['result'] = vcn_faq(_GET('edit'));
    //get specify faq
}