本帖最后由 brairuide 于 2009-9-2 20:53 编辑
在首页文件index.php中修改
找到empty($_SCONFIG
把empty去掉,(后台隐私设置,游客开放浏览不要关闭)
以下给出首页代码及简单解释:
<?php
include_once('./common.php');
if(is_numeric($_SERVER['QUERY_STRING'])) {
showmessage('enter_the_space', "space.php?uid=$_SERVER[QUERY_STRING]", 0);
}
//二级域名
if(!isset($_GET['do']) && $_SCONFIG['allowdomain']) {
$hostarr = explode('.', $_SERVER['HTTP_HOST']);
$domainrootarr = explode('.', $_SCONFIG['domainroot']);
if(count($hostarr) > 2 && count($hostarr) > count($domainrootarr) && $hostarr[0] != 'www' && !isholddomain($hostarr[0])) {
showmessage('enter_the_space', $_SCONFIG['siteallurl'].'space.php?domain='.$hostarr[0], 0);
}
}
if($_SGLOBAL['supe_uid']) {
//已登录,直接跳转个人首页
showmessage('enter_the_space', 'space.php?do=home', 0);
}
if(($_SCONFIG['networkpublic'])) { //随便看看是否公开 0为关闭1为打开
$cachefile = S_ROOT.'./data/cache_index.txt';
$cachetime = @filemtime($cachefile);
$spacelist = array();
if($_SGLOBAL['timestamp'] - $cachetime > 900) {
//20位热门用户
$query = $_SGLOBAL['db']->query("SELECT s.*, sf.resideprovince, sf.residecity
FROM ".tname('space')." s
LEFT JOIN ".tname('spacefield')." sf ON sf.uid=s.uid
ORDER BY s.friendnum DESC LIMIT 0,10");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$spacelist[] = $value;
}
swritefile($cachefile, serialize($spacelist));
} else {
$spacelist = unserialize(sreadfile($cachefile));
}
//应用
$myappcount = 0;
$myapplist = array();
if($_SCONFIG['my_status']) {
$myappcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('myapp')." WHERE flag>='0'"), 0);
if($myappcount) {
$query = $_SGLOBAL['db']->query("SELECT appid,appname FROM ".tname('myapp')." WHERE flag>=0 ORDER BY flag DESC, displayorder LIMIT 0,7");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$myapplist[] = $value;
}
}
}
//实名
foreach ($spacelist as $key => $value) {
realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
}
realname_get();
$_TPL['css'] = 'network'; //模板样式为network.css
include_once template("index"); //调用主页模版template/default/index.htm
} else { //否则
include_once(S_ROOT.'./source/network.php'); //调用主页模版./source/network.php(随便看看首页)
}
?>
演示地址:开心空间 |