| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- /**
- * author jade
- * intro 激活类
- */
- namespace Admin\Controller;
- use Think\Controller;
- class HomeController extends Controller
- {
- protected $config;
- public function _initialize()
- {
- $this->config=D('Config');
- }
-
- public function selectdata(){
- $URL = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- $geturl=str_replace('.html','',$URL);
- $get = $_GET;
- if((count($get)!==1 or !isset($get['code']))){
- header("HTTP/1.1 404 Not Found");
- $this->display('error');
- return false;
- }
- $data = base64_decode($_GET['code']);
- /*if(!preg_match('/[a-z0-9]/',substr($data,-1))){
- header("HTTP/1.1 404 Not Found");
- $this->display('error');
- return false;
- }*/
- if($_POST['code'] != ''&& $_POST['varify'] != ''){
- $where = array();
- $where['code'] = $_POST['code'];
- $where['varify_code'] = (int)$_POST['varify'];
- $code_table = getSubTable1('codes',$where['code']);
- $return = M($code_table)->where($where)->select();
- $count = count($return);
- if($count>0){
- echo 1;
- }else{
- echo 0;
- }
- }else{
- if($data==''){
- header("HTTP/1.1 404 Not Found");
- $this->display('error');
- return false;
- }else{
- /*$code =parse_url($data);
- $code = substr($code['path'],1);*/
- $where = array();
- $where['code'] = $data;
- $code_table = getSubTable1('codes',$where['code']);
- $return = M($code_table)->field('varify_code,Status,product_id')->where($where)->find();
- if(count($return)>0){
- if($return['Status']==0){
- //未激活的状态
- $return1 = M('product_box_type')->field('product_id')->where('id = '.$return['product_id'])->find();
- switch ($return1['product_id']) {
- case 1:
- //金丝路
- $this->display('jingsilu_1');
- break;
- case 2:
- //小黄金
- $this->display('hjy_1');
- break;
- case 3:
- //炫尚
- $this->display('xuanshang_1');
- break;
- }
- }else{
- $return1 = M('product_box_type')->field('product_id')->where('id = '.$return['product_id'])->find();
- switch ($return1['product_id']) {
- case 1:
- //金丝路
- $this->display('jingsilu');
- break;
- case 2:
- //小黄金
- $this->display('hjy');
- break;
- case 3:
- //炫尚
- $this->display('xuanshang');
- break;
- }
- }
- }else{
- header("HTTP/1.1 404 Not Found");
- $this->display('error');
- }
- }
- }
- }
- public function gosuccess(){
- $this->display('hjy');
- }
- }
|