foxcvs 发表于 2014-6-17 10:06:46

【转】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['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['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\";");
[*]} else {
[*]$seo_title = $seo_modulename.$seo_delimiter.$seo_sitename;
[*]}
[*]$destoon_task = "moduleid=$moduleid&html=index";
[*]include template('index', $module);
[*]}
[*]?>复制代码转载的,大家看看,测试下。
原文:http://www.hackerfans.com/hacker ... ot-vip-members.html

w4568 发表于 2014-6-17 10:48:36


感谢分享!!!

w4568 发表于 2014-6-17 10:48:45


感谢分享!!!

guangu 发表于 2014-6-20 09:38:24


感谢分享

makerpolo 发表于 2014-6-23 09:12:33


可以测试下
页: [1]
查看完整版本: 【转】destoon系统设置普通会员不自动绑定二级域名