📄 user_addblog.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/usercode.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/function.asp"-->
<%
if CheckUserLogined()=False then
response.Redirect "user_login.asp"
end if
if userlevel=6 then
response.Write("对不起!你还未通过审核,不能进入后台管理!")
response.End()
end if
dim needclassid,user_showlogword_num
needclassid=Application(cachename&"info")(3)
set rs=conn.execute("select user_showlogword_num from [user] where username='"&username&"'")
user_showlogword_num=rs(0)
set rs=nothing
call getteam()
sub getteam()
dim s,i,s1,rs,rs1
set rs=server.createobject("adodb.recordset")
rs.open "select blogteam.mainuser,[user].blogname from blogteam,[user] where blogteam.otheruser='"&username&"' and blogteam.mainuser=[user].username",conn,1,1
if not rs.eof then
response.write "<script language=""JavaScript"">"&vbcrlf
s = "var p_array = new Array(" + cstr(rs.recordcount-1) + ");"&vbcrlf
response.write s
s = "var p_array_id = new Array(" + cstr(rs.recordcount-1) + ");"&vbcrlf
response.write s
i = 0
while not rs.eof
set rs1=server.createobject("adodb.recordset")
rs1.open "select id,subjectname from subject where username='"&rs("mainuser")&"'",conn,1,1
s = "var p"+cstr(rs("mainuser"))+"_array = Array("
s1 = "var p"+cstr(rs("mainuser"))+"_array_id = Array("
if rs1.recordcount > 0 then
while not rs1.eof
if trim(rs1("subjectname"))<>"" then
s = s + """" + htmlencode(rs1("subjectname")) + """"
s1 = s1 + """" + cstr(rs1("id")) + """"
s = s + ","
s1 = s1 + ","
end if
rs1.movenext
wend
s = s + """" + "不选择专题" + """"
s1 = s1 + """" + cstr(0) + """"
else
s = s + """" + "无可用专题" + """"
s1 = s1 + """" + cstr(0) + """"
end if
s = s+ ");"&vbcrlf
s1 = s1+ ");"&vbcrlf
response.write s
response.write s1
response.write "p_array["+cstr(i)+"] = p"+cstr(rs("mainuser"))+"_array;"&vbcrlf
response.write "p_array_id["+cstr(i)+"] = p"+cstr(rs("mainuser"))+"_array_id;"&vbcrlf
i = i + 1
rs.movenext
wend
response.write "</script>"&vbcrlf
rs.close
set rs=nothing
rs1.close
set rs1=nothing
end if
end sub
%>
<SCRIPT language=javascript>
function del_space(s)
{
for(i=0;i<s.length;++i)
{
if(s.charAt(i)!=" ")
break;
}
for(j=s.length-1;j>=0;--j)
{
if(s.charAt(j)!=" ")
break;
}
return s.substring(i,++j);
}
function VerifySubmit()
{
submits();
topic = del_space(document.theForm.topic.value);
if (topic.length == 0)
{
alert("您忘了填写题目!");
return false;
}
var needclassid=<%=needclassid%>
if (needclassid==true) {
if (document.theForm.classid.value == 0)
{
alert("请选择日志的类别!");
return false;
}
}
showword = del_space(document.all("showword").value);
for(i = 0; i < showword.length; i++){
if(showword.charAt(i) < "0" || showword.charAt(i) > "9"){
alert("请输入正确的显示字数!");
return false;
}
}
if (document.theForm.edit.value == "")
{
alert("请输入日志内容!");
return false;
}
var date=document.theForm.selecty.value+"-"+document.theForm.selectm.value+"-"+document.theForm.selectd.value
var datereg=/^(\d{4})-(\d{1,2})-(\d{1,2})$/
var datareg=/^(\d){1,2}$/
if (!datereg.test(date)){
alert("日志时间输入格式错误");
return false;
}
var r=date.match(datereg)
var d=new Date(r[1],r[2]-1,r[3])
if (!(d.getFullYear()==r[1]&&d.getMonth()==r[2]-1&&d.getDate()==r[3])){
alert("日志时间输入格式错误");
return false;
}
var FormLimit = 51100
var TempVar = new String
TempVar = document.theForm.edit.value
if (TempVar.length > FormLimit)
{
if (confirm("您要发布的日志太长,建议您拆分为几部分分别发布。\n如果您坚持提交,注意需要较长时间才能提交成功。\n\n是否坚持提交?") == false)
return false;
}
if (TempVar.length > FormLimit)
{
document.theForm.edit.value = TempVar.substr(0, FormLimit)
TempVar = TempVar.substr(FormLimit)
while (TempVar.length > 0)
{
var objTEXTAREA = document.createElement("hidden")
objTEXTAREA.name = "logtext"
objTEXTAREA.value = TempVar.substr(0, FormLimit)
document.theForm.appendChild(objTEXTAREA)
TempVar = TempVar.substr(FormLimit)
}
}
return true;
}
function setSort(s1,s2)
{
param=s1.selectedIndex-1;
if(param>=0)
{
s2.options.length=0;
for(i=0;i<p_array[param].length;i++)
{
s2.options.length++;
s2.options[i].text=p_array[param][i];
s2.options[i].value=p_array_id[param][i];
}
}else
{
s2.options.length=0;
s2.options.length++;
s2.options[0].text="我的专题";
s2.options[0].value="0";
}
}
</script>
<html>
<head>
<title>后台管理--添加新日志</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="Admin_STYLE.CSS">
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" >
<br><FORM action="user_saveblog.asp" target='_top' method="post" name="theForm" id="theForm" onSubmit="return VerifySubmit()">
<table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
<tr align="center">
<td height=25 colspan=5 class="topbg"><strong>添 加 新 日 志</strong>
<tr>
<td width="11%" class="tdbg" height=23>日志标题:</td>
<td width="89%" colspan="4" class="tdbg"><input name="topic" type=text class="cont" id="topic" size="50" maxlength="50">
<font color="#FF0000"> *</font></td>
</tr>
<tr>
<td width="11%" class="tdbg" height=23>日志心情:</td>
<td colspan="4" class="tdbg">
<input type="radio" name="face" value="0">
无
<input name="face" type="radio" value="1" checked>
<img src="images/face/1.gif" width="20" height="20">
<input type="radio" name="face" value="2">
<img src="images/face/2.gif" width="20" height="20">
<input type="radio" name="face" value="3">
<img src="images/face/3.gif" width="20" height="20">
<input type="radio" name="face" value="4">
<img src="images/face/4.gif" width="20" height="20">
<input type="radio" name="face" value="5">
<img src="images/face/5.gif" width="20" height="20">
<input type="radio" name="face" value="6">
<img src="images/face/6.gif" width="18" height="20">
<input type="radio" name="face" value="7">
<img src="images/face/7.gif" width="20" height="20">
<input type="radio" name="face" value="8">
<img src="images/face/8.gif" width="20" height="20">
<input type="radio" name="face" value="9">
<img src="images/face/9.gif" width="20" height="20"> </td>
</tr>
<tr>
<td height=23 colspan="5" class="tdbg">系统分类:
<select name="classid" id="classid">
<option value="0" selected>请选择分类</option>
<%
set rs=conn.execute("select id,classname from classname")
do while not rs.eof %>
<option value=<%=rs(0)%>><%=rs(1)%></option>
<%
rs.movenext
loop
%>
</select>
我的专题(分类):
<select name="subjectid" id="subjectid">
<option value="0" selected>不选择</option>
<%
dim rs
set rs=conn.execute("select id,subjectname from subject where username='"&username&"'")
do while not rs.eof %>
<option value=<%=rs(0)%>><%=rs(1)%></option>
<%
rs.movenext
loop
%>
</select>
是否隐藏这篇日志:
<select name="ishide" id="ishide">
<option value="true">是</option>
<option value="false" selected>否</option>
</select></td>
</tr>
<tr>
<td height=23 colspan="5" class="tdbg">日志密码:
<input name="ispassword" type="password" id="ispassword" size="15" maxlength="15">
(无密码请留空 ) 部分显示字数:
<input name="showword" type="text" id="showword" value="<%=user_showlogword_num%>" size="6" maxlength="10">
(全部显示请留空)
<input type="hidden" id="edit" name="edit" value="">
<!--#include file="edit.asp"-->
</td>
</tr>
<tr>
<td height=23 colspan="5" class="tdbg"> 团队博客:
<select name="blogteam" id="s1" onChange="setSort(this,this.form.s2);">
<option value="<%=username%>" >我的BLOG</option>
<%
set rs=conn.execute("select blogteam.mainuser,[user].blogname,blogteam.id from blogteam,[user] where blogteam.otheruser='"&username&"' and blogteam.mainuser=[user].username")
do while not rs.eof %>
<option value=<%=rs(0)%>><%=rs(1)%></option>
<%
rs.movenext
loop
set rs=nothing
%>
</select>
(选择日志发表在哪个BLOG) 团队博客专题:
<select name="blogteamsubject" id="s2">
<option value="0" selected>我的专题</option>
</select>
</td>
</tr>
<tr>
<td height=23 colspan="5" class="tdbg">引用地址:
<input name="url" type="text" id="url" size="60"></td>
</tr>
<tr>
<td height=23 colspan="5" class="tdbg">设置发表时间:
<select name="selecty" id="selecty">
<%
dim y
y=2000
while y<=2008
if year(blognow())=y then
response.Write "<option value="&y&" selected>"&y&"</option>"
else
response.Write "<option value="&y&">"&y&"</option>"
end if
y=y+1
wend
%>
</select>
年
<select name="selectm" id="selectm" >
<%
dim m
m=1
while m<=12
if month(blognow())=m then
response.Write "<option value="&m&" selected>"&m&"</option>"
else
response.Write "<option value="&m&">"&m&"</option>"
end if
m=m+1
wend
%>
</select>
月
<select name="selectd" id="selectd" >
<%
dim d
d=1
while d<=31
if day(blognow())=d then
response.Write "<option value="&d&" selected>"&d&"</option>"
else
response.Write "<option value="&d&">"&d&"</option>"
end if
d=d+1
wend
%>
</select>
日
<select name="selecth" id="selecth">
<%
dim h
h=0
while h<=23
if hour(blognow())=h then
response.Write "<option value="&h&" selected>"&h&"</option>"
else
response.Write "<option value="&h&">"&h&"</option>"
end if
h=h+1
wend
%>
</select>
时
<select name="selectmi" id="selectmi">
<%
dim mi
mi=0
while mi<=59
if minute(blognow())=mi then
response.Write "<option value="&mi&" selected>"&mi&"</option>"
else
response.Write "<option value="&mi&">"&mi&"</option>"
end if
mi=mi+1
wend
%>
</select>
分
<select name="selects" id="selects">
<%
dim s
s=0
while s<=59
if second(blognow())=s then
response.Write "<option value="&s&" selected>"&s&"</option>"
else
response.Write "<option value="&s&">"&s&"</option>"
end if
s=s+1
wend
%>
</select>
秒
<input name="serverdate" type="hidden" id="serverdate" value=<%=date()%> ></td>
</tr>
<tr>
<td height=23 colspan="5" class="tdbg"> <INPUT type="hidden" name="action" value="addlog">
<input type="submit" name="Submit2" value="提交日志">
<input type="reset" name="Submit" value="清除重写">
</td>
</tr>
</table>
</form>
<%
%>
<br>
<div align="center"><BR>
<BR>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -