人人商城

uc.ctrl.php 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. uni_user_permission_check('mc_uc');
  8. $_W['page']['title'] = 'UC站点整合 - 会员中心选项 - 会员中心';
  9. $uc = pdo_fetch("SELECT `uc`,`passport` FROM ".tablename('uni_settings') . " WHERE uniacid = :weid", array(':weid' => $_W['weid']));
  10. $uc = @iunserializer($uc['uc']);
  11. if(!is_array($uc)) {
  12. $uc = array();
  13. }
  14. if(checksubmit('submit')) {
  15. $rec = array();
  16. $uc['status'] = intval($_GPC['status']);
  17. if($uc['status'] == '1') {
  18. $connect = $_GPC['connect'];
  19. $uc['connect'] = trim($_GPC['connect']);
  20. $uc['title'] = empty($_GPC['title']) ? message('请填写正确的站点名称!', referer(), 'error') : trim($_GPC['title']);
  21. $uc['appid'] = empty($_GPC['appid']) ? message('请填写正确的应用id!', referer(), 'error') : intval($_GPC['appid']);
  22. $uc['key'] = empty($_GPC['key']) ? message('请填写与UCenter的通信密钥!', referer(), 'error') : trim($_GPC['key']);
  23. $uc['charset'] = empty($_GPC['charset']) ? message('请填写UCenter的字符集!', referer(), 'error') : trim($_GPC['charset']);
  24. if($connect == 'mysql') {
  25. $uc['dbhost'] = empty($_GPC['dbhost']) ? message('请填写UCenter数据库主机地址!', referer(), 'error') : trim($_GPC['dbhost']);
  26. $uc['dbuser'] = empty($_GPC['dbuser']) ? message('请填写UCenter数据库用户名!', referer(), 'error') : trim($_GPC['dbuser']);
  27. $uc['dbpw'] = empty($_GPC['dbpw']) ? message('请填写UCenter数据库密码!', referer(), 'error') : trim($_GPC['dbpw']);
  28. $uc['dbname'] = empty($_GPC['dbname']) ? message('请填写UCenter数据库名称!', referer(), 'error') : trim($_GPC['dbname']);
  29. $uc['dbcharset'] = empty($_GPC['dbcharset']) ? message('请填写UCenter数据库字符集!', referer(), 'error') : trim($_GPC['dbcharset']);
  30. $uc['dbtablepre'] = empty($_GPC['dbtablepre']) ? message('请填写UCenter数据表前缀!', referer(), 'error') : trim($_GPC['dbtablepre']);
  31. $uc['dbconnect'] = intval($_GPC['dbconnect']);
  32. $uc['api'] = trim($_GPC['api']);
  33. $uc['ip'] = trim($_GPC['ip']);
  34. } elseif($connect == 'http') {
  35. $uc['dbhost'] = trim($_GPC['dbhost']);
  36. $uc['dbuser'] = trim($_GPC['dbuser']);
  37. $uc['dbpw'] = trim($_GPC['dbpw']);
  38. $uc['dbname'] = trim($_GPC['dbname']);
  39. $uc['dbcharset'] = trim($_GPC['dbcharset']);
  40. $uc['dbtablepre'] = trim($_GPC['dbtablepre']);
  41. $uc['dbconnect'] = intval($_GPC['dbconnect']);
  42. $uc['api'] = empty($_GPC['api']) ? message('请填写UCenter 服务端的URL地址!', referer(), 'error') : trim($_GPC['api']);
  43. $uc['ip'] = empty($_GPC['ip']) ? message('请填写UCenter的IP!', referer(), 'error') : trim($_GPC['ip']);
  44. }
  45. }
  46. $rec['uc'] = iserializer($uc);
  47. $row = pdo_fetch("SELECT uniacid FROM ".tablename('uni_settings') . " WHERE uniacid = :wid LIMIT 1", array(':wid' => intval($_W['weid'])));
  48. if(!empty($row)) {
  49. pdo_update('uni_settings', $rec, array('uniacid' => intval($_W['uniacid'])));
  50. }else {
  51. $rec['uniacid'] = $_W['uniacid'];
  52. pdo_insert('uni_settings', $rec);
  53. }
  54. cache_delete("unisetting:{$_W['uniacid']}");
  55. message('设置UC参数成功!', referer(), 'success');
  56. }
  57. template('mc/uc');