if ($a_code) { $base_array['code'] = $a_code; DB::insert('dsu_vip_codes', $base_array); ++$count; } } } cpmsg(str_replace('{count}', $count, klang('import_succeed')), 'action=plugins&operation=config&identifier=dsu_kkvip&pmod=discount', 'succeed'); } showformheader('plugins&operation=config&identifier=dsu_kkvip&pmod=discount'); showtableheader(klang('discount_manager')); showsubtitle(explode('|', klang('discount_menu'))); $page = $_G['gp_page'] ? intval($_G['gp_page']) : 1; $start = ($page - 1) * 10; $nowtime = TIMESTAMP; $query = DB::query('SELECT * FROM ' . DB::table('dsu_vip_codes') . " WHERE exptime>='{$nowtime}' ORDER BY exptime DESC LIMIT {$start},10"); while ($result = DB::fetch($query)) { showtablerow('', array('class="td25"', 'class="td28"', 'class="td26"'), array('<input type="checkbox" class="checkbox" name="delete[]" value="' . $result['code'] . '" />', '<input type="text" onclick="this.select()" value="' . $result['code'] . '" size="50" />', dgmdate($result['exptime'], 'dt'), $result['only_once'] ? '<img align="absmiddle" src="static/image/admincp/cloud/wrong.gif">' : '<img align="absmiddle" src="static/image/admincp/cloud/right.gif">', $result['money'])); } showsubmit('submit'); showtablefooter(); showformfooter(); showtableheader(klang('import_discount_code')); showformheader('plugins&operation=config&identifier=dsu_kkvip&pmod=discount'); showsetting(klang('code_money'), 'money', 10, 'number'); showsetting(klang('code_exp'), 'code_exp', dgmdate(TIMESTAMP + 86400, 'd'), 'calendar'); showsetting(klang('allow_repeat'), 'allow_repeat', false, 'radio'); showsetting(klang('import_data'), 'import_data', '', 'textarea', '', '', klang('import_tips')); showsubmit('import', 'import'); showformfooter(); showtablefooter();
<?php if (!defined('IN_ADMINCP')) { exit('Access Denied'); } require_once DISCUZ_ROOT . './source/plugin/dsu_kkvip/kk_lang.func.php'; $extends = array(); if ($_G['gp_api']) { include DISCUZ_ROOT . "./source/plugin/dsu_kkvip/extend/{$_G[gp_api]}"; dexit(); } $extends_dir = @dir(DISCUZ_ROOT . './source/plugin/dsu_kkvip/extend/'); while (false !== ($entry = $extends_dir->read())) { $file = pathinfo($entry); if ($file['extension'] == 'php' && $file['basename']) { if (!$_G['gp_api']) { include DISCUZ_ROOT . "./source/plugin/dsu_kkvip/extend/{$file[basename]}"; } $extends[$ext_name] = $file['basename']; } } if (!$extends) { cpmsg(klang('no_extends'), '', 'error'); } showtableheader(klang('extend_list')); foreach ($extends as $name => $file) { showtablerow('', array('', 'width="20%"'), array($name, '<a href="?action=plugins&operation=config&identifier=dsu_kkvip&pmod=api&api=' . $file . '">' . klang('extend_config') . '</a>')); } showtablefooter();
$user = DB::fetch_first('SELECT uid, groupid FROM ' . DB::table('common_member') . " WHERE username='******'"); if (!$user['uid']) { cpmsg(klang('user_not_exist'), '', 'error', array('username' => $_G['gp_username'])); } require_once libfile('class/vip'); $vip = $vip ? $vip : new vip(); if ($vip->is_vip($user['uid'])) { $czz = intval($_G['gp_czz']); DB::update('dsu_vip', array('exptime' => strtotime($_G['gp_exptime']), 'year_pay' => $_G['gp_year_pay'] ? 1 : 0, 'czz' => $czz), array('uid' => $user['uid'])); if ($czz < 600) { $level = 1; } elseif ($czz >= 600 && $czz < 1800) { $level = 2; } elseif ($czz >= 1800 && $czz < 3600) { $level = 3; } elseif ($czz >= 3600 && $czz < 6000) { $level = 4; } elseif ($czz >= 6000 && $czz < 10800) { $level = 5; } elseif ($czz >= 10800) { $level = 6; } $vip->query("UPDATE pre_dsu_vip SET level='{$level}' WHERE uid='{$user[uid]}'"); $vip->query("UPDATE pre_common_member SET groupid={$vip->group[1]} WHERE uid='{$user[uid]}' AND adminid=0"); require_once libfile('function/cache'); updatecache('dsu_kkvip'); } else { $vip->pay_vip($user['uid'], intval($_G['gp_time']), $user['groupid']); } cpmsg(klang('user_edit_succeed'), 'action=plugins&operation=config&identifier=dsu_kkvip&pmod=user', 'succeed'); }