//articleadd.asp文件
<%@language=vbscript codepage=936 %>
<%    
Const PurviewLevel=5    '操作权限
%>
<!--#include file="ChkPurview.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="../inc/config.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>添加文章</title>
<link rel="stylesheet" type="text/css" href="../index.css">
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;
function changelocation(locationid)
    {
    document.myform.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    
function CheckForm()
{
  if (editor.EditMode.checked==true)
      document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
  else
      document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; 
  if (document.myform.Title.value=="")
  {
    alert("文章标题不能为空!");
    document.myform.Title.focus();
    return false;
  }
  if (document.myform.Key.value=="")
  {
    alert("关键字不能为空!");
    document.myform.Key.focus();
    return false;
  }
  if (document.myform.Content.value=="")
  {
    alert("文章内容不能为空!");
    editor.HtmlEdit.focus();
    return false;
  }
  return true;  
}
function loadForm()
{
  editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
  return true
}
</script>
</head>
<body leftmargin="5" topmargin="10" onLoad="javascipt:setTimeout('loadForm()',1000);">
<form method="POST" name="myform" onSubmit="return CheckForm();" action="ArticleSave.asp?action=add" target="_self">
  <table width="710" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
    <tr>
      <td height="20" align="center" class="title"><b>添 加 文 章</b></td>
    </tr>
    <tr align="center">
      <td class="tdbg">
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
          <tr> 
            <td width="90" align="right">所属栏目:</td>
            <td width="250"> <%
        sql = "select * from BigClass"
        rs.open sql,conn,1,1
        if rs.eof and rs.bof then
            response.write "请先添加栏目。"
        else
        %> <select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
                <option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                <%
            dim selclass
            selclass=rs("BigClassName")
            rs.movenext
            do while not rs.eof
            %>
                <option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                <%
                rs.movenext
            loop
        end if
        rs.close
            %>
              </select> <select name="SmallClassName">
                <option value="" selected>不指定小类</option>
                <%
            sql="select * from SmallClass where BigClassName='" & selclass & "'"
            rs.open sql,conn,1,1
            if not(rs.eof and rs.bof) then
            %>
                <option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                <% rs.movenext
                do while not rs.eof%>
                <option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                <%
                    rs.movenext
                loop
            end if
            rs.close
            %>
              </select> </td>
            <td width="100" align="right"><strong>所属专题:</strong></td>
            <td width="150"><select name="SpecialName">
                <option selected value="">不属于任何专题</option>
                <%
        sql = "select * from Special"
        rs.open sql,conn,1,1
        do while not rs.eof
        %>
                <option value="<%=rs("SpecialName")%>"><%=rs("SpecialName")%></option>
                <%
                rs.movenext
            loop
            rs.close
            set rs = nothing
            conn.Close
            set conn = nothing
            %>
              </select></td>
          </tr>
          <tr> 
            <td width="90" align="right">文章标题:</td>
            <td colspan="3"><input name="Title" type="text"
           id="Title" size="80" maxlength="255"> <font color="#FF0000">*</font></td>
          </tr>
          <tr> 
            <td width="90" align="right">关键字:</td>
            <td colspan="3"><input name="Key" type="text"
           id="Key" size="50" maxlength="255"> <font color="#FF0000">*</font><br>
              用来查找相关文章,可输入多个关键字,中间用空格分开。不能出现""'*?,.()等字符。</td>
          </tr>
          <tr> 
            <td width="90" align="right">作者:</td>
            <td colspan="3"><input name="Author" type="text"
           id="Author" size="50" maxlength="30">
              <input name="Editor" type="hidden" id="Editor" value="<%=session("Admin")%>"> 
            </td>
          </tr>
          <tr> 
            <td width="90" align="right">原出处:</td>
            <td colspan="3"><input name="CopyFrom" type="text"
           id="CopyFrom" size="80" maxlength="255"></td>
          </tr>
          <tr> 
            <td width="90" align="right" valign="middle">文章内容:</td>
            <td colspan="3"><textarea name="Content" style="display:none"></textarea>
            <iframe ID="editor" src="../edit/editor.asp" frameborder=1 scrolling=no width="630" height="405"></iframe></td>
          </tr>
          <tr> 
            <td width="90" align="right">包含图片:</td>
            <td colspan="3"><input name="IncludePic" type="checkbox" id="IncludePic" value="true">
              是<font color="#0000FF">(如果选中的话会在标题前面显示[图文])</font></td>
          </tr>
          <tr> 
            <td align="right">首页图片:</td>
            <td colspan="3"><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="56" maxlength="200">
              用于在首页的图片文章处显示 <br>
              直接从上传图片中选择: 
              <select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
                <option selected>不指定首页图片</option>
              </select> <input name="UploadFiles" type="hidden" id="UploadFiles"> 
            </td>
          </tr>
          <% if session("purview")<>"" and session("purview")<=2 then %>
          <tr> 
            <td width="90" align="right">已通过审核:</td>
            <td colspan="3"><input name="Passed" type="checkbox" id="Passed" value="true" checked>
              是<font color="#0000FF">(如果选中的话将直接发布)</font></td>
          </tr>
          <tr> 
            <td width="90" align="right">文章性质:</td>
            <td colspan="3"><input name="OnTop" type="checkbox" id="OnTop" value="true">
              固顶文章     <input name="Hot" type="checkbox" id="Hot" value="true" onClick="javascript:document.myform.Hits.value=<%=HitsOfHot%>">
              热点文章     <input name="Elite" type=checkbox id="Elite" value="true">
              推荐文章 </td>
          </tr>
          <tr>
            <td align="right">点击数:</td>
            <td colspan="3"><input name="Hits" type="text" id="Hits" value="0" size="10" maxlength="10">
                 <font color="#0000FF">这功能是提供给管理员作弊用的。不过尽量不要用呀!^_^</font></td>
          </tr>
          <tr> 
            <td width="90" align="right">录入时间:</td>
            <td colspan="3"><input name="UpdateTime" type="text" id="UpdateTime" value="<%=now()%>" maxlength="50">
              当前时间为:<%=now()%> 注意不要改变格式。</td>
          </tr>
          <% end if %>
        </table>
      </td>
    </tr>
  </table>
  <div align="center"><p> 
        <input
  name="Add" type="submit"  id="Add" value=" 添 加 " onClick="document.myform.action='ArticleSave.asp?action=add';document.myform.target='_self';">
          
        <input
  name="Preview" type="submit"  id="Preview" value=" 预 览 " onClick="document.myform.action='../Admin_Preview.asp';document.myform.target='_blank';">
      </p></div>
</form>
</body>
</html>
//articlesave.asp
<%@language=vbscript codepage=936 %>
<%
    
Const PurviewLevel=5    '操作权限
%>
<!--#include file="ChkPurview.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/ubbcode.asp"-->
<!--#include file="../inc/function.asp"-->
<%
dim rs,sql,ErrMsg,FoundErr
dim ArticleID,BigClassName,SmallClassName,SpecialName,Title,Content,key,Author,CopyFrom,UpdateTime,Hits,Editor
dim IncludePic,DefaultPicUrl,UploadFiles,Passed,OnTop,Hot,Elite,arrUploadFiles
dim ObjInstalled
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
FoundErr=false
ArticleID=Trim(Request.Form("ArticleID"))
BigClassName=trim(request.form("BigClassName"))
SmallClassName=trim(request.form("SmallClassName"))
SpecialName=trim(request.Form("SpecialName"))
Title=trim(request.form("Title"))
Key=trim(request.form("Key"))
Content=trim(request.form("Content"))
Author=trim(request.form("Author"))
CopyFrom=trim(request.form("CopyFrom"))
UpdateTime=trim(request.form("UpdateTime"))
IncludePic=trim(request.form("IncludePic"))
DefaultPicUrl=trim(request.form("DefaultPicUrl"))
UploadFiles=trim(request.form("UploadFiles"))
Passed=trim(request.form("Passed"))
OnTop=trim(request.form("OnTop"))
Hot=trim(request.form("Hot"))
Elite=trim(request.form("Elite"))
Hits=trim(request.form("Hits"))
Editor=trim(request.form("Editor"))
if BigClassName="" then
    founderr=true
    errmsg=errmsg+"<li>未指定文章所属大类</li>"
end if
if Title="" then
    founderr=true
    errmsg="<li>文章标题不能为空</li>"
end if
if Key="" then
    founderr=true
    errmsg=errmsg+"<li>请输入文章关键字</li>"
end if
if Content="" then
    founderr=true
    errmsg=errmsg+"<li>文章内容不能为空</li>"
end if
if founderr=false then
    Title=dvhtmlencode(Title)
    Key=replace(replace(replace(replace(replace(replace(replace(Key,"'",""),"*",""),"?",""),"(",""),")",""),",",""),".","")
    Key=Key & " "
    Content=ubbcode(Content)
    if Author<>"" then
        Author=dvhtmlencode(Author)
    else
        Author="佚名"
    end if
    if CopyFrom<>"" then
        CopyFrom=dvhtmlencode(CopyFrom)
    else
        CopyFrom="本站原创"
    end if
    if UpdateTime<>"" and IsDate(UpdateTime)=true then
        UpdateTime=CDate(UpdateTime)
    else
        UpdateTime=now()
    end if
    if Hits<>"" then
        Hits=CLng(Hits)
    else
        Hits=0
    end if
    set rs=server.createobject("adodb.recordset")
    if request("action")="add" then
        sql="select top 1 * from article" 
        rs.open sql,conn,1,3
        rs.addnew
        call SaveData()
        rs("Editor")=Editor
        rs.update
        ArticleID=rs("ArticleID")
        rs.close
        set rs=nothing
    elseif request("action")="Modify" then
          if ArticleID<>"" then
            sql="select * from article where articleid=" & ArticleID
            rs.open sql,conn,1,3
            if not (rs.bof and rs.eof) then
                call SaveData()
                rs.update
                rs.close
                set rs=nothing
             else
                founderr=true
                errmsg=errmsg+"<li>找不到此文章,可能已经被其他人删除。</li>"
                call WriteErrMsg()
            end if
        else
            founderr=true
            errmsg=errmsg+"<li>不能确定ArticleID的值</li>"
            call WriteErrMsg()
        end if
    else
        founderr=true
        errmsg=errmsg+"<li>没有选定参数</li>"
        call WriteErrMsg()
    end if
    call CloseConn()
%>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="../index.css">
</head>
<body>
<div align="center">
<br><br>
<table class="border" align=center width="50%" border="0" cellpadding="4" cellspacing="0" bordercolor="#999999">
  <tr align=center>
    <td width="100%" class="title"  height="20"><b>
<%if request("action")="add" then%>添加<%else%>修改<%end if%>文章成功</b></td>
  </tr>
  <tr>
    <td class="tdbg"><p align="left"><br>
        文章序号:<%=ArticleID%><br>
        文章标题:<%=Title%><br>
        所属栏目:<%response.write BigClassName
        if SmallClassName<>"" then response.write " >> " & SmallClassName
        if SpecialName<>"" then response.write "<br>所属专题:" & SpecialName
         %><br>
        文章作者:<%=Author%><br>
        转 贴 自:<%=CopyFrom%><br>
        关键字:<%=Key%><br>
        </p>
        <p align="center">【<a href="ArticleModify.asp?ArticleID=<%=ArticleID%>">修改本文</a>】 【<a href="ArticleAdd.asp">继续添加文章</a>】 【<a href="ArticleManage.asp">文章管理</a>】 【<a href="../Admin_ArticleShow.asp?ArticleID=<%=ArticleID%>">预览文章内容</a>】</p></td>
  </tr>
</table>
</div>
</body>
</html>
<%
else
    WriteErrMsg
end if
sub SaveData()
    rs("BigClassName")=BigClassName
    rs("SmallClassName")=SmallClassName
    rs("SpecialName")=SpecialName
    rs("Title")=Title
    rs("Content")=Content
    rs("Key")=Key
    rs("Hits")=Hits
    rs("Author")=Author
    rs("CopyFrom")=CopyFrom
    if IncludePic="yes" then
        rs("IncludePic")=True
    else
        rs("IncludePic")=False
    end if
    if Passed="yes" then
        rs("Passed")=True
    else
        if EnableArticleCheck="No" then
            rs("Passed")=True
        else
            rs("Passed")=False
        end if
    end if
    if OnTop="yes" then
        rs("OnTop")=True
    else
        rs("OnTop")=False
    end if
    if Hot="yes" then
        rs("Hot")=True
    else
        rs("Hot")=False
    end if
    if Elite="yes" then
        rs("Elite")=True
    else
        rs("Elite")=False
    end if
    rs("UpdateTime")=UpdateTime
end sub
    
%>
这两个文件,提交了,保存不到MSSQL数据库中,ArticleID读取不了,数据表中的ArticleID是自动获取的,
各位高手帮一下忙解决!!!!急!!!!!!!!!!!!!!!



 
											





 
	    

 
	



 
											