add.php
来自「仿榕树下文章系统春节版 1. 将makpass.php文件的root_pass修」· PHP 代码 · 共 204 行
PHP
204 行
<?
include ("admin_log.php");
@include ("../config.php");
include ("../makepass.php");
include ("xqfunc.php");
////////////////////写入版块///////////////////////////////////////
if (empty($title) or empty($f_introduction)) {
$msg="您还没有添加文章标题和文章内容";
$turn_page="write.php";
error_0($msg,$turn_page);
exit;
}
if ($sortid=="all") {
$msg="您还没有选择文章:$title 的二级分类";
$turn_page="write.php";
error_0($msg,$turn_page);
exit;
}
$mingzi=time();
$xqdate = date("Y.m.d H:i");
$f_introduction=str_replace("\n","<br>",$f_introduction);
$f_introduction=str_replace("|","│",$f_introduction);
$f_introduction=str_replace("\t","",$f_introduction);
$f_introduction=str_replace("\r","",$f_introduction);
$f_introduction=str_replace('src=\"','&xqzpic',$f_introduction);
$f_introduction=str_replace('\"','&xqypic',$f_introduction);
$title=safe_cover($title);
$author=safe_cover($author);
$fromsite=safe_cover($fromsite);
$f_image=safe_cover($f_image);
$download=safe_cover($download);
$fromwho=safe_cover($fromwho);
$key=safe_cover($key);
$mingzi=time();
$num_time=date("m").date("d");
//格式化标题
if ($label==1) $title = $title."<font color=red>[图文]</font>";
if ($label==3) $title = $title."<font color=red>[cool]</font>";
if ($label==4) $title = "<b>".$title."</b>";
if ($label==5) $title = "<font color=red>".$title."</font>";
//
$article ="$mingzi|$title|$author|$fromsite|$f_image|$download|$xqdate|$message|$key|$tuijian|$fromwho|$speid|$mode||=|$num_time|0|0|0|0|||";
if ($statu==1){
if (!file_exists("../data/$sortid/$mingzi.num")) {
$fp=fopen("../data/$sortid/$mingzi.num","w");
flock($fp,3);
fwrite($fp,$article);
fclose($fp);}
if (!file_exists("../data/$sortid/$mingzi.txt")) {
$fp=fopen("../data/$sortid/$mingzi.txt","w");
flock($fp,3);
fwrite($fp,$f_introduction);
fclose($fp);}
if (file_exists("../data/$sortid/list.php")) {
$fp=fopen("../data/$sortid/list.php","a+");
flock($fp,3);
fwrite($fp,"$mingzi|$sortid|\n");
fclose($fp);}
if ($tuijian =="1") {
//////////////////////分类推荐文章/////////////////////////////////////
$dir="../data/$sortid.tui";
$file_new=$mingzi."|".$sortid."|"."\n";
$file_num=15;
add_new_file($dir,$file_new,$file_num);
//////////////////////总的推荐文章////////////////////////////////////////
$dir="../data/xq.tui";
$file_num=15;
add_new_file($dir,$file_new,$file_num);
}
////////////////////发送邮件////////////////////////////////////////
if ($sent_file == 1){
$file_sort=file("../data/$user/user".".mail");
$file_count=count($file_sort)-1;
for ($i=0;$i<=$file_count;$i++) {
$file_name=explode("|",$file_sort[$i]);
if ($file_name[2]==$sortid or $file_name[2]=="all"){
$f_introduction =str_replace("<br>","\n",$f_introduction );
$f_introduction =strip_tags($f_introduction );
mail($file_name[0],$title,"
这是你在\"$web_title\"订阅的文章\"<$title>\":
///////////////////////////////////////////////////////////////////////////////
$f_introduction
///////////////////////////////////////////////////////////////////////////////
欢迎访问{$web_title}文章管理中心\n
{$file_url}\n
此邮件由:奇迹数码管理中心发送。\n
技术支持:http://jlqiji.wo.to
","From:\"$web_title\"<$web_mail>");
}
}
}
///////////////////写入关键字////////////////////////
if (!empty($key)){
if (file_exists("../data/key/$key.key")){
$fp=fopen("../data/key/$key.key","a+");
flock($fp,3);
fwrite($fp,"$mingzi|$sortid|\n");
fclose($fp);}
else {
$fp=fopen("../data/key/$key.key","w");
flock($fp,3);
fwrite($fp,"$mingzi|$sortid|\n");
fclose($fp);
}
}
//////////////////////分类最新文章/////////////////////////////////////
$dir="../data/$sortid.new";
$file_new=$mingzi."|".$sortid."|"."\n";
$file_num=15;
add_new_file($dir,$file_new,$file_num);
//////////////////////总的最新文章////////////////////////////////////////
$dir="../data/xq.new";
$file_num=15;
add_new_file($dir,$file_new,$file_num);
////////////分类最热文章/////////////////////////
$file_typehot=file("../data/$sortid.hot");
$file_typehot_count=count($file_typehot);
if ($file_typehot_count<15){
$fp_typehot=fopen("../data/$sortid.hot","a+");
flock($fp_typehot,3);
fwrite($fp_typehot,"$mingzi|$sortid|1|\n");
fclose($fp_typehot);
}
////////////总类最热文章//////////////////////////////
$file_typehot=file("../data/xq.hot");
$file_typehot_count=count($file_typehot);
if ($file_typehot_count<15){
$fp_typehot=fopen("../data/xq.hot","a+");
flock($fp_typehot,3);
fwrite($fp_typehot,"$mingzi|$sortid|1|\n");
fclose($fp_typehot);
}
////////////写入分类计数器//////////////////////////
$file_hot=file("../data/xq.php");
$file_hot_count=count($file_hot)-1;
$fp_hot=fopen("../data/xq.php","w");
flock($fp_hot,3);
for ($i=0;$i<=$file_hot_count;$i++){
$file_hot_code=explode("|",$file_hot[$i]);
if ($sortid==$file_hot_code[1]) {
$new_file =$file_hot_code[4]+1;
fwrite($fp_hot,$file_hot_code[0]."|".$file_hot_code[1]."|".$file_hot_code[2]."|".$file_hot_code[3]."|".$new_file."|".$file_hot_code[5]."|".$file_hot_code[6]."|".$file_hot_code[7]);}
else
fwrite($fp_hot,$file_hot[$i]);
}
fclose($fp_hot);
/////////////////写入小专集//////////////////////////////
if ($speid!="all"){
$file_spe=file("../data/xq.cgi");
$file_spe_count=count($file_spe)-1;
$fp_spe=fopen("../data/xq.cgi","w");
flock($fp_spe,3);
for ($i=0;$i<=$file_spe_count;$i++){
$file_spe_code=explode("|",$file_spe[$i]);
if ($speid===$file_spe_code[1]) {
$new_file =$file_spe_code[4]+1;
fwrite($fp_spe,$file_spe_code[0]."|".$file_spe_code[1]."|".$file_spe_code[2]."|".$file_spe_code[3]."|".$new_file."|".$file_spe_code[5]."|".$file_spe_code[6]);}
else
fwrite($fp_spe,$file_spe[$i]);
}
fclose($fp_spe);
$fp=fopen("../data/spe/$speid.spe","a+");
flock($fp,3);
fwrite($fp,$mingzi."|".$sortid."|"."\n");
fclose($fp);}
//////////显示文章提交成功界面////////////////////////
$msg="您成功添加文章:$title";
$turn_page="write.php";
error_1($msg,$turn_page);
exit;
}
if ($statu==0){
if (!file_exists("../data/$sortid/$mingzi.wait")) {
$fp=fopen("../data/$sortid/$mingzi.wait","w");
flock($fp,3);
fwrite($fp,$article);
fclose($fp);
if (!file_exists("../data/$sortid/$mingzi.txt")) {
$fp=fopen("../data/$sortid/$mingzi.txt","w");
flock($fp,3);
fwrite($fp,$f_introduction);
fclose($fp);}
/////////////////////////////////////////////////////////////////////////
$msg="您成功添加后选文章文章:$title";
$turn_page="write.php";
error_1($msg,$turn_page);
exit;
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?