destoon系统设置普通会员不自动绑定二级域名

分类栏目:destoon实战

196

首先这个二级域名要开通,按照官方教程来做就行了,这里就不多说了。

修改以下两处:

1.是修改 include\global.func.php中的userurl函数

function userurl($username, $qstring = ’’, $domain = ’’) {

global $CFG, $DT, $MODULE;

$URL = ’’;

if($username) {

$UserInfo = userinfo($username);//获得用户信息

if(($CFG[’com_domain’] && $UserInfo[’vip’]) || $domain) {//添加VIP判断

$URL = $domain ? ’https://’.$domain.’/’ : ’https://’.($DT[’com_www’] ? ’’ : ’’).$username.$CFG[’com_domain’].’/’;

if($qstring) {

parse_str($qstring, $q);

if(isset($q[’file’])) {

$URL .= $CFG[’com_dir’] ? $q[’file’].’/’ : ’company/’.$q[’file’].’/’;

unset($q[’file’]);

}

if($q) {

if($DT[’rewrite’]) {

//$URL .= ’home-’;

foreach($q as $k=>$v) {

$v = urlencode($v);

$URL .= $k.’-’.$v.’-’;

}

$URL = substr($URL, 0, -1).’.shtml’;

} else {

$URL .= ’index.php?’;

$i = 0;

foreach($q as $k=>$v) {

$v = urlencode($v);

$URL .= ($i  == 0 ? ’’ : ’&’).$k.’=’.$v;

}

}

}

}

} else if($DT[’rewrite’]) {

$URL = DT_URL.’com/’.$username.’/’;

if($qstring) {

parse_str($qstring, $q);

if(isset($q[’file’])) {

$URL .= $CFG[’com_dir’] ? $q[’file’].’/’ : ’company/’.$q[’file’].’/’;

unset($q[’file’]);

}

if($q) {

foreach($q as $k=>$v) {

$v = urlencode($v);

$URL .= $k.’-’.$v.’-’;

}

$URL = substr($URL, 0, -1).’.html’;

}

}

} else {

$URL = DT_URL.’index.php?homepage=’.$username;

if($qstring) $URL = $URL.’&’.$qstring;

}

} else {

$URL = linkurl($MODULE[4][’linkurl’], 1).’guest.php’;

}

return $URL;

}

第二步,是修改module\company\index.inc.php文件,在注释处添加个判断

defined(’IN_DESTOON’) or exit(’Access Denied’);

require DT_ROOT.’/module/’.$module.’/common.inc.php’;

$username = $domain = ’’;

if(isset($homepage) && check_name($homepage)) {

$username = $homepage;

} else {

$host = $_SERVER[’HTTP_HOST’];

if(substr($host, 0, 4) == ’’) {

$whost = $host;

$host = substr($host, 4);

} else {

$whost = $host;

}

if(strpos($MODULE[4][’linkurl’], $host) === false) {

$www = str_replace($CFG[’com_domain’], ’’, $host);

if(check_name($www)) {

$vip = userinfo($www);//获得用户信息

if($vip[’vip’]){//添加VIP判断

$username = $homepage = $www;

}

} else {

$c = $db->get_one("SELECT username,domain FROM {$DT_PRE}company WHERe domain=’$whost’".($host == $whost ? ’’ : " OR domain=’$host’"));

if($c) {

$username = $homepage = $c[’username’];

$domain = $c[’domain’];

}

}

}

}

if($username) {

include DT_ROOT.’/module/’.$module.’/init.inc.php’;

} else {

if($DT[’safe_domain’]) {

$safe_domain = explode(’|’, $DT[’safe_domain’]);

$pass_domain = false;

foreach($safe_domain as $v) {

if(strpos($DT_URL, $v) !== false) { $pass_domain = true; break; }

}

$pass_domain or exit(header("HTTP/1.1 404 Not Found"));

}

if(!check_group($_groupid, $MOD[’group_index’])) {

$head_title = lang(’message->without_permission’);

exit(include template(’noright’, ’message’));

}

if($MOD[’index_html’]) {

$html_file = DT_ROOT.’/’.$MOD[’moduledir’].’/index.inc.html’;

if(!is_file($html_file)) tohtml(’index’, $module);

exit(include($html_file));

}

include DT_ROOT.’/include/seo.inc.php’;

if($MOD[’seo_index’]) {

eval("\$seo_title = \"$MOD[seo_index]\";");

} else {

$seo_title = $seo_modulename.$seo_delimiter.$seo_sitename;

}

$taomodi_task = "moduleid=$moduleid&html=index";

include template(’index’, $module);