在DW中制作註冊頁面
<%
dim db,lele
db="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("數據庫文件名")
set lele=server.createobject("adodb.connection")
lele.open db
%>
'因為不知道妳的註冊頁面提交表單時需要的數據,所以沒辦法寫代碼給妳,這裏給壹個我自己寫的註冊頁面提交後處理的壹些程序代碼供妳參考:
<% option explicit %>
<%
if trim(request.form("r_user"))="" then
response.write "<script language='javascript'>alert('樂樂提示:\n\n非法參數!暈了!妳想做壞事呀!')</script>"
response.write "<meta http-equiv='refresh' content='0;url=reg.asp'> "'註意這裏是跳轉!
response.end
end if
if trim(request.form("r_user"))="教縣" or trim(request.form("r_user"))="譚教縣" or trim(request.form("r_user"))="admin" then
response.write "<script language='javascript'>alert('樂樂提示:\n\n妳要註冊的用戶名系統已過濾!請換名後重新設置!')</script>"
response.write "<script language='javascript'>history.go(-1)</script> "
response.end
end if
%>
<!-- #include file="conn.asp"-->'這個是鏈接數據庫的文件調用,那個文件就是上面那個鏈接數據庫的代碼,用include包含進來!
<%
'定義了20個變量,用來存儲reg.asp用戶輸入的各項信息的value值!其中yy是:年份mm是:月份dd是:日期將以字符串形鏈接負給變量:r_birthday
dim r_user,r_password,r_qq,r_msn,r_mail,r_www,r_protection,r_answer,r_name,r_sex,r_birthday,r_industry,province2,city2,r_addess,r_jianjie,r_r_signe,yy,mm,dd,r_ip
'以下是通過request.form獲取reg.asp裏表單各項的值並負給相應的變量!
r_ip=request.servervariables("remote_addr") '註冊時獲得客戶端的IP地址!
yy=request.form("yy")
mm=request.form("mm")
dd=request.form("dd")
r_user=trim(request.form("r_user"))
r_password=trim(request.form("r_password"))
r_qq=trim(request.form("r_qq"))
r_msn=trim(request.form("r_msn"))
r_mail=trim(request.form("r_mail"))
r_www=trim(request.form("r_www"))
r_protection=request.form("r_protection")
r_answer=trim(request.form("r_answer"))
r_name=trim(request.form("r_name"))
r_sex=request.form("r_sex")
r_birthday=yy & "-" & mm & "-" & dd '這裏得到的格式是:1988-11-2
r_industry=request.form("r_industry")
province2=request.form("province2")
city2=request.form("city2")
r_addess=trim(request.form("r_addess"))
r_jianjie=trim(request.form("r_jianjie"))
r_signe=trim(request.form("r_signe"))
dim sql
sql="insert into reg(r_user,r_password,r_qq,r_msn,r_mail,r_www,r_protection,r_answer,r_name,r_sex,r_birthday,r_industry,province2,city2,r_addess,r_jianjie,r_signe,r_ip)values('"&r_user&"','"&r_password&"','"&r_qq&"','"&r_msn&"','"&r_mail&"','"&r_www&"','"&r_protection&"','"&r_answer&"','"&r_name&"','"&r_sex&"','"&r_birthday&"','"&r_industry&"','"&province2&"','"&city2&"','"&r_addess&"','"&r_jianjie&"','"&r_signe&"','"&r_ip&"')"
lele.execute(sql)
%>