Example #1
0
switch ($action) {
    case 'add':
        if ($MG['alert_limit']) {
            $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}alert WHERE username='******' AND status>0");
            if ($r['num'] >= $MG['alert_limit']) {
                dalert(lang($L['limit_add'], array($MG['alert_limit'], $r['num'])), 'goback');
            }
        }
        if ($submit) {
            if ($do->pass($post)) {
                $post['username'] = $_username;
                $post['email'] = $_email;
                $need_check = $MOD['alert_check'] == 2 ? $MG['check'] : $MOD['alert_check'];
                $post['status'] = get_status(3, $need_check);
                $post['addtime'] = $DT_TIME;
                $do->add($post);
                $msg = $L['op_add_success'];
                if ($post['status'] == 2) {
                    $msg = $msg . ' ' . $L['op_checking'];
                }
                dmsg($msg, '?status=' . $post['status']);
            } else {
                message($do->errmsg);
            }
        } else {
            if (in_array($mid, $mids)) {
                $_mid = $mid;
                foreach ($do->fields as $v) {
                    ${$v} = '';
                }
                $mid = $_mid;