destoon系統設置普通會員不自動綁定二級域名

首先這個二級域名要開通,按照官方教程來做就行了,這裏就不多說了。
修改以下兩處:
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 ? ’http://’.$domain.’/’ : ’http://’.($DT[’com_www’] ? ’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) == ’www.’) {
$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);
}
?>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章