我做BBS的注册页面的时候,执行时老提示数据插入语句出错。该页面代码如下:
<!--#include file="up.asp"-->
<%
if bbsinfo(14)="2" then
call sendinfo("","·本论坛目前暂停注册!<br>·如有问题请联系论坛管理员。<br>·<a href='index.asp'>进入论坛首页。</a>"
call down
closedb
response.end
end if%>
<%
dim action
action=request.querystring("action"
select case action
case""
%>
<table align="center" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="<%=tbw%>">
<tr>
<td class=td1 width="100%" bgcolor="<%=c1%>" background="<%=tbg%>" height="28"> <img src="pic/gl.gif" border="0"><font color="<%=c3%>"> 用户注册条款和声明</font></td>
</tr>
<tr>
<td width="100%">
<p style="line-height: 180%; margin: 8"><b>继续注册前请先阅读论坛协议</b><br>
欢迎您加入本站点参加交流和讨论,本站点为公共论坛,为维护网上公共秩序和社会稳定,请您自觉遵守以下条款:<br>
<br>
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播下列信息:<br>
(一)煽动抗拒、破坏宪法和法律、行政法规实施的;<br>
(二)煽动颠覆国家政权,推翻社会主义制度的;<br>
(三)煽动分裂国家、破坏国家统一的;<br>
(四)煽动民族仇恨、民族歧视,破坏民族团结的;<br>
(五)捏造或者歪曲事实,散布谣言,扰乱社会秩序的;<br>
(六)宣扬封建迷信、淫秽、色情、赌博、暴力、凶杀、恐怖、教唆犯罪的;<br>
(七)公然侮辱他人或者捏造事实诽谤他人的,或者进行其他恶意攻击的;<br>
(八)损害国家机关信誉的;<br>
(九)其他违反宪法和法律行政法规的;<br>
(十)进行商业广告行为的。<br>
<br>
二、互相尊重,对自己的言论和行为负责。</p></td>
</tr>
<form method="POST" action="reg.asp?action=agree">
<tr>
<td width="100%" height="30" bgcolor="<%=c2%>" align="center">
<p style="line-height: 180%; margin: 8">
<input type="submit" value=" 我 同 意 " name="B1"></p>
</td>
</tr> </form>
</table>
<%case"agree"%>
<script>function openwin()
{
document.form1.name.value=document.form.name.value;
document.form1.email.value=document.form.email.value;
var popupWin = window.open('', 'showgg', 'width=500,height=400,resizable=1,scrollbars=yes,menubar=no,status=yes');
document.form1.submit()
}
</SCRIPT>
<form name=form1 action=paper.asp?action=checkreg method=post target=showgg>
<input type=hidden name=name value=><input type=hidden name=email value=>
</form>
<form method="POST" action="reg.asp?action=save" name="form"><%=ttop%><table align="center" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="<%=tbw%>">
<tr>
<td class=td1 width="100%" bgcolor="<%=c1%>" background="<%=tbg%>" height="28"> <img src="pic/gl.gif" border="0"><font color=<%=c3%>> 用户注册资料</font></td>
</tr>
<tr>
<td width="100%" height="25" bgcolor="<%=c2%>"> 必填资料:</td>
</tr>
<tr>
<td width="100%">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="<%=c2%>">
<tr>
<td width="40%">
<p style="line-height: 120%; margin: 4"><b>用户名</b>:<br>注册用户名不能超过10个字符(5个汉字)
。</p></td>
<td width="60%"> <input type=text name=name size=30 maxlength=16>
<input type="button" value=" 检测用户名 " onclick=openwin() name="B1"></td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><b>性别</b>:<br>请选择您的性别</td>
<td> <input type=radio name=sex value=1 checked>
<img src="pic/boy.gif">帅哥 <input type=radio name=sex value=2>
<img src="pic/girl.gif">靓女</td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4">
<b>密码(最多16位)</b>:<br>请不要使用任何类似 '*'、' ' 或 HTML 字符。</td>
<td> <input type=password name=password size=30 maxlength=20></td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><b>重复密码(最多16位)</b>:<br>请再输一遍确认
。</td>
<td> <input type=password name=repassword size=30 maxlength=20></td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><b>Email地址</b>:<br>请输入有效的邮件地址,这将使您能用到论坛中的所有功能
。</td>
<td> <input type=text name=email size=30 maxlength=30></td>
</tr>
<%set rs=conn.execute("select postcode from config"
if rs("postcode"
=0 then%>
<tr>
<td><p style="line-height: 120%; margin: 4"><b>注册验证码</b>:<br>如无法显示或看不清,请刷新本页
。</td>
<td> <input type="text" class=submit name="adminid" size="16"> 请输入:<img src=code.asp border=0></td>
</tr>
<% end if%>
</table>
</td>
</tr>
<tr>
<td width="100%" height="25" bgcolor="<%=c2%>"> 选填资料:</td>
</tr>
<tr>
<td width="100%">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="<%=c2%>" width="100%">
<tr>
<td width="40%"><p style="line-height: 120%; margin: 4"><b>生日:</b>(请按照2000-01-01格式填写)</td>
<td width="60%"> <input type=text name=burn1 size=4 maxlength=4>年<input type=text name=burn2 size=2 maxlength=2>月<input type=text name=burn3 size=2 maxlength=2>日</td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><b>主页:</b><br>
填写你的个人主页,让大家见识见识。</td>
<td> <input type=text name=home size=30 maxlength=255></td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><B>OICQ号码</B>:<BR>填写您的QQ地址,方便与他人的联系
。</td>
<td> <input type=text name=qq size=16 maxlength=15> <input type="checkbox" value="1" name="qqshow">使用QQ秀显示我的头像。</td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><b>我的头像:</b><br>使用论坛自带的图像。</td>
<td><br> <select name=bbspic size=1 onChange="showimage()" style="font-size: 9pt">
<%for i=1 to checknum(application(prefix&"picnum"
)%>
<option value=<%=i%>><%=i%></option>
<%next%>
</select> <img src="headpic/1.gif" name="tus"><script>function showimage(){document.images.tus.src="headpic/"+document.form.bbspic.options[document.form.bbspic.selectedIndex].value+".gif";}</script> [
<a target="_blank" href="help.asp?action=allheadpic">查看所有头像</a> ]<br>
</td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><B>自定义头像</B>:<br>如果图像位置中有连接图片将以自定义的为主
。</td>
<td> <input name=mypic size=38 maxlength=100> 完整Url地址<br> 图像宽度:<input type=text name=picw size=6 value=<%=checknum(application(prefix&"picw"
)%>> 高度:
<input type=text name=pich size=6 value=<%=checknum(application(prefix&"pich"
)%>>(宽最大<%=checknum(application(prefix&"picw"
)%> 高最大<%=checknum(application(prefix&"pich"
)%>)</td>
</tr>
<tr>
<td><p style="line-height: 120%; margin: 4"><B>个性签名</B>:<BR>最多255个字符<BR>文字将出现在您发表的文章的结尾处。体现您的个性。</td>
<td>
<p style="margin: 8">
<TEXTAREA name=gxqm rows=5 wrap=PHYSICAL cols=60 style="font-family: 宋体; font-size: 9pt"></TEXTAREA></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="40" bgcolor="<%=c2%>" align="center"><input class=submit type=submit value=我填好了,现在注册! name=Submit> <input class=submit type=reset value=不行,还是重写吧! name=Submit2></td>
</tr>
</table><%=tbottom%></form>
<%case"save"%><!--#include file="inc/regfun.asp"--><%
dim name,password,repassword,email,sex,burn1,burn2,burn3,burn,home,qq,gxqm,picw,pich,bbspic,mypic,toupic,qqshow
dim canreg,badwords,z,adminid,sickpass,userinfo,regtime,sql,userid,newuserinfo,bad,b
function checkbad(str)
if isnull(str) then exit function
bad=split(application(prefix&"badcontent"
, "|"
for b=0 to ubound(bad)
str=Replace(str,bad(b),string(len(bad(b)),"*"
)
next
checkbad=str
end function
name=Replace(Request.Form("name"
,"'","''"
password=Replace(Request.Form("password"
,"'","''"
repassword=Replace(Request.Form("repassword"
," ",""
email=Replace(Request.Form("email"
,"'","''"
adminid=Replace(Request.Form("adminid"
,"'","''"
sex=checknum(request.form("sex"
)
burn1=replace(Request.Form("burn1"
,"'",""
burn2=replace(Request.Form("burn2"
,"'",""
burn3=replace(Request.Form("burn3"
,"'",""
home=Replace(Request.Form("home"
,"'","''"
home=ubbg(home)
qq=Replace(Request.Form("qq"
,"'","''"
qqshow=Replace(Request.Form("qqshow"
,"'","''"
gxqm=Request.Form("gxqm"
gxqm=Replace(left(gxqm,255),"'","''"
gxqm=replace(gxqm,"|","│"
gxqm=checkbad(gxqm)
picw=Replace(Request.Form("picw"
,"'","''"
pich=Replace(Request.Form("pich"
,"'","''"
mypic=Replace(Request.Form("mypic"
,"'","''"
mypic=ubbg(mypic)
bbspic=Replace(Request.Form("bbspic"
,"'","''"
canreg=true
function checkStr(str)
if isnull(str) then
checkStr = ""
exit function
end if
checkStr=replace(str,"'","''"
end function
if name="" or password="" or repassword="" or email="" or sex="" then
canreg=false
mes="·请填写完整必填的资料。<br>"
else
mes=""
if strlength(name)>10 then
canreg=false
mes="·你的用户名长度超过了10。<br>"
end if
if not pass_name(name) then
canreg=false
mes=mes&"·你的用户名含有非法字符。<br>"
end if
badwords=split(application(prefix&"badwords"
,"|"
for z=0 to ubound(badwords)
if instr(name,badwords(z))>0 then
canreg=false
mes=mes&"·你的用户名含有论坛禁止使用的字词。<br>"
exit for
end if
next
if canreg=true then
if not conn.execute("select top 1 userid from [user] where name='"&name&"'"
.eof then canreg=false:mes=mes&"·该用户名已经被注册了。<br>"
end if
if len(password)>16 then canreg=false : mes=mes&"·你填写的密码长度超过了16。<br>"
if passc(password)=false then canreg=false:mes=mes&"·你的密码含有非法字符。<br>"
sickpass=split("123$$1234$$12345$$123456$$1234567$$12345678$$aaa$$111","$$"
for i=0 to ubound(sickpass)
if len(password)<3 or password=sickpass(i) then
canreg=false
mes=mes&"·你的密码属于弱口令,请更换密码。<br>"
exit for
end if
next
if repassword<>password then canreg=false : mes=mes&"·你两次输入的密码不一样。<br>"
email=server.HTMLEncode(email)
if not IsValidEmail(email) then canreg=false : mes=mes&"·你的E-mail填写错误。<br>"
if conn.execute("select postcode from config"
(0)=0 then
if session("adminid"
<>adminid or not isnumeric(session("adminid"
) then canreg=false:mes=mes&"·你输入的验证码错误。<br>"
end if
end if
burn=burn1&"-"&burn2&"-"&burn3
if not isdate(burn) then burn="--"
if qq<>"" and (not isnumeric(qq) or (len(qq)<5 or len(qq)>12)) then canreg=false:mes=mes&"·你的 QQ 号码填写错误。<br>"
if mypic="" then
toupic="headpic/"&bbspic&".gif|"&checknum(application(prefix&"autopicw"
)&"|"&checknum(application(prefix&"autopich"
)
else
if picw<>"" and checknum(picw)<=checknum(application(prefix&"picw"
) and pich<>"" and checknum(pich)<=checknum(application(prefix&"pich"
) then
toupic=mypic&"|"&picw&"|"&pich
else
canreg=false
mes=mes&"·你的头像大小设置错误。<br>"
end if
end if
if checknum(application(prefix&"headpicset"
)<>1 and instr(toupic,"://"
>0 then
canreg=false
mes=mes&"·本论坛不允许使用外部头像。<br>"
end if
if canreg=false then
tl=""
mes="<b>对不起!你不能成功地注册用户,可能存在以下问题。</b><br>"&mes&"·<a href='javascript:history.go(-1)'><img border=0 src=pic/re.gif align=absmiddle> 返回重新填写。</a>"
elseif canreg=true then
tl=1
mes="恭喜你!<b>"&kbbs(name)&"</b> 注册成功。<br><a href=login.asp><img border=0 src=pic/re.gif align=absmiddle> <font color=red>登陆并进入论坛</font></a><br>"%>
<!--#include file="inc/md5.asp"-->
<%
regtime=FormatDateTime(now+timeset/24,2)
userinfo=email&"|"&home&"|"&burn&"|"&qq&"|"&sex&"|"&toupic&"|"&gxqm&"|"®time&"||"&qqshow
password=md5(password)
set rs = Server.CreateObject("ADODB.Recordset"
sql="select top 1 userid,name,password,userinfo,lasttime from [user]"
rs.open sql,conn,0,2
rs.addnew
rs("name"
=name
rs("password"
=password
rs("userinfo"
=userinfo
rs("lasttime"
=regtime
rs.update
userid=rs("userid"
rs.close
set rs=nothing
newuserinfo=userid&"|"&name
conn.execute("update [config] set newuser='"&newuserinfo&"',usernum=usernum+1"
%>
<form name=login action=login.asp?action=login method="POST">
<%
session("adminid"
="1234"
%>
<input type=hidden name=lgname value=<%=name%>><input type=hidden name=lgpwd value=<%=repassword%>><input type=hidden name=adminid value="1234">
<input type=hidden name=cook value=0> <input type=hidden value=1 name=lgtype>
</form>
<script>document.login.submit()</script>
<%
end if
call sendinfo(tl,mes)
%>
<%if checknum(bbsinfo(24))=0 then
lguserid=2
dim touserid
touserid=userid
dim content
content="欢迎注册本站论坛,我们努力争取为您创造一个良好的论坛环境,有问题请联系管理员.祝您在这里玩的愉快."
dim content2
content2=content&"|"&now()+timeset/24
conn.execute("insert into sms(fromuserid,touserid,content) values("&lguserid&","&touserid&",'"&content2&"')"end if
%>
<%end select
call down
%>
就是红色的部分出错。有没人知道为什么呀?