人人商城

platform.ctrl.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. setting_load('platform');
  8. if(empty($_W['setting']['platform'])) {
  9. $_W['setting']['platform'] = array(
  10. 'token' => random(32),
  11. 'encodingaeskey' => random(43),
  12. 'appsecret' => '',
  13. 'appid' => '',
  14. 'authstate' => 1
  15. );
  16. setting_save($_W['setting']['platform'],'platform');
  17. }
  18. $url = parse_url($_W['siteroot']);
  19. if(checksubmit('submit')) {
  20. $data = array(
  21. 'token' => trim($_GPC['platform_token']),
  22. 'encodingaeskey' => trim($_GPC['encodingaeskey']),
  23. 'appsecret' => trim($_GPC['appsecret']),
  24. 'appid' => trim($_GPC['appid']),
  25. 'authstate' => intval($_GPC['authstate'])
  26. );
  27. setting_save($data,'platform');
  28. message('更新成功', referer(), 'success');
  29. }
  30. if (!function_exists('mcrypt_module_open')) {
  31. message('抱歉,您的系统不支持加解密 mcrypt 模块,无法进行平台接入');
  32. }
  33. load()->classs('weixin.platform');
  34. $account_platform = new WeiXinPlatform();
  35. $authurl = $account_platform->getAuthLoginUrl();
  36. template('extension/platform');