index.php 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require './framework/bootstrap.inc.php';
  3. $host = $_SERVER['HTTP_HOST'];
  4. if (!empty($host)) {
  5. $bindhost = pdo_fetch("SELECT * FROM ".tablename('site_multi')." WHERE bindhost = :bindhost", array(':bindhost' => $host));
  6. if (!empty($bindhost)) {
  7. header("Location: ". $_W['siteroot'] . 'app/index.php?i='.$bindhost['uniacid'].'&t='.$bindhost['id']);
  8. exit;
  9. }
  10. $pc_bind = pdo_get('uni_settings', array('bind_domain IN ' => array('http://' . $host, 'https://' . $host), 'default_module <>' => ''), array('uniacid', 'default_module', 'bind_domain'));
  11. if (!empty($pc_bind)) {
  12. $account_type = pdo_getcolumn('account', array('uniacid' => $pc_bind['uniacid']), 'type');
  13. if ($account_type == ACCOUNT_TYPE_WEBAPP_NORMAL) {
  14. $_W['uniacid'] = $pc_bind['uniacid'];
  15. $_W['account'] = array('type' => $account_type);
  16. $url = module_app_entries($pc_bind['default_module'], array('cover'));
  17. header('Location: ' . $pc_bind['bind_domain'] . '/app/' . $url['cover'][0]['url']);
  18. exit;
  19. }
  20. }
  21. }
  22. if($_W['os'] == 'mobile' && (!empty($_GPC['i']) || !empty($_SERVER['QUERY_STRING']))) {
  23. header('Location: ./app/index.php?' . $_SERVER['QUERY_STRING']);
  24. } else {
  25. header('Location: ./web/index.php?' . (!empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : 'c=account&a=display'));
  26. }