index.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. //更多资源请关注三岁半资源网:https://sansuib.com
  3. /**
  4. * [WeEngine System] Copyright (c) 2014 WE7.CC
  5. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  6. */
  7. require './framework/bootstrap.inc.php';
  8. $host = $_SERVER['HTTP_HOST'];
  9. if (!empty($host)) {
  10. $bindhost = pdo_fetch("SELECT * FROM ".tablename('site_multi')." WHERE bindhost = :bindhost", array(':bindhost' => $host));
  11. if (!empty($bindhost)) {
  12. header("Location: ". $_W['siteroot'] . 'app/index.php?i='.$bindhost['uniacid'].'&t='.$bindhost['id']);
  13. exit;
  14. }
  15. $pc_bind = pdo_get('uni_settings', array('bind_domain IN ' => array('http://' . $host, 'https://' . $host), 'default_module <>' => ''), array('uniacid', 'default_module', 'bind_domain'));
  16. if (!empty($pc_bind)) {
  17. $account_type = pdo_getcolumn('account', array('uniacid' => $pc_bind['uniacid']), 'type');
  18. if ($account_type == ACCOUNT_TYPE_WEBAPP_NORMAL) {
  19. $_W['uniacid'] = $pc_bind['uniacid'];
  20. $_W['account'] = array('type' => $account_type);
  21. $url = module_app_entries($pc_bind['default_module'], array('cover'));
  22. header('Location: ' . $pc_bind['bind_domain'] . '/app/' . $url['cover'][0]['url']);
  23. exit;
  24. }
  25. }
  26. }
  27. if($_W['os'] == 'mobile' && (!empty($_GPC['i']) || !empty($_SERVER['QUERY_STRING']))) {
  28. header('Location: ' . $_W['siteroot'] . 'app/index.php?' . $_SERVER['QUERY_STRING']);
  29. } else {
  30. header('Location: ' . $_W['siteroot'] . 'web/index.php' . ('?' . !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''));
  31. }