⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 saverewrite.asp

📁 红金羚v1.5办公自动化软件是基于大型数据库系统开发的应用系统
💻 ASP
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit
Response.Cookies("userinfo")("UserName")=trim(Request.Form("username"))
Response.Cookies("userinfo")("Useremail")=trim(Request.Form("email"))
Response.Cookies("userinfo").Expires = now() + 365
%>
<!--#include file="newconn.asp"-->
<!-- #include file="inc/char.inc" -->
<% 
dim UserName
dim userPassword
dim useremail
dim Topic
dim body
dim FoundError
dim ErrMsg
dim dateTimeStr
dim ParentID
dim UserID
dim newUser
dim RootID
dim iLayer
dim iOrders
dim ip
dim announceid
dim Expression
dim FoundUser
dim boardID
response.write "<html>" +chr(13)+chr(10)
response.write "<head>"+chr(13)+chr(10)
response.write "<meta NAME='GENERATOR' Content='Microsoft FrontPage 3.0'>"+chr(13)+chr(10)
response.write "<meta HTTP-EQUIV='Content-Type' content='text/html; charset=gb_2312-80'>"+chr(13)+chr(10)
response.write "<META HTTP-EQUIV='Expires' CONTENT='0'>"+chr(13)+chr(10)
response.write "<link rel='stylesheet' type='text/css' href='forum.css'>"
response.write "<title>发表</title>"+chr(13)+chr(10)
response.write "</head>"+chr(13)+chr(10)
response.write "<body >"+chr(13)+chr(10)

ParentID=request("followup")
rootID=request("RootID")
IP=Request.ServerVariables("REMOTE_ADDR") 
Expression=Request.Form("Expression")&".gif"
   UserName=trim(request("username"))
   UserPassWord=request("passwd")
   UserEmail=request("email")
   Topic=trim(request("subject"))
   Body=request("body")
boardID=request("boardID")

FoundError=false
if Trim(UserName)="" or len(UserName)>50 then
   ErrMsg="请输入姓名(长度不能大于50)"
   foundError=True
elseif Trim(UserPassWord)="" or len(UserPassWord)>10 then
   ErrMsg="请输入密码(长度不能大于10)"
   foundError=True
end if
if Trim(Topic)="" then
   FoundError=True
   if Len(ErrMsg)=0 then
      ErrMsg="主题不应为空"
   else
      ErrMsg=ErrMsg+"<Br>"+"主题不应为空"
   end if
elseif strlength(trim(topic))>255 then
   FoundError=True
   if Len(ErrMsg)=0 then
      ErrMsg="主题长度不能超过255"
   else
      ErrMsg=ErrMsg+"<Br>"+"主题长度不能超过255"
   end if
end if
if strLength(body)>ANNOUNCE_MAXBYTE then
   ErrMsg="发言内容不得大于" & CSTR(ANNOUNCE_MAXBYTE) & "bytes"
   foundError=true
end if

if FoundError=true then
   showAnnounce(ErrMsg)
