📄 write2.php
字号:
<?
include ("admin_log.php");
include ("xqfunc.php");
if (!isset($mode)) {
$mode="index";
}
switch ($mode){
///////////////
case "index":
/////输出//////
$w_file=file("../data/$type/$id.num");
$w_file_info=explode("|",$w_file[0]);
$w_info=file("../data/$type/$id.txt");
$w_info[0]=str_replace('&xqzpic','src="',$w_info[0]);
$w_info[0]=str_replace('&xqypic','"',$w_info[0]);
if ($w_file_info[12]=="1") {
$checked_yes="checked";
}
elseif ($w_file_info[12]=="0") {
$checked_no="checked";
}
?>
<html>
<head>
<META http-equiv='Content-Type' content='text/html; charset=gb2312'>
<STYLE>
<!--
A:link {text-decoration:none}
A:visited {text-decoration:none}
A:hover { text-decoration:underline; color:brown;}
p,br,body,td,table,tr {color:black; font-size:9pt;}
-->
</STYLE>
<TITLE>添加新文章</TITLE>
<script>
function popup(t, w, h) {
window.open('extra/photo.php?img='+t+'&w='+w+'&h='+h+'&t='+t,'photo','width='+w+',height='+h); }
function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
function openupload() {
MM_openBrWindow("upload.php",'upload','location=no,status=yes,scrollbars=yes,resizable=yes,width=450,height=300');
}
function openupload2() {
MM_openBrWindow("upload2.php",'upload','location=no,status=yes,scrollbars=yes,resizable=yes,width=450,height=300');
}
function openpick() {
MM_openBrWindow("pick.php",'upload','location=no,status=yes,scrollbars=yes,resizable=yes,width=450,height=300');
}
function replace(string,text,by) { // from www.irt.org, supposedly..
if (string.length==0 || text.length==0) return string;
var i = string.indexOf(text);
if (((!i) && (text != string.substring(0,text.length))) || (i== -1)) return string;
var newstr = string.substring(0,i) + by;
if (i+text.length < string.length) newstr += replace(string.substring(i+ text.length, string.length), text, by);
return newstr;
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
function replace(string,text,by) { // from www.irt.org, supposedly..
if (string.length==0 || text.length==0) return string;
var i = string.indexOf(text);
if (((!i) && (text != string.substring(0,text.length))) || (i== -1)) return string;
var newstr = string.substring(0,i) + by;
if (i+text.length < string.length) newstr += replace(string.substring(i+ text.length, string.length), text, by);
return newstr;
}
function c2e(text) {
text=replace(text,"\r","");
text=replace(text,"\n","<BR>\n");
text = replace(text,"<SCRIPT>","#SCRIPT#");
text = replace(text,"</SC"+"RIPT>","#/SCRIPT#");
text = replace(text,"<BR>\n<UL>","\n<UL>");
text = replace(text,"<UL><BR>","<UL>");
text = replace(text,"</UL><BR>","</UL>");
text = replace(text,"<BR>\n<OL>","\n<OL>");
text = replace(text,"<OL><BR>","<OL>");
text = replace(text,"</OL><BR>","</OL>");
text = replace(text,"<BR>\n<LI>", "\n<LI>");
return text;
}
function e2c(text) {
// first, kick out some absolute url's
myloc=document.URL;
myloc=replace(myloc, "pivot/log.php","");
text=replace(text, myloc, "");
text=replace(text, "pivot/log.php","");
text=replace(text,"<BR>","\n");
text=replace(text,"<P>","");
text=replace(text,"</P>","\n");
text=replace(text,"STRONG>","B>");
text=replace(text,"EM>","I>");
text=replace(text,"/UL>\r\n","/UL>");
text=replace(text,"/OL>\r\n","/UL>");
text=replace(text,"#SCRIPT#","<SCRIPT>");
text=replace(text,"#/SCRIPT#","</SC"+"RIPT>");
return text;
}
function copycontenttoedit(){
text=c2e(document.all.f_introduction.value)+" ";
document.frames['edit'].setHTML(text);
}
function copyedittocontent(){
text=e2c(document.frames['edit'].getHTML());
document.all.f_introduction.value=text;
}
//-->
</script>
</head><body BGCOLOR='EFEFEF' onload='copycontenttoedit();'>
<table width=100% cellpadding=6 cellspacing=0 border=0>
<tr>
<td bgcolor=#8FB373 colspan=3><font color=#FFFFFF> <b>修改新文章</b></font>
</td>
</tr>
</table>
<form method='post' action='write2.php?mode=add' class='nopadding' name='form1'>
<table style="border-collapse: collapse" bordercolor="#111111" bgcolor=#efefef border=1 cellspacing=0 cellpadding=3 width=600><col width=66><col width=544>
<tr>
<td align=right>标题:</td>
<td ><?echo "$w_file_info[1]"?></td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>作者:</td>
<td><input type=text name=author size=20 value="<?echo "$w_file_info[2]"?>"></td>
</tr>
<tr>
<td align=right>来源:</td>
<td><input type=text name=fromsite size=20 value="<?echo "$w_file_info[3]"?>"></td>
</tr>
<tr>
<td align=right>图片:<div class="hidden"><input type='hidden' name='f_introduction' cols='80' rows='3' class='input' value='<?echo "$w_info[0]"?>'></div>
<td><input type='text' name='f_image' size='35' value='<?echo "$w_file_info[4]"?>' class='input'></td>
</tr>
<tr>
<td align=right>附件:</div>
<td><input type='text' name='download' size='35' value='<?echo "$w_file_info[5]"?>' class='input'></td>
</tr>
<tr>
<td align=right>正文:</td>
<td>
图片说明: <span class="dim">选中图片后,点击正文编辑里的插入图片按钮,将其放到正确的位置。</dim><br>
<iframe id="edit" src="editor_sm.html" width="100%" height=320 marginwidth=0 marginheight=0 frameborder=0 style="border: 0px #fff solid;"></iframe>
</td>
</tr>
<tr bgcolor=#f7f7f7>
<td align=right>分类:</td>
<td>
<?
$type_file=file("../data/xq.php");
$type_num=count($type_file)-1;
for ($i=0;$i<=$type_num;$i++) {
$type_info=explode("|",$type_file[$i]);
if ($type==$type_info[1]) {
$typename=$type_info[2];
break;}
}
echo $typename;
?>
</td>
</tr>
<tr>
<td align=right>评论:</td>
<td>允许<input type="radio" name="message_yes" value="1" <? echo $checked_yes ?>>禁止<input type="radio" name="message_yes" value="0" <? echo $checked_no ?>>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type='hidden' name='mingzi' size='10' value='<?echo "$w_file_info[0]"?>' class='input'>
<input type='hidden' name='xqdate' size='10' value='<?echo "$w_file_info[6]"?>' class='input'>
<input type='hidden' name='message' size='10' value='<?echo "$w_file_info[7]"?>' class='input'>
<input type='hidden' name='key' size='10' value='<?echo "$w_file_info[8]"?>' class='input'>
<input type='hidden' name='tuijian' size='10' value='<?echo "$w_file_info[9]"?>' class='input'>
<input type='hidden' name='fromwho' size='10' value='<?echo "$w_file_info[10]"?>' class='input'>
<input type='hidden' name='speid' size='10' value='<?echo "$w_file_info[11]"?>' class='input'>
<input type='hidden' name='num_time' size='10' value='<?echo "$w_file_info[15]"?>' class='input'>
<input type='hidden' name='a2' size='10' value='<?echo "$w_file_info[16]"?>' class='input'>
<input type='hidden' name='a3' size='10' value='<?echo "$w_file_info[17]"?>' class='input'>
<input type='hidden' name='a4' size='10' value='<?echo "$w_file_info[18]"?>' class='input'>
<input type='hidden' name='a5' size='10' value='<?echo "$w_file_info[19]"?>' class='input'>
<input type='hidden' name='title' size='10' value='<?echo "$w_file_info[1]"?>' class='input'>
<input type='hidden' name='type' size='10' value='<?echo "$type"?>' class='input'>
<input type='submit' name='submit' value='发表文章' class='button' onclick="copyedittocontent();">
<input type=reset value=" 重新填写 ">
</td>
</tr>
</table>
</form>
<br><hr>
<table width=100% cellpadding=6 cellspacing=0 border=0>
<tr>
<td bgcolor=#a6a7d9 colspan=3><font color=#FFFFFF> </font><font color=#FFFFFF><b>修改文章</b></font></td>
</tr>
</table>
</body>
</html>
<?
///////////////
break;
case "add":
/////输出//////
$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);
$article ="$mingzi|$title|$author|$fromsite|$f_image|$download|$xqdate|$message|$key|$tuijian|$fromwho|$speid|$message_yes||=|$num_time|$a2|$a3|$a4|$a5|||";
$fp=fopen("../data/$type/$mingzi.num","w");
flock($fp,3);
fwrite($fp,$article);
fclose($fp);
$fp_txt=fopen("../data/$type/$mingzi.txt","w");
flock($fp_txt,3);
fwrite($fp_txt,$f_introduction);
fclose($fp_txt);
$msg="你已经成功修改文章";
$turn_page="javascript:history.back(1);";
error_1($msg,$turn_page);
exit;
//////////////////
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -