resinger.asp
- VB code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <form id="form1" name="form1" method="post" action=""> <p>用户名 <input name="user" type="text" id="user" /> </p> <p>邮箱 <input name="email" type="text" id="email" /> </p> <p> 密码 <input name="pass" type="text" id="pass" /> </p> <p> 确认密码 <input name="pass2" type="text" id="pass2" /> </p> <p> <input type="submit" name="Submit" value="提交" /> <input type="reset" name="Submit2" value="重置" /> </p> </form> </body> </html>
save.asp
- VB code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="Conn.asp"--> <!--#include file = "md5.asp"--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <% name=Trim(Request.Form("name")) pass=md5(Trim(Request.Form("pass"))) email=Trim(Request.Form("email")) Set rs = server.CreateObject("adodb.recordset") sql="select name="&name&" and email="&email&"" rs.Open sql, conn, 1, 1 %> </body> </html>
------解决方案--------------------
sql="select * From TableName name='" & name & "' and email='" & email & "'"
Set rs = conn.Execute(sql)
Dim HasName
HasName = rs.EOF
rs.Close
If HasName Then
sql = "Insert into ......."
Else
Response.Write "改用户已经存在"
End If