else
   dim rs
   dim sql
   set rs=server.createobject("adodb.recordset")
   
   sql ="select * from user where ucase(username)='"&ucase(username)&"'"
   rs.open sql,conn,1,3
 
   if not rs.EOF then
        FoundUser=True
	    UserID=rs("UserID")
 	  
   end if
	  if not FoundUser then
         SaveNewUser username,userpassword,useremail
	     NewUser=true
         if founderror=true then showAnnounce(ErrMsg)
         elseif UserPassword<>rs("UserPassword") then
           ErrMsg="您的密码不正确(或者该名字被他人占用,请用别的名字)"
	       foundError=true
            showAnnounce(ErrMsg)
      else
         rs("article")=rs("article")+1
         rs.update
      end if
    rs.close
      
 end if
   if foundError=false then
     dim rsBoard
     dim boardname
     dim boardsql
     set rsBoard=server.createobject("adodb.recordset")
     boardsql="select board.boardname,board.boardtype from board where boardID="&request("boardid")
     rsboard.open boardsql,conn,1,1
     boardname=rsboard("boardname")
     session("boardtype")=rsboard("boardtype")
     rsboard.close     
     dim rsLayer
     set rsLayer=conn.execute("select layer,orders from bbs1 where announceid="&cstr(parentid)) 

      if not(rsLayer.eof and rsLayer.bof) then
         if isnull(rsLayer(0)) then
            iLayer=0
         else
            iLayer=rslayer(0)
         end if
         if isNUll(rslayer(1)) then
            iOrders=0
         else
            iOrders=rsLayer(1) 
         end if
      else
         iLayer=0
         iOrders=0
      end if
      rsLayer.close
      if rootid<>0 then 
         iLayer=ilayer+1
         conn.execute "update bbs1 set orders=orders+1 where rootid="&cstr(RootID)&" and orders>"&cstr(iOrders)

         iOrders=iOrders+1
      end if      
      DateTimeStr=CSTR(NOW()+TIME_ADJUST/24)
      'ON ERROR RESUME NEXT 
      dim cmdTemp
      dim InsertCursor
      dim dataconn
      Set DataConn = Server.CreateObject("ADODB.Connection")
      dataconn.open connstr
      Set cmdTemp = Server.CreateObject("ADODB.Command")
      Set InsertCursor = Server.CreateObject("ADODB.Recordset")
      cmdTemp.CommandText = "SELECT *, UserName FROM bbs1 WHERE (UserName IS NULL)"
      cmdTemp.CommandType = 1
	  Set cmdTemp.ActiveConnection = DataConn
 	  InsertCursor.Open cmdTemp, , 1, 3
      InsertCursor.AddNew
	InsertCursor("BoardID") = boardID
	  InsertCursor("ParentID") = 0
      InsertCursor("Child") = 0
      InsertCursor("ParentID") = ParentID 
	  InsertCursor("UserName") = UserName
	  InsertCursor("UserEmail") =UserEmail
	  InsertCursor("Topic") =Topic
	  InsertCursor("Body") =Body
	  InsertCursor("DateAndTime") =DateTimeStr
	  InsertCursor("hits") =0
	  InsertCursor("length")=strlength(body)
      InsertCurSor("RootID")=RootID
      InsertCurSor("layer")=ilayer
      InsertCurSor("orders")=iorders
      InsertCurSor("ip")=ip
      InsertCurSor("Expression")=Expression
	  InsertCursor.Update
      announceid=InsertCursor("AnnounceID")
	  if err.number<>0 then
           err.clear
	       ErrMsg="数据库操作失败,请以后再试:"&err.Description 
  	       showAnnounce(ErrMsg)
	  else
	      sql="update bbs1 set child=child+1 where announceID="&cstr(ParentID)
          rs.open sql,conn,1,1
				'end if
		  response.write "<p align='center'><strong>"
		  if pwsonchsys then
			showBody Topic
		  else
			response.write Server.HTMLEncode(Topic)
		  end if
			response.write "</strong></p> "+chr(13)+chr(10)
			response.write "<hr size='1'>"+chr(13)+chr(10)
			if Trim(UserEmail)<>"" then 
				response.write "<p> "
				response.write " <a href='mailto:"+Server.HTMLEncode(UserEmail)+"'>"
		    	if pwsonchsys then
		 	    	showBody UserName
			    else
				   response.write Server.HTMLEncode(UserName)
				end if
			    response.write "</a> 于 "+DateTimeStr+" 加贴在:"
                response.write "<font color=darkblue><strong>"+session("boardtype")+"</strong></font>"      
                response.write "</p>"+chr(13)+chr(10)
			else
				response.write "<p> " 
				if pwsonchsys then
			    	showBody UserName
				else
					response.write Server.HTMLEncode(UserName)
				end if
			    response.write "</a> 于 "+DateTimeStr+" 加贴在:"
                response.write "<font color=darkblue><strong>"+session("boardtype")+"</strong></font>"      
                response.write "</p>"+chr(13)+chr(10)
			end if
				showbody(body)
				response.write "<hr size='1'>"+chr(13)+chr(10)
				response.write "<a href='List.asp?boardID="+request("boardid")+"' >刷新浏览</a>"+chr(13)+chr(10)      
				response.write "  <a href='write.asp?boardID="+cstr(boardID)+"' >继续发贴</a>"+chr(13)+chr(10)
                                
			end if
			InsertCursor.close
			dataconn.close
'      end if
'    end if 
'  end if 
end if
response.write "</body>"+chr(13)+chr(10)
response.write "</html>"+chr(13)+chr(10)


function showAnnounce(ErrMsg)
      
            %>
<html>

<head>
<title></title>
</head>

<body>
<%
response.write "<font color='red'><strong><Big>输入错误:</big></strong></font><BR><font color='#0000FF'>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
 %>    
