📄 savedata.asp
字号:
<!--#include file="dbpath.asp"-->
<!--#include file="function/char.inc"-->
<%
sub getInput()
sName=request.form("Name")
sEmail=request.form("Email")
sHomePage=request.form("HomePage")
sOicq=request.form("Oicq")
sIp=request.ServerVariables("REMOTE_ADDR")
sPic=request.form("Pic")
sSubject=request.form("Subject")
sMemo=request.form("Memo")
sIpadd=request.form("Ipadd")
end sub
dim rs
dim sName
dim sEmail
dim sSubject
dim sOicq
dim sIp
dim sPic
dim sHomePage
dim sMemo
dim sIpadd
dim errorMsg
dim foundError
getInput()
saveData()
if foundError=false then
response.redirect "book.asp"
else
call showerrors()
end if
set rs=nothing
conn.close
set conn=nothing
sub saveData()
dim InsertCursor
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
InsertCursor.Open "select * from book",conn,1,3
InsertCursor.addnew
InsertCursor("name") =htmlencode(sName)
InsertCursor("email") =htmlencode(sEmail)
InsertCursor("homepage") =htmlencode(sHomePage)
InsertCursor("face") ="images/"&sPic&".gif"
InsertCursor("subject") =htmlencode(sSubject)
InsertCursor("memo") =htmlencode(sMemo)
InsertCursor("oicq") =htmlencode(sOicq)
if sIpadd="yes" then
InsertCursor("ip") =sIp
end if
InsertCursor("time") =cstr(now())
InsertCursor.Update
InsertCursor.close
conn.close
set InsertCursor=nothing
if err>0 then
err.clear
foundError=true
ErrorMsg="<li>数 据 库 操 作 失 败 !</li>"
else
foundError=false
end if
end sub
sub showErrors()
%>
<html>
<head>
<style type="text/css">
<!-
td{font-size:12px;}
body{font-size:12px;line-height:17px;}
a:link{text-decoration:none;color:#008040}
a:visited{text-decoration:none;color:#008040}
a:active{text-decoration:none}
a:hover { color:#FF8040; text-decoration: underline}
->
</style>
<title>发现错误</title>
</head>
<body>
<p align="center">留言本</p>
<p align="center"><span style="font-size: 9pt"><font color="#0080FF"><%=ErrorMsg%></span> </font></p>
</body>
</html>
<%end sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -