4 || $tab_id <0) $tab_id=0;
$bdauth = empty($_COOKIE[$cookiepre . 'logging_status']) ? '' : $_COOKIE[$cookiepre . 'logging_status'];
list($id, $name, $value) = explode("\t", dz_authcode($bdauth,'DECODE'));
$request = //请求
isset($_REQUEST['request']) &&
in_array($_REQUEST['request'], array('ajax'))
? $_REQUEST['request']
: null ;
$act = // 动作
isset($_REQUEST['act']) &&
in_array($_REQUEST['act'], array('search_city','apply','search_province'))
? $_REQUEST['act']
: null ;
if($request == 'ajax'){
$json = new JSON();
switch($act){
case 'search_city':
$region_id = $_REQUEST['region_id'];
$city = get_regions(2,$region_id);
print $json->encode($city);
break;
case 'search_province':
$province = get_regions(1,1);
print $json -> encode($province);
break;
}
exit;
}
if($act == 'apply'){
$req = array();
do {
//蓝光机型号
$blu_type = $_REQUEST['blu_type'];
if($blu_type < 1 || $blu_type > 7){
break;
}
//昵称
$nick_name = trim($_REQUEST['nick_name']);
if(empty($nick_name)){
break;
}
$nick_name = addslashes($nick_name);
//省市
$province = $_REQUEST['province'];
$city = $_REQUEST['city'];
if(!(is_numeric($province) && is_numeric($city))){
break;
}
//职业
$carrer = $_REQUEST['carrer'];
if($carrer < 1 || $carrer > 13){
break;
}
$req['blu_type'] = $blu_type;
$req['nick_name'] = $nick_name;
$req['province'] = $province;
$req['city'] = $city;
$req['carrer'] = $carrer;
$req['created_stamp'] = date('Y-m-d H:i:s',time());
//手机/邮箱
$phone_or_post = $_REQUEST['phone_or_post'];
if(isset($phone_or_post) && !empty($phone_or_post)){
$req['phone_or_post'] = $phone_or_post;
}
//年龄
$age = $_REQUEST['age'];
if(isset($age) && !empty($age)){
$req['age'] = $age;
}
//五星一
$star1_value = $_REQUEST['star1_value'];
if(isset($star1_value)){
$req['star1_value'] = $star1_value + 1;
}
$facade = trim($_REQUEST['facade']);
if(isset($facade) && !empty($facade)){
$facade = addslashes($facade);
$req['facade'] = $facade;
}
//五星二
$star2_value = $_REQUEST['star2_value'];
if(isset($star2_value)){
$req['star2_value'] = $star2_value + 1;
}
$performance = trim($_REQUEST['performance']);
if(isset($performance) && !empty($performance)){
$performance = addslashes($performance);
$req['performance'] = $performance;
}
//最喜欢哪个功能
$favourite_functions = $_REQUEST['favourite_functions'];
if(isset($favourite_functions) && !empty($favourite_functions)){
$favourite_functions_str = implode(",",$favourite_functions);
$req['favourite_functions'] = $favourite_functions_str;
//如果选择了其他,则记录其他的东西
if(in_array("7",$favourite_functions)){
$fav_fun = trim($_REQUEST['fav_fun']);
if(isset($fav_fun) && !empty($fav_fun)){
$fav_fun = addslashes($fav_fun);
$req['fav_fun'] = $fav_fun;
}
}
}
//最希望增加什么功能
$function_wish = trim($_REQUEST['function_wish']);
if(isset($function_wish) && !empty($function_wish)){
$function_wish = addslashes($function_wish);
$req['function_wish'] = $function_wish;
}
//主要播放媒体文件
$media_files = $_REQUEST['media_files'];
if(isset($media_files) && !empty($media_files)){
$media_files_str = implode(",",$media_files);
$req['media_files'] = $media_files_str;
if(in_array("7",$media_files)){
$med_fil = trim($_REQUEST['med_fil']);
if(isset($med_fil) && !empty($med_fil)){
$med_fil = addslashes($med_fil);
$req['med_fil'] = $med_fil;
}
}
}
//连接方式
$connect_way = $_REQUEST['connect_way'];
if(isset($connect_way) && !empty($connect_way)){
$connect_way_str = implode(",",$connect_way);
$req['connect_way'] = $connect_way_str;
}
//购买前是否有考虑过其他品牌的播放机
$consider_another_brand = trim($_REQUEST['consider_another_brand']);
if(isset($consider_another_brand) && !empty($consider_another_brand)){
$consider_another_brand = addslashes($consider_another_brand);
$req['consider_another_brand'] = $consider_another_brand;
}
//决定购买的因素
$decisive_factor = $_REQUEST['decisive_factor'];
if(isset($decisive_factor) && !empty($decisive_factor)){
$decisive_factor_str = implode(",",$decisive_factor);
$req['decisive_factor'] = $decisive_factor_str;
if(in_array("7",$decisive_factor)){
$dec_fac = trim($_REQUEST['dec_fac']);
if(isset($dec_fac) && !empty($dec_fac)){
$dec_fac = addslashes($dec_fac);
$req['dec_fac'] = $dec_fac;
}
}
}
//如何知道OPPO蓝光
$know_from = $_REQUEST['know_from'];
if(isset($know_from) && !empty($know_from)){
$know_from_str = implode(",",$know_from);
$req['know_from'] = $know_from_str;
if(in_array("7",$know_from)){
$kn_fr = trim($_REQUEST['kn_fr']);
if(isset($kn_fr) && !empty($kn_fr)){
$kn_fr = addslashes($kn_fr);
$req['kn_fr'] = $kn_fr;
}
}
}
//您会给朋友推荐OPPO蓝光吗
$recommend = $_REQUEST['recommend'];
if(isset($recommend) && !empty($recommend)){
$recommend_str = implode(",",$recommend);
$req['recommend'] = $recommend_str;
}
$result = create_ques($req);
if($result){
$submit_success = 1;
}
}while (false);
$tab_id = 3;
}
//var_dump($value);
if ($value == 'true') {
$login_title = '個人賬戶
退出';
} else {
$login_title = '註冊
登錄
個人賬戶';
}
require_once BD_ROOT . 'libs/Template.php';
include Zandy_Template::outCache('support_new.html', $siteConf['tplDir'], $siteConf['cacheDir']);
function get_regions($type = 0, $parent = 0)
{
global $db;
$sql = "SELECT region_id, region_name FROM ecshop.ecs_region WHERE region_type = '{$type}' AND parent_id = '{$parent}'";
return $db->getAll($sql);
}
function create_ques($req){
global $db;
if(empty($req)){
return false;
}
$sql = "
insert into oppo_tw.questionnaire
(blu_type,nick_name,province,city,carrer,phone_or_post,age,facade_star_value,facade,performance_star_value,
performance,favourite_functions,fav_fun,function_wish,media_files,med_fil,connect_way,consider_another_brand,
decisive_factor,dec_fac,know_from,kn_fr,recommend,created_stamp)
values
('{$req['blu_type']}','{$req['nick_name']}','{$req['province']}','{$req['city']}','{$req['carrer']}','{$req['phone_or_post']}','{$req['age']}','{$req['star1_value']}',
'{$req['facade']}','{$req['star2_value']}','{$req['performance']}','{$req['favourite_functions']}','{$req['fav_fun']}','{$req['function_wish']}','{$req['media_files']}','{$req['med_fil']}',
'{$req['connect_way']}','{$req['consider_another_brand']}','{$req['decisive_factor']}','{$req['dec_fac']}','{$req['know_from']}','{$req['kn_fr']}','{$req['recommend']}','{$req['created_stamp']}')
";
$result = $db -> query($sql);
return $result;
}
?>