extract($options_cache); $keywd = isset($_POST['keywd']) ? addslashes($_POST['keywd']) : ''; $sex = isset($_POST['sex']) ? addslashes($_POST['sex']) : ''; $Vip_model = new Vip_Model(); $sqlSegment = "where 1=1"; if (!empty($sex)) { $sqlSegment .= " and sex='{$sex}'"; } if (!empty($keywd)) { $sqlSegment .= " and (name like '%{$keywd}%' or vipid like '%{$keywd}%' )"; } $users = $Vip_model->getUsers($page, $sqlSegment); include View::getView('header'); require_once View::getView('vip'); View::output(); } if ($action == 'detail') { $uid = intval($_GET['uid']); $options_cache = Option::getAll(); extract($options_cache); $Vip_model = new Vip_Model(); $user = $Vip_model->getUserDetail($uid); if (empty($user['avatar'])) { $user['avatar'] = '../admin/views/images/avatar.jpg'; } else { $user['avatar'] = '../' . str_replace("../", '', $user['avatar']); } include View::getView('header'); require_once View::getView('vip_info'); View::output(); }
$duty = isset($_POST['duty']) ? intval(trim($_POST['duty'])) : ''; $avatar = isset($_POST['avatar']) ? addslashes(trim($_POST['avatar'])) : ''; $type = array('gif', 'jpg', 'jpeg', 'png'); if ($_FILES['avatar']['size'] > 0) { $file_info = uploadFile($_FILES['avatar']['name'], $_FILES['avatar']['error'], $_FILES['avatar']['tmp_name'], $_FILES['avatar']['size'], $type, true); if (!empty($file_info['file_path'])) { $avatar = !empty($file_info['thum_file']) ? $file_info['thum_file'] : $file_info['file_path']; } } $userData = array('name' => $name, 'vipid' => $vipid, 'age' => $age, 'sex' => $sex, 'dance_age' => $dance_age, 'dance_type' => $dance_type, 'province' => $province, 'contact' => $contact, 'company' => $company, 'awards' => $awards, 'homeurl' => $homeurl, 'avatar' => $avatar, 'duty' => $duty); $Vip_model->addUser($userData); emDirect('./vip.php?active_add=1'); } if ($action == 'edit') { $uid = isset($_GET['uid']) ? intval($_GET['uid']) : ''; $data = $Vip_model->getUserDetail($uid); extract($data); $icon = ''; if ($avatar) { $icon = "<img src=\"{$avatar}\" width=\"130\" height=\"146\" style=\"border:1px solid #CCCCCC;padding:1px;\" />"; } else { $icon = '<img src="./views/images/avatar.jpg" />'; } $ex1 = $ex2 = $ex3 = $ex4 = $ex5 = $ex6 = $ex7 = $ex8 = ''; if ($ischeck == 'n') { $ex3 = 'selected="selected"'; } elseif ($ischeck == 'y') { $ex4 = 'selected="selected"'; } if ($sex == '男') { $ex1 = 'selected="selected"';