📄 addcustomer.asp
字号:
<!-- #include file="admin_protect.inc" -->
<!-- #include file="../opendb.inc" -->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta Name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta Name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; chaRset=gb2312">
<title>添加用户页面</title>
</head>
<body>
<script language="JavaScript">
</script>
<p align="center"><font color="#0000FF"><b>添加新用户</b></font></p>
<form method="POST" Name="addcustomer" action="addcustomer.asp">
<div align="center">
<center>
<table border="1" cellspacing="1" width="50%" id="AutoNumber1" height="275">
<tr>
<td width="50%">顾客帐号</td>
<td width="50%"><input type="text" Name="Name" size="20"></td>
</tr>
<tr>
<td width="50%">帐号密码</td>
<td width="50%"><input type="text" Name="Password" size="20"></td>
</tr>
<tr>
<td width="50%">地 址</td>
<td width="50%"><input type="text" Name="Address" size="20"></td>
</tr>
<tr>
<td width="50%">所在城市</td>
<td width="50%"><input type="text" Name="City" size="20"></td>
</tr>
<tr>
<td width="50%">邮政编码</td>
<td width="50%"><input type="text" Name="PostalCode" size="20"></td>
</tr>
<tr>
<td width="50%">所在国家</td>
<td width="50%"><input type="text" Name="Country" size="20"></td>
</tr>
<tr>
<td width="50%">联系电话</td>
<td width="50%"><input type="text" Name="telephone" size="20"></td>
</tr>
<tr>
<td width="50%">FAX</td>
<td width="50%"><input type="text" Name="Fax" size="20"></td>
</tr>
<tr>
<td width="50%">Email</td>
<td width="50%"><input type="text" Name="Email" size="20"></td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="submit" value="添加用户" Name="Submit">
<input type="reset" value="重新填写" Name="B2"><input type="hidden" Name="action" value="addcustomer"></p>
</form>
<p align="center"> </p>
</body>
</html>
<%
If Request("Action")<>"addcustomer" Then
Response.End
Else
If Request("Action")="addcustomer" Then
Name=Request("Name")
If Name ="" Then
Response.Write"<Script Language=Javascript>alert('用户名不能为空!');"
Response.Write"Javascript:history.go(-1)</script>"
Response.End
End If
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open(sqlOpenDB) '打开数据库
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select * From Customer Where Name='"&Name&"'",Conn
If Not Rs.Eof Then
Response.Redirect "error.asp?Error=001"
Response.End
End If
Set Rs=Nothing
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open"Customer",Conn,1,3
Conn.Execute "Insert Into Customer (Name,Password) Values ('"&Name&"','" & Request("Password") & "')"
Response.Redirect "success.asp?Success=003"
End If
End If
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -