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

📄 editwrite2.asp

📁 音乐类型的好网站
💻 ASP
字号:
<!-- #include file=../chkuser.asp -->
<!--#include file=../sys.asp-->
<!-- #include file="../sys/inc/char.asp" -->
<!--#include file="../sys/inc/prompt.inc"-->

<%
call conned()
dim action
dim sql
dim rs
dim subject,content
dim backurl,successmess,express ,FoundErr,auid	
response.buffer=true
action=request("action")
auid=cint(request.cookies("soonhostmember")("auid"))
id =request("id")

ErrMsg=""
	call getInput()	
	call chkData()	

	if FoundErr then		
  	       	call Error()
	else
		'call checkUser()
			if FoundErr then
  	       		call Error()
		else
			call saveAnnounce()
		end if	
	end if
	set rs=nothing	

	
'--------------------------------------------------------sub	
	rem 保存贴子信息
	sub saveAnnounce()
               	set rs=server.createobject("adodb.recordset")
        	if action=1 then
			sql="select * from content where id="&id
		else
			sql="select * from revert where id="&id
			
		end if
		rs.open sql,conn,1,3
		response.write "<br>"
		if auid <> rs("bauid") then 
		FoundErr=true  
		ErrMsg=ErrMsg+"<Br>"+"<li>您没有权限编辑此文章!" 
		call Error() 
		response.end 
		end if
			
				
  		if err.number<>0 then
	       	err.clear
			ErrMsg=ErrMsg+"<Br>"+"<li>数据库操作失败,请以后再试"&err.Description 
  	       	call Error()
  	       	
		else
			rs("bexpression")=(express)
			rs("bsubject")=(subject)
			rs("bcontent")=(content)			
			rs.update
			successmess="修改成功"
			backurl="index.asp"
			call success()
    		end if
	set rs=nothing
	end sub

	

	rem ------获得asp文件参数------
	
	sub getInput()
	
	Express=Checkstr(Request.Form("Express"))
   	subject=Checkstr(trim(request("subject")))
   	content=Checkstr(trim(request("Content")))   
   	response.write (express)	
   		
	end sub
	

	rem -----检查user输入数据的合法性------	
function chkData()
	
	if Express ="" then
		Express=1 
	else		
		if not isnumeric(Express) or len(Express)>2 then
			Express=1				
		end if
	end if
		

		
	if chkpost=false then
   		ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从外部提交发言。"
   		FoundErr=True
	end if	
	
	if subject="" then
   		FoundErr=True
   		if Len(ErrMsg)=0 then
      			ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空。"
   		else
      			ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空。"
   		end if
	elseif strLength(subject)>100 then
   		FoundErr=True
   		if strLength(ErrMsg)=0 then
      			ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100"
   		else
      			ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100"
   		end if
			end if
	if strLength(content)>16384 then
   		ErrMsg=ErrMsg+"<Br>"+"<li>发言内容不得大于" & 16384 & "bytes"
   		FoundErr=true
	end if	
	if err.number<>0 then err.clear
end function	



Function Checkstr(str)
	str=replace(str,"'","''")
	Checkstr=str
	End Function
'====================================================
'程序制做:迅捷网络.          http://www.soonhost.com
'迅捷主机网 -- 域名注册、主机租用、网站建设、脚本开发
'网址:http://www.soonhost.com
'msn:soonhost@hotmail.com
'请保留以上版权信息,谢谢合作!
'====================================================  
%>

⌨️ 快捷键说明

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