bind-domain.ctrl.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. $dos = array('bind_domain', 'delete');
  8. $do = in_array($do, $dos) ? $do : 'bind_domain';
  9. if ($do == 'bind_domain') {
  10. if (checksubmit('submit')) {
  11. $bind_domain = trim($_GPC['bind_domain']);
  12. if (!starts_with($bind_domain, 'http')) {
  13. iajax(-1, '要绑定的域名请以http://或以https://开头');
  14. }
  15. $special_domain = array('.com.cn', '.net.cn', '.gov.cn', '.org.cn', '.com.hk', '.com.tw');
  16. $bind_domain = str_replace($bind_domain, '.com', $bind_domain);
  17. $domain_array = explode('.', $bind_domain);
  18. if (count($domain_array) > 3 || count($domain_array) <2) {
  19. iajax(-1, '只支持一级域名和二级域名!');
  20. }
  21. $data = array('domain' => trim($_GPC['bind_domain']));
  22. uni_setting_save('bind_domain', iserializer($data));
  23. iajax(0, '更新成功!', referer());
  24. }
  25. template('profile/bind-domain');
  26. }
  27. if ($do == 'delete') {
  28. uni_setting_save('bind_domain', array());
  29. itoast('删除成功!', referer(), 'success');
  30. }