if (!preg_match("/error:/i", $data)) {
            global $cM;
            $cM->_insertContactSendMail($name, $email, $content, $arrData['event_id'], $arrData['table'], $arrData['table_id']);
            return "<p>Sendmail success: <b class='adMessage'>{$name} - {$email}</b></p>";
        } else {
            return "<p class='adError'>ERROR sendmail: <b>{$name} - {$email}</b></p>";
        }
    }
    $str = '';
    $arr = array("select" => "`mn_customer`.`id`, `name`, `phone`, `email`, `datetime`", "from" => "`mn_class_info`, `mn_customer`", "where" => "`class_id`='{$table_id}' AND `_table`='mn_customer' AND `table_id`=`mn_customer`.`id` AND `mn_customer`.`id` NOT IN (SELECT `customer_id` FROM `mn_license` WHERE `class_id`='{$table_id}')");
    $data = $c->_model->_select($arr);
    $i = 0;
    foreach ($data as $row) {
        $i++;
        $key = time() + $i;
        $cM->_insertEntryTestUser('mn_customer', $row['id'], $header_id, $key);
        $link = CONS_BASE_URL . '/ajax/?entrytest=' . $key;
        $link = '<a href="' . $link . '">' . $link . '</a>';
        $arrData = array('name' => $row['name'], 'email' => $row['email'], 'link' => $link, 'subject' => $rowForm['subject'], 'content' => $rowForm['content'], 'bcc' => $rowForm['email'], 'event_id' => $event_id, 'table' => 'mn_customer', 'table_id' => $row['id']);
        $str .= sendMailClass($arrData);
    }
    //result
    $arr = array('error' => 0, 'message' => 'Sendmail success', 'data' => $str);
    echo json_encode($arr);
    return true;
}
if (isset($_POST['sendMailPayment'])) {
    $name = $c->_model->_changeDauNhay($_POST['name']);
    $email = $c->_model->_changeDauNhay($_POST['email']);
    $price = $c->_model->_changeDauNhay($_POST['price']);
    $code = $c->_model->_changeDauNhay($_POST['code']);
     $country = $_SESSION['adminCountry'];
     $arr = array('select' => '`id`', 'from' => '`mn_license`', 'where' => "`code` LIKE '{$country}%' ");
     $data = $c->_model->_select($arr);
     $number = count($data) + 1;
     $certCode = sprintf($_SESSION['adminCountry'] . "%'.06s", $number);
     $check = $c->_model->_checkLicense($rowTrainer['course'], $rowCustomer['id']);
     if (count($check) == 0) {
         $c->_model->_insertLicense($certCode, $rowTrainer['class'], $rowTrainer['course'], $rowCustomer['id'], $rowTrainer['id']);
     }
 } else {
     $cM = new modelManager();
     $check = $c->_model->_checkEntryTestUser($table, $table_id, $rowEntry['menu_id']);
     if (count($check) <= 2) {
         $formID = 22;
         $key = time();
         $cM->_insertEntryTestUser($table, $table_id, $rowEntry['menu_id'], $key);
         $link = CONS_BASE_URL . '/ajax/?entrytest=' . $key;
         $link = '<a href="' . $link . '">' . $link . '</a>';
     } else {
         $formID = 23;
     }
 }
 $arr = array("select" => "*", "from" => "`web_event_form`", "where" => "`id`='{$formID}' AND `status`=1");
 $data = $c->_model->_select($arr);
 if (count($data) > 0) {
     $rowForm = $data[0];
     $AddBCC = '';
     if ($rowForm['email'] != '') {
         $AddBCC = array('field' => $rowForm['email'], 'name' => 'Stevbros');
     }
     //AddCC trainer