tongji_1.php
来自「仿榕树下文章系统春节版 1. 将makpass.php文件的root_pass修」· PHP 代码 · 共 243 行
PHP
243 行
<?
include ("admin_log.php");
include ("xqfunc.php");
include ("../config.php");
//==========================================================
//构造模块
if ($forum=="all") {
$msg="请您选择统计分类";
$turn_page="tongji.php";
error_1($msg,$turn_page);
exit;
}
if ($action=="list") tj_forum_list();
if ($action=="tj_forum" and $work=="new") tj_forum_new();
if ($action=="tj_forum" and $work=="hot") tj_forum_hot();
if ($action=="tj_index" and $work=="new") tj_index_new();
if ($action=="tj_index" and $work=="hot") tj_index_hot();
//=============================================================================
function tj_forum_list()
//从新统计文章列表
{ global $forum;
$open=opendir("../data/$forum/");
while ($username=readdir($open)) {
$aaa=explode(".",$username);
if ($aaa[1]=="num") {
$user=file("../data/$forum/".$username);
$user_array[$user[0]]=$user[0];
}
}
closedir($open);
@asort($user_array);
@reset($user_array);
$fp=@fopen("../data/$forum/list.php","w");
fclose($fp);
//循环
$fp=fopen("../data/$forum/list.php","a");
for ($counter=0; $counter<count($user_array); $counter++) {
$file_new_sort=@key($user_array);
//执行写入操作
$forum_list=$file_new_sort."|".$forum."|"."\n";
fwrite($fp,$forum_list);
if (!(@next($user_array))) break;
}
fclose($fp);
$msg="您成功统计了本分类文章列表";
$turn_page="tongji.php";
error_1($msg,$turn_page);
exit;
} // end func
//=============================================================================
function tj_forum_hot()
//统计版块最热文章
{ global $forum,$page_list_hot;
$file_hot_sort=file("../data/$forum/list.php");
$file_hot_count=count($file_hot_sort);
for ($j=0;$j<$file_hot_count;$j++){
$file_hot_name=explode("|",$file_hot_sort[$j]);
if ( "$file_hot_name[0]" && "$file_hot_name[0]" != '.' && "$file_hot_name[0]" != '..') {
$file_hot_array=file("../data/$forum/$file_hot_name[0].num");
$file_hot_info=explode("|",$file_hot_array[0]);
$filelist_array_hot[$file_hot_array[0]]=$file_hot_info[17];
}
}
@arsort($filelist_array_hot);
@reset($filelist_array_hot);
//清空文件
$fp=@fopen("../data/".$forum.".hot","w");
fclose($fp);
//循环
$fp=fopen("../data/".$forum.".hot","a");
for ($counter=1; $counter<=$page_list_hot; $counter++) {
$file_new_sort=@key($filelist_array_hot);
$file_new_info=explode("|",$file_new_sort);
if ( "$file_new_info[0]" && "$file_new_info[0]" != '.' && "$file_new_info[0]" != '..') {
//执行写入操作
$forum_list=$file_new_info[0]."|".$forum."|"."\n";
fwrite($fp,$forum_list);
if (!(@next($filelist_array_hot))) break;
}
}
fclose($fp);
$msg="您成功统计了本分类最热门文章";
$turn_page="tongji.php";
error_1($msg,$turn_page);
exit;
} // end func
//=============================================================================
function tj_forum_new()
//统计版块最新文章
{ global $forum,$page_list_new;
$file_hot_sort=file("../data/$forum/list.php");
$file_hot_count=count($file_hot_sort);
for ($j=0;$j<$file_hot_count;$j++){
$file_hot_name=explode("|",$file_hot_sort[$j]);
if ( "$file_hot_name[0]" && "$file_hot_name[0]" != '.' && "$file_hot_name[0]" != '..') {
$file_hot_array=file("../data/$forum/$file_hot_name[0].num");
$file_hot_info=explode("|",$file_hot_array[0]);
$filelist_array_hot[$file_hot_array[0]]=$file_hot_info[0];
}
}
@asort($filelist_array_hot);
@reset($filelist_array_hot);
//清空文件
$fp=@fopen("../data/".$forum.".new","w");
fclose($fp);
//循环
$fp=fopen("../data/".$forum.".new","a");
for ($counter=1; $counter<=$page_list_new; $counter++) {
$file_new_sort=@key($filelist_array_hot);
$file_new_info=explode("|",$file_new_sort);
if ( "$file_new_info[0]" && "$file_new_info[0]" != '.' && "$file_new_info[0]" != '..') {
//执行写入操作
$forum_list=$file_new_info[0]."|".$forum."|"."\n";
fwrite($fp,$forum_list);
if (!(@next($filelist_array_hot))) break;
}
}
fclose($fp);
$msg="您成功统计了本分类最新文章";
$turn_page="tongji.php";
error_1($msg,$turn_page);
exit;
} // end func
//=============================================================================
function tj_index_new()
//
{ global $page_new;
$file_sort=file("../data/"."xq.php");
$file_count=count($file_sort);
for ($i=0;$i<$file_count;$i++) {
$file_name=explode("|",$file_sort[$i]);
if ($file_name[0]=="type") {
$forum=$file_name[1];
//循环
$file_hot_sort=file("../data/$forum/list.php");
$file_hot_count=count($file_hot_sort);
for ($j=0;$j<$file_hot_count;$j++){
$file_hot_name=explode("|",$file_hot_sort[$j]);
if ( "$file_hot_name[0]" && "$file_hot_name[0]" != '.' && "$file_hot_name[0]" != '..') {
$file_hot_array=file("../data/$forum/$file_hot_name[0].num");
$file_hot_info=explode("|",$file_hot_array[0]);
$filelist_array_hot[$file_hot_array[0]."|".$forum]=$file_hot_info[0];
}
}
//循环结束
}
}
//===============================
@asort($filelist_array_hot);
@reset($filelist_array_hot);
//清空文件
$fp1=@fopen("../data/xq.new","w");
fclose($fp1);
//循环
//exit(count($filelist_array_hot));
$fp=fopen("../data/xq.new","a");
for ($counter=1; $counter<=$page_new; $counter++) {
next($filelist_array_hot);
$file_new_sort=@key($filelist_array_hot);
$file_new_info=explode("|",$file_new_sort);
if ( "$file_new_info[0]" && "$file_new_info[0]" != '.' && "$file_new_info[0]" != '..') {
//执行写入操作
$forum_list=$file_new_info[0]."|".$file_new_info[23]."|"."\n";
fwrite($fp,$forum_list);
//if (!(@next($filelist_array_hot))) break;
}
}
fclose($fp);
//显示提示信息
$msg="您成功统计了首页最新文章";
$turn_page="tongji.php";
error_1($msg,$turn_page);
exit;
} // end func
//=============================================================================
function tj_index_hot()
//
{ global $forum,$page_hot;
$file_sort=file("../data/"."xq.php");
$file_count=count($file_sort);
for ($i=0;$i<$file_count;$i++) {
$file_name=explode("|",$file_sort[$i]);
if ($file_name[0]=="type") {
$forum=$file_name[1];
//循环
$file_hot_sort=file("../data/$forum/list.php");
$file_hot_count=count($file_hot_sort);
for ($j=0;$j<$file_hot_count;$j++){
$file_hot_name=explode("|",$file_hot_sort[$j]);
if ( "$file_hot_name[0]" && "$file_hot_name[0]" != '.' && "$file_hot_name[0]" != '..') {
$file_hot_array=file("../data/$forum/$file_hot_name[0].num");
$file_hot_info=explode("|",$file_hot_array[0]);
$filelist_array_hot[$file_hot_array[0]."|".$forum]=$file_hot_info[17];
}
}
//循环结束
}
}
//===============================
@arsort($filelist_array_hot);
@reset($filelist_array_hot);
//清空文件
$fp1=@fopen("../data/xq.hot","w");
fclose($fp1);
//循环
//exit(count($filelist_array_hot));
$fp=fopen("../data/xq.hot","a");
for ($counter=1; $counter<=$page_hot; $counter++) {
next($filelist_array_hot);
$file_new_sort=@key($filelist_array_hot);
$file_new_info=explode("|",$file_new_sort);
if ( "$file_new_info[0]" && "$file_new_info[0]" != '.' && "$file_new_info[0]" != '..') {
//执行写入操作
$forum_list=$file_new_info[0]."|".$file_new_info[23]."|".$file_new_info[17]."|\n";
fwrite($fp,$forum_list);
//if (!(@next($filelist_array_hot))) break;
}
}
fclose($fp);
//显示提示信息
$msg="您成功统计了首页最新文章";
$turn_page="tongji.php";
error_1($msg,$turn_page);
exit;
} // end func
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?