Ejemplo n.º 1
0
$head_title = $head_name . $DT['seo_delimiter'] . $head_title;
switch ($action) {
    case 'add':
        if (isset($_POST['ok'])) {
            if ($MG['address_limit']) {
                $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}address WHERE username='******'");
                if ($r['num'] >= $MG['address_limit']) {
                    exit('max');
                }
            }
            foreach ($post as $k => $v) {
                $post[$k] = convert(input_trim($v), 'UTF-8', DT_CHARSET);
            }
            if ($do->pass($post)) {
                $post['username'] = $_username;
                $do->add($post);
                exit('ok');
            } else {
                exit($do->errmsg);
            }
        } else {
            foreach ($do->fields as $v) {
                ${$v} = '';
            }
            $back_link = '?page=' . $page;
            $head_name = $L['address_add'];
            $head_title = $head_name . $DT['seo_delimiter'] . $head_title;
        }
        break;
    case 'edit':
        $itemid or dheader('?reload=' . $DT_TIME);