<form action="saverewrite.asp?boardID=<%=request("boardid")%>" method="POST"
name="frmAnnounce">
<input type='hidden' name='rootID' value="<%=RootID%>">
<input type='hidden' name='followup' value="<%=ParentID%>">
  <div align="center"><center><table border="1" width="530" bgcolor="#F7FBFF"
  bordercolorlight="#2F97FF" cellspacing="0" bordercolordark="#F0F8FF">
    <tr>
          <td width="100%" bgcolor="#00CCFF" height="33"> 
            <div align="center"></div>
            <p align="center"><font color="#ffffff"><strong><font color="#000000">我 
              要 发 言</font></strong></font>
          </td>
    </tr>
    <tr align="center">
      <td width="100%"><table border="0" width="100%" cellspacing="1">
        <tr>
                <td width="14%" align="right">论 坛:</td>
          <td width="86%" colspan="2"><font color="darkblue"><strong><%=session("boardtype")%></strong></font>&nbsp;<font
          color="red"><strong>*</strong></font>为必填项目 第一次发言自动注册</td>
        </tr>
        <tr>
          <td width="14%" align="right">姓 名:</td>
          <td width="86%" colspan="2"><input class="smallInput" name="username" size="16"
          maxlength="50" value="<%=UserName%>"><font color="red"><strong>*</strong></font> 
          &nbsp; 密 码:<input class="smallInput" name="passwd" size="10" maxlength="10"
          type="password"><font color="red"><strong>*</strong></font></td>
        </tr>
        <tr>
          <td width="14%" align="right">Email:</td>
          <td width="86%" colspan="2"><input class="smallInput" name="email" size="42"
          maxlength="40" value="<%=htmlencode2(useremail)%>"></td>
        </tr>
        <tr>
          <td width="14%" align="right">主 题:</td>
          <td width="86%" colspan="2"><input class="smallInput" name="subject" size="65"
          maxlength="255" value="<%=htmlencode2(topic)%>"><font color="red"><strong>*</strong></font> 
          </td>
        </tr>
        <tr>
          <td width="14%" align="right" valign="top"><span class="smallFont">表 情:</span></td>
          <td width="86%" colspan="2"><input type="radio" value="smiley" name="Expression" checked><img
          src="IMAGES/smiley.gif" width="15" height="15"> <input type="radio" name="Expression"
          value="sad"><img src="IMAGES/sad.gif" width="16" height="16"> <input type="radio"
          name="Expression" value="angry"><img src="IMAGES/angry.gif" width="15" height="15"> <input
          type="radio" name="Expression" value="13"><img src="IMAGES/13.gif" width="15" height="15"> <input
          type="radio" name="Expression" value="14"><img src="IMAGES/14.gif" width="15" height="15"> 
          <input type="radio" name="Expression" value="15"><img src="IMAGES/15.gif" width="15"
          height="15"> <input type="radio" name="Expression" value="16"><img src="IMAGES/16.gif"
          width="15" height="15"> <br>
          <input type="radio" value="18" name="Expression"><img src="IMAGES/18.gif" width="15"
          height="15"> <input type="radio" name="Expression" value="17"><img src="IMAGES/17.gif"
          width="15" height="15"> <input type="radio" name="Expression" value="19"><img
          src="IMAGES/19.gif" width="15" height="15"> <input type="radio" name="Expression"
          value="20"><img src="IMAGES/20.gif" width="15" height="15"> <input type="radio"
          name="Expression" value="21"><img src="IMAGES/21.gif" width="15" height="15"> <input
          type="radio" name="Expression" value="22"><img src="IMAGES/22.gif" width="15" height="15"> 
          <input type="radio" name="Expression" value="23"><img src="IMAGES/23.gif" width="15"
          height="15"> </td>
        </tr>
        <tr>
          <td width="14%" align="right"><span class="smallFont">内 容:</span></td>
          <td width="43%"><span class="smallFont">(最多<%=ANNOUNCE_MAXBYTE\1024%>KB)</span></td>
          <td width="43%">
<p><input class="buttonface" type="submit"
          value=" 发 送 ">&nbsp; <input class="buttonface" type="reset" value=" 重 填 "> </td>
        </tr>
        <tr align="center">
          <td width="14%"><span class="smallFont"></span></td>
          <td width="86%" colspan="2">
<p><textarea class="smallarea" cols="65"
          name="body" rows="10"><%=htmlencode2(body)%></textarea></td>
        </tr>
        <tr align="center">
          <td width="14%" height="15"><span class="smallFont"></span></td>
          <td width="86%" colspan="2"></td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
  </center></div>
</form>
 
<%
end function
function SaveNewUser(username,userpasswor,email)
        on error resume next
        dim cmdTemp
		dim InsertCursor
		dim dataconn
        Set DataConn = Server.CreateObject("ADODB.Connection")
		dataconn.open connstr
        Set cmdTemp = Server.CreateObject("ADODB.Command")
		Set InsertCursor = Server.CreateObject("ADODB.Recordset")
		cmdTemp.CommandText = "SELECT *, UserName FROM User WHERE (UserName IS NULL)"
		cmdTemp.CommandType = 1
		Set cmdTemp.ActiveConnection = dataConn
		InsertCursor.Open cmdTemp, , 1, 3
        InsertCursor.AddNew
		InsertCursor("UserName") = UserName
		InsertCursor("UserPassword") = UserPassword
		InsertCursor("UserEmail") = UserEmail
		InsertCursor("article") = 1
		InsertCursor.Update
        if not err.number<>0 then 
		   'sendMailToSiteMaster(UserName)
		   UserID=insertcursor("UserID")
		else 
           err.clear
		   FoundError=true
		   ErrMsg="数据库操作失败,请以后再试"&err.Description 
		end if
        InsertCursor.close
		dataconn.close
end function
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -