HomeController.class.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * author jade
  4. * intro 激活类
  5. */
  6. namespace Admin\Controller;
  7. use Think\Controller;
  8. class HomeController extends Controller
  9. {
  10. protected $config;
  11. public function _initialize()
  12. {
  13. $this->config=D('Config');
  14. }
  15. public function selectdata(){
  16. $URL = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  17. $geturl=str_replace('.html','',$URL);
  18. $get = $_GET;
  19. if((count($get)!==1 or !isset($get['code']))){
  20. header("HTTP/1.1 404 Not Found");
  21. $this->display('error');
  22. return false;
  23. }
  24. $data = base64_decode($_GET['code']);
  25. /*if(!preg_match('/[a-z0-9]/',substr($data,-1))){
  26. header("HTTP/1.1 404 Not Found");
  27. $this->display('error');
  28. return false;
  29. }*/
  30. if($_POST['code'] != ''&& $_POST['varify'] != ''){
  31. $where = array();
  32. $where['code'] = $_POST['code'];
  33. $where['varify_code'] = (int)$_POST['varify'];
  34. $code_table = getSubTable1('codes',$where['code']);
  35. $return = M($code_table)->where($where)->select();
  36. $count = count($return);
  37. if($count>0){
  38. echo 1;
  39. }else{
  40. echo 0;
  41. }
  42. }else{
  43. if($data==''){
  44. header("HTTP/1.1 404 Not Found");
  45. $this->display('error');
  46. return false;
  47. }else{
  48. /*$code =parse_url($data);
  49. $code = substr($code['path'],1);*/
  50. $where = array();
  51. $where['code'] = $data;
  52. $code_table = getSubTable1('codes',$where['code']);
  53. $return = M($code_table)->field('varify_code,Status,product_id')->where($where)->find();
  54. if(count($return)>0){
  55. if($return['Status']==0){
  56. //未激活的状态
  57. $return1 = M('product_box_type')->field('product_id')->where('id = '.$return['product_id'])->find();
  58. switch ($return1['product_id']) {
  59. case 1:
  60. //金丝路
  61. $this->display('jingsilu_1');
  62. break;
  63. case 2:
  64. //小黄金
  65. $this->display('hjy_1');
  66. break;
  67. case 3:
  68. //炫尚
  69. $this->display('xuanshang_1');
  70. break;
  71. }
  72. }else{
  73. $return1 = M('product_box_type')->field('product_id')->where('id = '.$return['product_id'])->find();
  74. switch ($return1['product_id']) {
  75. case 1:
  76. //金丝路
  77. $this->display('jingsilu');
  78. break;
  79. case 2:
  80. //小黄金
  81. $this->display('hjy');
  82. break;
  83. case 3:
  84. //炫尚
  85. $this->display('xuanshang');
  86. break;
  87. }
  88. }
  89. }else{
  90. header("HTTP/1.1 404 Not Found");
  91. $this->display('error');
  92. }
  93. }
  94. }
  95. }
  96. public function gosuccess(){
  97. $this->display('hjy');
  98. }
  99. }