|
代码如下.是一个添加客户的程序!
<%@ language="vbscript"%>
<%
dim nick,name,password,email
dim province,city,address,zip,phone
nick=trim(request.form("nick"))
password=trim(request.form("password"))
repass=trim(request.form("repass"))
name=trim(request.form("name"))
email=trim(request.form("email"))
province=trim(request.form("province"))
city=trim(request.form("city"))
address=trim(request.form("address"))
zip=trim(request.form("zip"))
phone=trim(request.form("phone"))
if nick="" or name=""or password=""or repass=""_
or email="" or phone="" then
showmessage"有必填的项目没有填写!"
else
if password<>repass then
showmessage"两次输入的密码不一致!"
end if
set conn=server.createobject("adodb.connection")
p1="provider=microsoft.jet.oledb.4.0;"
path1="data source="&server.mappath("users.mdb")
conn.open p1&path1
set rs=server.createobject("adodb.recordset")
sql="select * from users where nick='"+nick+"'"
rs.open sql,conn,0,1
if rs.eof and rs.bof then
sql="Insert into users(nick,password,name,email,province,city,address,zip,phone)"&_
"values('"+nick+"','"+password+"','"+name+"','"+email+"','"+province+"','"+city+"','"+address+"','"+zip+"','"+phone+"')"
conn.execute sql
rs.close
set rs=nothing
set conn=nothing
response.write"<center>祝贺你注册成功!"&_
"按<a href=mail.asp>这里</a>进入主页</center>"
else
rs.close
set rs=nothing
set conn=nothing
showmessage"此登录名已被注册!"
end if
end if
%>
<!--显示返回重新填写信息的sub过程: -->
<% sub showmessage(msg)%>
<style type="text/css">
<!--
body {
background-color: #00FFFF;
}
.style1 {color: #FF0000}
-->
</style><body>
<center>
<h3><%=msg%></h3>
</center>
<form>
<p align="center">
按<a href=register1.asp class="style1">这里</a>返回
</center>
</p>
</form>
</body>
<%response.end%>
<%end sub%>
希望各位高手能帮帮小弟! |
|