UCHome 网站首页index.php页面代码分析
2014-09-10 14:42
671 查看
<?php
02.
/*
03.
[UCenter Home] (C) 2007-2008 Comsenz Inc.
04.
$Id: index.php 2009-10-7 20:44:00
05.
@author ymaozi
06.
@copyright http://www.codedesign.cn
07.
@deprecated uchome源码交流QQ群:83400173
08.
*/
09.
10.
include_once
(
'./common.php'
);
//引入公共文件
11.
12.
//is_numeric();检测变量是否为数字
13.
if
(
is_numeric
(
$_SERVER
[
'QUERY_STRING'
])) {
14.
showmessage(
'enter_the_space'
,
"space.php?uid=$_SERVER[QUERY_STRING]"
,0);
15.
}
view sourceprint?
01.
//二级域名
02.
if
(!isset(
$_GET
[
'do'
]) &&
$_SCONFIG
[
'allowdomain'
]) {
03.
$hostarr
=
explode
(
'.'
,
$_SERVER
[
'HTTP_HOST'
]);
04.
$domainrootarr
=
explode
(
'.'
,
$_SCONFIG
[
'domainroot'
]);
05.
if
(
count
(
$hostarr
) >2 &&
count
(
$hostarr
) >
count
(
$domainrootarr
) &&
$hostarr
[0] !=
'www'
&&!isholddomain(
$hostarr
[0])) {
06.
showmessage(
'enter_the_space'
,
$_SCONFIG
[
'siteallurl'
].
'space.php?domain='
.
$hostarr
[0], 0);
07.
}
08.
}
09.
10.
if
(
$_SGLOBAL
[
'supe_uid'
]) {
11.
//已登录,直接跳转个人首页
12.
showmessage(
'enter_the_space'
,
'space.php?do=home'
,0);
13.
}
14.
15.
if
(
empty
(
$_SCONFIG
[
'networkpublic'
])) {
//是否公开”随便看看“页面
16.
17.
$cachefile
=S_ROOT.
'./data/cache_index.txt'
;
//获取首页缓存文件
18.
$cachetime
=@
filemtime
(
$cachefile
);
//缓存文件创建时间
19.
20.
$spacelist
=
array
();
//空间数组
21.
if
(
$_SGLOBAL
[
'timestamp'
] -
$cachetime
>900) {
//如果当前时间减去文件创建时间大于900秒
22.
//20位热门用户
23.
$query
=
$_SGLOBAL
[
'db'
]->query("SELECT s.*,sf.resideprovince,sf.residecity
24.
FROM
".tname('space')."
s
25.
LEFT JOIN
".tname('spacefield')."
sf ON sf.uid=s.uid
26.
ORDER BY s.friendnum DESC LIMIT 0,20");
//通过好友数排序,取前20名
27.
while
(
$value
=
$_SGLOBAL
[
'db'
]->fetch_array(
$query
)) {
28.
$spacelist
[] =
$value
;
29.
}
30.
swritefile(
$cachefile
,serialize(
$spacelist
));
//将空间数组通过serialize()转换成字符串后存入到文件中,作为缓存文件
31.
}
else
{
32.
$spacelist
=unserialize(sreadfile(
$cachefile
));
//通过unserialize();将已序列化的字符串,转换成数组
33.
}
34.
35.
//应用
36.
//获取安装的应用数
37.
$myappcount
=0;
38.
$myapplist
=
array
();
39.
if
(
$_SCONFIG
[
'my_status'
]) {
40.
$myappcount
=
$_SGLOBAL
[
'db'
]->result(
$_SGLOBAL
[
'db'
]->query(
"SELECT
COUNT(*) FROM"
.tname(
'myapp'
).
" WHERE flag>='0'"
),0);
41.
if
(
$myappcount
) {
42.
$query
=
$_SGLOBAL
[
'db'
]->query(
"SELECT appid,appname FROM"
.tname(
'myapp'
).
"
WHERE flag>=0 ORDER BY flag DESC,displayorder LIMIT 0,7"
);
43.
while
(
$value
=
$_SGLOBAL
[
'db'
]->fetch_array(
$query
)) {
44.
$myapplist
[] =
$value
;
45.
}
46.
}
47.
}
48.
49.
//实名
50.
foreach
(
$spacelist
as
$key
=>
$value
) {
51.
realname_set(
$value
[
'uid'
],
$value
[
'username'
],
$value
[
'name'
],
$value
[
'namestatus'
]);
//如果姓名存在则获取姓名,否则获取用户名
52.
}
53.
//获取实名
54.
realname_get();
55.
56.
$_TPL
[
'css'
] =
'network'
;
//设置文件的css
57.
include_once
template(
"index"
);
//引入模板文件
58.
}
else
{
//如果不公开"随便看看",则直接引入network.php文件
59.
include_once
(S_ROOT.
'./source/network.php'
);
60.
}
61.
62.
?>
相关文章推荐
- TCExam文件代码注释分析(后台首页admin/code/index.php)
- UCHome中关于公共函数(function_common.php)页面的代码分析(二)
- UCHome2.0 do_register.php用户注册页面的代码分析
- UCHome中关于公共函数(function_common.php)页面的代码分析(一)
- UCHome中数据库操作类(class_mysql.php)页面的代码分析
- 用.net实现远程获取其他网站页面内容!(核心代码分析)
- PHP实现定时生成HTML网站首页实例代码
- Discuz代码分析——index.php
- 用.net实现远程获取其他网站页面内容!(核心代码分析)
- UChome 代码分析讲解:uc_client模块的client.php文件
- 【phpcms-v9】phpcms-v9中系统管理员登陆页面控制器文件分析:phpcms/modules/admin/index.php
- uchome2.0 日志评论模块分析(php代码及js代码分析)
- 如何在html、php、jsp、asp等页面中添加分析代码(跟踪代码)
- 【phpcms-v9】index.php文件分析-前台列表页代码分析
- Discuz代码分析——index.php
- 【phpcms-v9】index.php文件分析-前台首页模板文件的解析过程分析
- UCHome 中的common.php代码分析
- 使用PHP提取视频网站页面中的FLASH地址的代码
- 用.net实现远程获取其他网站页面内容!(核心代码分析)
- 用.net实现远程获取其他网站页面内容!(核心代码分析)