addarticle.asp

来自「大家好」· ASP 代码 · 共 69 行

ASP
69
字号
<%@ language="vbscript" %>
<% Response.Expires=0%>
<%'回复贴子
if request("username")=""  or request("title")="" or request("content")=""  then
   response.write"用户名、主题和内容必须填写!"
   response.end
 end if

Response.Cookies("kittyok2")("username1")=request("username")
Response.Cookies("kittyok2").Expires="January 1, 2002"
dim bianma,xl_l ,title,boardid,textsize,id,username,renum,whattime,content,httptitle,httpadd,imgadd,fatherid

if isempty(request("boardid")) then
response.write "非法操作!"
response.end
else
boardid=request("boardid")
end if

if trim(request("httpadd"))<>"http://" and trim(request("httpadd"))<>"" then
httpadd=request("httpadd")
end if
if trim(request("imgadd"))<>"http://" and trim(request("imgadd"))<>"" then
imgadd=request("imgadd")
end if

httptitle=request("httptitle")

 session("username")=request("username")
username=request("username")
  id=request("id")
  boardname=request("boardname")
whattime=now
bianma=request("bianma")
feeling=request("feeling")
ipadd=request.servervariables("remote_addr")
title=Server.htmlencode(replace(request("title"),"'","''"))
textsize=len(trim(request("content")))
	content=Server.htmlencode(replace(request("content"),"'","''"))
	DbPath = SERVER.MapPath("db1.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath
sql="update mainboard set renum=renum+1 where id="&id
conn.execute sql
sql1="update user_info set articlenum=articlenum+1,lives=lives+1 where username='"&username&"'"
conn.execute sql1

		renum=request("renum")
		xl_l=cstr(999-trim(renum))
		xl_l=trim(bianma)+trim(xl_l)


sqltext="insert into mainboard(guestname,title,content,feeling,whattime,boardid,textsize,httptitle,httpadd,imgadd,ipadd,bianma,fatherid) values('"&username&"','"&title&"','"&content&"','"&feeling&"','"&cdate(whattime)&"' ,"&boardid&","&textsize&",'"&httptitle&"','"&httpadd&"','"&imgadd&"','"&ipadd&"','"&xl_l&"',"&id&")"
conn.execute sqltext
  
conn.close 
set conn=nothing
response.redirect ("comment.asp?id="&id&"&boardname="&boardname)
%>
<html>

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

<body>
</body>
</html>

⌨️ 快捷键说明

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