userput.php
来自「仿榕树下文章系统春节版 1. 将makpass.php文件的root_pass修」· PHP 代码 · 共 295 行
PHP
295 行
<?
require("config.php");
require("xqfunc.php");
include ("makepass.php");
require("head.php");
head_form();
echo " <img src=./images/mail.gif heigth=16> 发表文章:\n";
if (!isset($mode)) {
$mode="index";
}
switch ($mode){
///////////////
case "index":
/////输出//////
echo "<TABLE bgColor=$biankuang_color border=0 cellPadding=3 cellSpacing=1 width=735>\n";
echo "<TBODY>\n";
echo "<TR bgColor=$fuse_color>\n";
echo "<TD valign=\"top\" align=\"center\" width=\"28%\" rowspan=\"13\">\n";
echo " <TABLE width=\"90%\">\n";
echo " <TBODY>\n";
echo " <TR>\n";
echo " <TD ><br><br><B>发表文章说明: </B><BR>\n";
echo " 1、访客只需要填写呢称,不需要填写密码 ,但文章要等到管理员通过才可以显示出来。<BR>\n";
echo " 2、注册用户如果填写呢称和密码,发表文章可以直接显示出来。<BR>\n";
echo " </TD>\n";
echo " </TR>\n";
echo " </TBODY>\n";
echo " </TABLE>";
echo "</TD><FORM action=$PHP_SELF?mode=useradd method=post>\n";
echo "<TD align=middle colspan=\"2\"><div align=\"left\"><BR><b>发表文章:(不支持htm代码)</b></div>";
echo "</TD>\n";
echo "</TR>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 标 题:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\"><INPUT type=\"TEXT\" name=\"title\" SIZE=36 VALUE=\"\" class=border style='color: #000000; background-color: $fuse_color'> *必须填写</TD>\n";
echo "</TR>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 作 者:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\"><INPUT type=\"TEXT\" name=\"author\" SIZE=36 VALUE=\"\"class=border style='color: #000000; background-color: $fuse_color'> </TD>\n";
echo "</TR>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 来 源:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\"><INPUT type=\"TEXT\" name=\"fromsite\" SIZE=36 VALUE=\"\"class=border style='color: #000000; background-color: $fuse_color'> </TD>\n";
echo "</TR>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 正 文:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\"><textarea name=\"f_introduction\" rows=\"15\" cols=\"68\" class=border style='color: #000000; background-color: $fuse_color'></textarea>*必填</TD>\n";
echo "</TR>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 类 别:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\">";
echo "<select name=sortid size=1 style=\"BACKGROUND-COLOR: $fuse_color; BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; COLOR: #000000\">\n";
echo "<option selected value=all>-=选择版块=-</option>\n";
echo $get_type_name;
echo "</select>\n";
echo "</TD>\n";
echo "</TR>\n";
echo "</TR>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 专 题:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\">";
echo "<select name=speid size=1 style=\"BACKGROUND-COLOR: $fuse_color; BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; COLOR: #000000\">\n";
echo "<option selected value=all>-=选择专题=-</option>\n";
get_spe();
echo "</select>*若不想加入任何专题,请不要选择。\n";
echo "</td>\n";
echo "</tr>\n";
echo "<TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 关键字:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\"><INPUT type=\"TEXT\" name=\"key\" SIZE=36 VALUE=\"\" class=border style='color: #000000; background-color: $fuse_color'> </TD>\n";
echo "</TR>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"8%\"> <div align=\"center\"><FONT COLOR='#092F7B'> 附 件:</FONT></div></TD>\n";
echo "<TD BGCOLOR=\"$fuse_color\" width=\"64%\"><INPUT type=\"TEXT\" name=\"download\" SIZE=36 VALUE=\"\" class=border style='color: #000000; background-color: $fuse_color'> 填写URL地址</TD>\n";
echo "</TR>\n";
echo "<TR bgColor=$fuse_color>\n";
echo "<TD align=middle colspan=\"2\"><div align=\"left\"><BR><b>若您是注册用户,请填写密码,否则只需填写呢称:</b></div>\n";
echo "</TD>\n";
echo "</TR>\n";
echo "<TR bgColor=$fuse_color>\n";
echo "<TD align=middle width=\"8%\"><FONT COLOR='#092F7B'>呢 称: </FONT></TD><TD align=middle width=\"64%\"><div align=\"left\">\n";
echo "<input type=\"TEXT\" maxlength=16 name=fromwho class=border style='color: #000000; background-color: $fuse_color'></div>\n";
echo "</TD>\n";
echo "</TR>\n";
echo "<TR bgColor=$fuse_color>\n";
echo "<TD align=middle width=\"8%\"><FONT COLOR='#092F7B'>密 码:</FONT></TD><TD align=middle width=\"64%\"><div align=\"left\">\n";
echo "<input type=\"password\" maxlength=8 name=sent_pass class=border style='color: #000000; background-color: $fuse_color'></div>\n";
echo "</TD>\n";
echo "</TR>\n";
echo "<TR bgColor=$fuse_color>\n";
echo "<TD align=middle colspan=\"2\"><div align=\"center\">";
echo "<input class=border name=search style=\"BACKGROUND-COLOR: $main_color; COLOR: #000000\" type=reset value=\" 取 消 \">\n";
echo " <input class=border name=search style=\"BACKGROUND-COLOR: $main_color; COLOR: #000000\" type=submit value=\" 确 定 \">\n";
echo "</div>\n";
echo "</TD>\n";
echo "</FORM>\n";
echo "</TR>\n";
echo "</TBODY>\n";
echo "</TABLE>\n";
echo "</td>\n";
echo "<TR><TD colspan='2' vAlign=top width='100%'><P align=right class=small><A href='http://jlqiji.wo.to/'></A></P></TD></TR></TBODY></TABLE></DIV></TD></TR>\n";
echo "</table>\n";
echo "<hr width=735 color=$biankuang_color>\n";
require("foot.php");
////////////////////
break;
case "useradd":
//////////////////
if (empty($title) or empty($f_introduction)) {
$msg="您还没有添加文章标题和文章内容";
$turn_page="userput.php";
error_0($msg,$turn_page);
exit;
}
if ($sortid=="all") {
$msg="您还没有选择文章:$title 的二级分类";
$turn_page="userput.php";
error_0($msg,$turn_page);
exit;
}
$mingzi=time();
$xqdate = date("Y.m.d H:i");
$title=safe_cover($title);
$author=safe_cover($author);
$fromsite=safe_cover($fromsite);
$key=safe_cover($key);
$fromwho=safe_cover($fromwho);
$sent_pass=safe_cover($sent_pass);
$f_introduction=safe_cover($f_introduction);
$download=safe_cover($download);
$message=0;
$article ="$mingzi|$title|$author|$fromsite|$f_image|$download|$xqdate|$message|$key|$tuijian|$fromwho|$speid|||=|$num_time|0|0|0|0|||";
////////////////////////////
$file_sort=@file("data/$user/user.pub");
$file_count=count($file_sort)-1;
$renzheng=0;
for ($i=0;$i<=$file_count;$i++) {
$file_name=explode("|",$file_sort[$i]);
if ($fromwho==$file_name[0] and $sent_pass==$file_name[1] and $guest_yz=="0" and $file_name[2]==$sortid)
$renzheng=1;
elseif ($fromwho==$file_name[0] and $sent_pass==$file_name[1] and $guest_yz=="0" and $file_name[2]=="all")
$renzheng=1;
}
if ($renzheng==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 ($sendfile == 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"){
mail($file_name[0],$title,"
这是你在\"$web_title\"订阅的文章\"<$title>\":
///////////////////////////////////////////////////////////////////////////////
$f_introduction
///////////////////////////////////////////////////////////////////////////////
","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=8;
add_new_file($dir,$file_new,$file_num);
//////////////////////总的最新文章////////////////////////////////////////
$dir="data/xq.new";
$file_num=8;
add_new_file($dir,$file_new,$file_num);
////////////分类最热文章/////////////////////////
$file_typehot=file("data/$sortid.hot");
$file_typehot_count=count($file_typehot);
if ($file_typehot_count<$page_list_hot){
$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<$page_list_hot){
$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="userput.php";
error_1($msg,$turn_page);
exit;
///////若不是注册用户////////////////////////////////////////////////////////////////////////
}
elseif($renzheng==0 and $guest_art==1){
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="您已经成功添加文章,请等待管理员认证";
$turn_page="userput.php";
error_1($msg,$turn_page);
exit;
}
else {
$msg="管理员已经禁止了发表文章";
$turn_page="userput.php";
error_0($msg,$turn_page);
exit;
}
/////////////////////////////
break;
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?