當前位置:首頁 » 注冊證書 » asp注冊

asp注冊

發布時間: 2020-12-23 01:39:20

❶ asp.net登錄及注冊代碼

創建兩個類調用
(有時代碼都正確但還是注冊不了,可能是數據表有問題,刪除重表建一張)

****************************************person類:

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
///person 的摘要說明
/// </summary>
public class person
{
public string uName;
public string uPwd;
public string uSex;
public person()
{
//
//TODO: 在此處添加構造函數邏輯
//
}
}

*********************************************personOperate類

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

/// <summary>
///personOperate 的摘要說明
/// </summary>
public class personOperate
{
public personOperate()
{
//
//TODO: 在此處添加構造函數邏輯
//
}
public static SqlConnection createConnection()
{
SqlConnection con = new SqlConnection("server=.;database=log;uid=sa;pwd=sa");
return con;
}
public static bool insertOperate(person p)
{
try
{
SqlConnection con =personOperate.createConnection();
con.Open();
SqlCommand cmd = new SqlCommand("insert into www values(@uName,@uPwd,@uSex)", con);
SqlParameter para = new SqlParameter("@uName", SqlDbType.VarChar, 50);
para.Value = p.uName;
cmd.Parameters.Add(para);
para = new SqlParameter("@uPwd", SqlDbType.VarChar, 50);
para.Value = p.uPwd;
cmd.Parameters.Add(para);
para = new SqlParameter("@uSex", SqlDbType.VarChar, 2);
para.Value = p.uSex;
cmd.Parameters.Add(para);
cmd.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
return false;
}
}
}

********************************************注冊頁面代碼

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btgo_Click(object sender, EventArgs e)
{
person p = new person();
p.uName = this.tbUser.Text;
p.uPwd = this.tbPwd.Text;

if (this.rbman.Checked)
{
p.uSex = "男";
}
else
{
p.uSex = "女";
}
if(personOperate.insertOperate(p))
{
Response.Write("注冊成功");

}
else
{
Response.Write("失敗");
}

Res

注冊二代碼:

protected void btnsend_Click(object sender, EventArgs e)
{
SqlConnection con = DB.createConnection();
con.Open();
string cmdtext = "insert into newreplay(mname,msubject,mcontent,mphone,madd,mqq,mmail,mhttp,mface,mip,mdatetime,mreplaytime) values(@name,@subject,@content,@phone,@add,@qq,@mail,@http,@face,@ip,@datetime,@datetime)";
SqlCommand cmd = new SqlCommand(cmdtext, con);
cmd.Parameters.Add("@name", SqlDbType.VarChar, 50);
cmd.Parameters["@name"].Value = this.tname.Text;
cmd.Parameters.Add("@subject", SqlDbType.VarChar, 50);
cmd.Parameters["@subject"].Value = this.tsubject.Text;
cmd.Parameters.Add("@content", SqlDbType.Text);
cmd.Parameters["@content"].Value = this.tcontent.Text;
cmd.Parameters.Add("@phone", SqlDbType.VarChar, 50);
cmd.Parameters["@phone"].Value = this.tphone.Text;
cmd.Parameters.Add("@add", SqlDbType.VarChar, 50);
cmd.Parameters["@add"].Value = this.tadd.Text;
cmd.Parameters.Add("@qq", SqlDbType.VarChar, 50);
cmd.Parameters["@qq"].Value = this.tqq.Text;
cmd.Parameters.Add("@mail", SqlDbType.VarChar, 50);
cmd.Parameters["@mail"].Value = this.tmail.Text;
cmd.Parameters.Add("@http", SqlDbType.VarChar, 50);
cmd.Parameters["@http"].Value = this.thttp.Text;
cmd.Parameters.Add("@face", SqlDbType.VarChar, 50);
cmd.Parameters["@face"].Value = this.dface.SelectedValue.ToString();
cmd.Parameters.Add("@ip", SqlDbType.VarChar, 50);
cmd.Parameters["@ip"].Value = GetIP();
cmd.Parameters.Add("@datetime", SqlDbType.DateTime);
cmd.Parameters["@datetime"].Value = DateTime.Now.ToString();
try
{
cmd.ExecuteNonQuery();
con.Close();

Response.Write("<script>alert('發表成功')</script>");
this.tadd.Text = "";
this.tcontent.Text = "";
this.thttp.Text = "";
this.tmail.Text = "";
this.tsubject.Text = "";
this.tphone.Text = "";
this.tname.Text = "";
this.tqq.Text = "";
}
catch (Exception error)
{
throw new System.Exception(error.Message);
}
}

登陸:

public partial class LOGIN : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = DB.createConnec();
con.Open();
SqlCommand cmd = new SqlCommand("select * from LOGIN where name='" + this.TextBox1.Text + "'and password='" + this.TextBox2.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["username"] = dr["name"]; //從資料庫讀出
Session["userpassword"] = dr["password"]; //從資料庫讀出
if ((int)Session["userpassword"] == 1) //類型要注意 還有一種是SESSION["WWW"].TOSTRING()=="1"; //!=
{
Response.Redirect("TIME.aspx");

}
else if ((int)Session["userpassword"] == 2)
{
Response.Redirect("add.aspx");

}
else
{
Response.Redirect("list.aspx");
}
}
else
{
Response.Write("ksks");
}
con.Close();
}
}

要是可以給我好評好么!我在收集分數

❷ asp注冊登陸代碼

1,(index.asp 用戶登陸頁面)
<!-- #include file="conn.asp" -->
<!-- blog.soowooo.cn 悠悠長假期 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>會員</title>
<style type="text/css">
<!--
body,td,th {
font-family: 宋體;
font-size: 14px;
}
-->
</style>
</head>
<body>
<center>
<p>會員注冊系統</p>
<form name="form1" method="post" action="login.asp">
<table width="34%" border="0">
<tr>
<td width="33%" height="30">用戶名:</td>
<td width="67%" height="30"><input name="username" type="text" id="username" size="15"></td>
</tr>
<tr>
<td height="30">密 碼:</td>
<td height="30"><input name="password" type="password" id="password" size="15"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="確定">
<input type="reset" name="Submit" value="重置"></td>
</tr>
<tr>
<td colspan="2"><a href="reg.asp" target="_self">注冊</a></td>
</tr>
</table>
</form>
</center>
</body>

</html>

2,(login.asp 用戶數據處理文件)

<!-- #include file="conn.asp" -->
<%
'打開資料庫判斷用戶是否存在,info為表名,username為欄位名
set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&request.Form("username")&"' and password='"&request.Form("password")&"'"
rsc.open sqlc,conn,1,1
session("username")=rsc("username")
session("password")=rsc("password")
session.Timeout=30
set rsc=nothing
response.Redirect("change.asp")
'如果用戶不存在,session("username")為空
%>
3,(change.asp 用戶信息修改頁面)
<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改</title>
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
}
-->
</style></head>
<center>
<body>
<br>
<%

set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&session("username")&"' and password='"&session("password")&"'"
rsc.open sqlc,conn,1,1
nr=rsc("password")
username=rsc("username")
password=rsc("password")
sex=rsc("sex")
qq=rsc("qq")
mail=rsc("mail")
add=rsc("add")
personalinfo=rsc("personalinfo")
vv=rsc("ntime")
set rsc=nothing
if nr="" then
response.Redirect("index.asp")
end if
if strcomp(nr,request.Form("password"))=0 then
response.Write("歡迎你!"&request.Form("username"))
response.Write("你是在"&vv&"注冊的")
session("username")=request.Form("username")
end if
if session("username")="" then
response.Redirect("index.asp")
end if
%>
<form name="form1" method="post" action="change.asp?ac=ch">
<table width="39%" height="105" border="0" >
<tr>
<td width="27%" height="30">用戶名:</td>
<td width="73%" height="30"><input name="username" type="text" id="username" value="<%=username%>">
*</td>
</tr>
<tr>
<td height="30">密 碼:</td>
<td height="30"><input name="password" type="text" id="password" value="<%=password%>">
*</td>
</tr>
<tr>
<td height="30">性 別:</td>
<td height="30"><input name="sex" type="text" id="sex" value="<%=sex%>"></td>
</tr>
<tr>
<td height="30">QQ:</td>
<td height="30"><input name="qq" type="text" id="qq" value="<%=qq%>"></td>
</tr>
<tr>
<td height="30">Mail:</td>
<td height="30"><input name="mail" type="text" id="mail" value="<%=mail%>"></td>
</tr>
<tr>
<td height="30">地 址:</td>
<td height="30"><input name="add" type="text" id="add" value="<%=add%>"></td>
</tr>
<tr>
<td>介紹</td>
<td><textarea name="personalinfo" cols="30" rows="6" id="personalinfo"><%=personalinfo%></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="修改">
<a href="change.asp?se=y" target="_self">退出系統</a></td>
<% if strcomp(request.QueryString("se"),"y")=0 then
session("username")=""
response.Redirect("index.asp")
end if
%>
</tr>
</table>
</form>
<%
if strcomp(request.QueryString("ac"),"ch")=0 then
set rs=server.createobject("adodb.recordset")
sql="select * from info where username='"&session("username")&"'"
rs.open sql,conn,1,3
rs("username")=request.Form("username")
rs("password")=request.Form("password")
rs("mail")=request.Form("mail")
rs("sex")=request.Form("sex")
rs("qq")=request.Form("qq")
rs("add")=request.Form("add")
rs("personalinfo")=request.Form("personalinfo")
rs.update
set rs=nothing
response.Write("修改完成!")
end if
%>
</body>
</center>
</html>
4,(reg.asp 新用戶注冊頁面)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用戶注冊</title>
<style type="text/css">
<!--
body,td,th {
font-family: 宋體;
font-size: 14px;
}
-->
</style>
</head>
<body>
<center>
用戶注冊<br>
<%
=request.QueryString("msg")
%>
<form name="form1" method="post" action="addnewdata.asp?ac=adser">
<table width="39%" height="105" border="0" >
<tr>
<td width="27%" height="30">用戶名:</td>
<td width="73%" height="30"><input name="username" type="text" id="username">
*</td>
</tr>
<tr>
<td height="30">密碼:</td>
<td height="30"><input name="password" type="password" id="password">
*</td>
</tr>
<tr>
<td height="30">確定密碼:</td>
<td height="30"><input name="password2" type="password" id="password2">
*</td>
</tr>
<tr>
<td height="30">性別:</td>
<td height="30"><input name="sex" type="text" id="sex"></td>
</tr>
<tr>
<td height="30">QQ:</td>
<td height="30"><input name="qq" type="text" id="qq"></td>
</tr>
<tr>
<td height="30">Mail:</td>
<td height="30"><input name="mail" type="text" id="mail"></td>
</tr>
<tr>
<td height="30">地址:</td>
<td height="30"><input name="add" type="text" id="add"></td>
</tr>
<tr>
<td>個人介紹</td>
<td><textarea name="personalinfo" cols="30" rows="6" id="personalinfo"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
5,(addnewdata.asp 新用戶注冊數據處理文件)
<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>成功</title>
</head>
<body>
<%
ac=request.QueryString("ac")
msg="注冊錯誤信息"
if request.Form("username")="" then
msg=msg&"<br>"&"用戶名不能為空"
end if
if strcomp(cstr(request.Form("password")),cstr(request.Form("password2")))<>0 then
msg=msg&"<br>"&"兩次密碼輸入不同"
end if

if len(request.Form("password"))<6 then
msg=msg&"<br>"&"密碼太簡單"
end if

if strcomp(msg,"注冊錯誤信息")>0 then
response.Redirect("reg.asp?msg="&msg)
end if
if ac="adser" then
set rsc=server.createobject("adodb.recordset")
sql="select * from info where username='"&request.Form("username")&"'"
rsc.open sql,conn,1,1
ck=rsc("username")
set rsc=nothing
if ck<>"" then
msg=msg&"<br>"&"用戶名被人注冊"
response.Redirect("reg.asp?msg="&msg)
end if
dsql="select * from info where id is null"
set rs=server.createobject("adodb.recordset")
rs.open dsql,conn,1,3
rs.addnew
rs("username")=request.Form("username")
rs("password")=request.Form("password")
rs("mail")=request.Form("mail")
rs("sex")=request.Form("sex")
rs("qq")=request.Form("qq")
rs("add")=request.Form("add")
rs("personalinfo")=request.Form("personalinfo")
rs("ntime")=now
rs.update
set rs=nothing
%>
<center>
<a href="index.asp" target="_self">注冊成功,點擊登陸</a>
</center>
<%
end if
%>
</body>
</html>

6,(conn.asp 資料庫連接文件)
<%
'連接資料庫開始
dim conn,rs,sql
on error resume next
dbpath=server.mappath("userinfo.mdb")
set conn=server.createobject("adodb.connection")
conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;data source="&dbpath
'創建記錄對象
set rs=server.createobject("adodb.recordset")
%>

7,(userinfo.mdb ACCESS 資料庫)
在ACCESS中建一個表,然後在這個表中建立欄位名稱
表名:info

欄位名稱 數據類型
id 自動編號
username 文本
password 文本
sex 文本
quest 文本
qq 文本
mail 文本
personalinfo 文本
ntime 文本

❸ asp注冊、登錄及身份驗證

注冊:set rs=server.CreateObject("adodb.recordset")
rs.open "select * from bjx_User where useremail='"&trim(request("useremail"))&"' or username='"&trim(request("username"))&"'",conn,1,1
if rs.recordcount>0 then
call usererr()
rs.close
else
rs.closeset rs=server.CreateObject("adodb.recordset")
rs.open "select * from bjx_User",conn,1,3
rs.addnew
rs("username")=trim(request("username"))
rs("userpassword")=md5(trim(request("userpassword")),16)
rs("useremail")=trim(request("useremail"))
rs("Quesion")=trim(request("Quesion"))
rs("answer")=md5(trim(request("answer")),16)
rs("userzhenshiname")=trim(request("userzhenshiname"))
rs("shouhuodi")=trim(request("shouhuodi"))
rs("youbian")=trim(request("youbian"))
rs("usertel")=trim(request("usertel"))
rs("songhuofangshi")=trim(request("songhuofangshi"))
rs("fufangshi")=trim(request("fufangshi"))
rs("adddate")=now()
rs("lastlogin")=now()
rs("logins")=1rs("reglx")=1
rs("jifen")=0
rs("jiaoyijine")=0
rs("sex")=1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs.update
rs.close
set rs=nothing登錄:
<!--#include file="Include/Iheeo_Conn.asp"-->
<!--#include file="Include/md5.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%dim username,userpassword,comeurl,verifycode
username=replace(trim(request("username")),"'","")
userpassword2=replace(trim(request("userpassword")),"'","")
userpassword=md5(userpassword2,16)
verifycode=replace(trim(request("verifycode")),"'","")
if username="" or userpassword="" then
response.write "<script LANGUAGE='javascript'>alert('您的用戶名或密碼有誤!');history.go(-1);</script>"
response.end
end ifif cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('請輸入正確的驗證碼!');history.go(-1);</script>"
response.end
end ifset rs=server.CreateObject("adodb.recordset")
rs.Open "select * from bjx_User where username='"&username&"' and userpassword='"&userpassword&"' " ,conn,1,3
if not(rs.bof and rs.eof) then
if userpassword=rs("userpassword") then
response.Cookies("bjx")("username")=trim(request("username"))
response.Cookies("bjx")("reglx")=rs("reglx")
response.Cookies("bjx")("jifen")=rs("jifen")
response.Cookies("bjx")("jiaoyijine")=rs("jiaoyijine")rs("lastlogin")=now()
rs("logins")=rs("logins")+1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
rs.Close
set rs=nothing
Session("GetCode")="1234"
response.write "<IFRAME SRC=bbs/login.asp?action=chk&username="&username&"&password="&userpassword2&"&codestr=1234&CookieDate=0 width=0 height=0 frameborder=no border=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=no></IFRAME>"
username=trim(request("username"))
conn.execute("delete from BJX_action where username='"&username&"' and zhuangtai=7")
conn.execute("delete from BJX_action_jp where username='"&username&"' and zhuangtai=7")
if request("linkaddress")="" then
backlink=request.servervariables("http_referer")
else
backlink=request("linkaddress")
end if
%>
正在登錄,請稍等,正在為你轉向......
<meta http-equiv="refresh" content="3;url=<%=backlink%>">
<%
else
response.write "<script LANGUAGE='javascript'>alert('對不起,您的用戶名或密碼有誤!');history.go(-1);</script>"
end if
else
response.write "<script LANGUAGE='javascript'>alert('對不起!您的用戶名或密碼有誤!');history.go(-1);</script>"
end if%>資料庫連接<%
dim startime,conn,connstr,db,rs,rs_s,rs_s1
startime=timer()
db="data/Iheeo_DB.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
%>

❹ asp+sql 用戶注冊

=====================================================
1.(建立資料庫)
在SQL中建一個表,然後在這個表中建立欄位名稱
表名:欄位名稱 數據類型
id 自動編號
username 文本
password 文本
sex 文本
quest 文本
qq 文本
mail 文本
personalinfo 文本
ntime 文本
=====================================================
2.(新建資料庫連接文件 conn.asp )
<%
'連接資料庫開始
dim conn,rs,sql
on error resume next
dbpath=server.mappath("userinfo.mdb")
set conn=server.createobject("adodb.connection")
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=SQL伺服器名稱或IP地址;UID=sa;PWD=資料庫密碼;DATABASE=資料庫名稱" '創建記錄對象
set rs=server.createobject("adodb.recordset")
%>
======================================
3.(新建用戶登陸頁面index.asp )
<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用戶登錄</title>
</head>
<body>
<center>
<p>會員注冊</p>
<form name="form1" method="post" action="login.asp">
<table width="34%" border="0">
<tr>
<td width="33%" height="30">用戶名:</td>
<td width="67%" height="30"><input name="username" type="text" id="username" size="15"></td>
</tr>
<tr>
<td height="30">密 碼:</td>
<td height="30"><input name="password" type="password" id="password" size="15"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="確定">
<input type="reset" name="Submit" value="重置"></td>
</tr>
<tr>
<td colspan="2"><a href="reg.asp" target="_self">注冊</a></td>
</tr>
</table>
</form>
</center>
</body></html>==============================================================4.(新建用戶登錄數據處理文件login.asp)<!-- #include file="conn.asp" -->
<%
'打開資料庫判斷用戶是否存在,info為表名,username為欄位名
set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&request.Form("username")&"' and password='"&request.Form("password")&"'"
rsc.open sqlc,conn,1,1
if not rsc.eof and not rsc.bof then
session("username")=rsc("username")
session("password")=rsc("password")
session.Timeout=30
response.write("登錄成功")
else
response.write("登錄失敗")
end if
%>=============================================================5.(新建用戶注冊頁面reg.asp )
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用戶注冊</title>
<style type="text/css">
</head>
<body>
<center>
用戶注冊<br>
<form name="form1" method="post" action="addnewdata.asp?ac=adser">
<table width="39%" height="105" border="0" >
<tr>
<td width="27%" height="30">用戶名:</td>
<td width="73%" height="30"><input name="username" type="text" id="username">
*</td>
</tr>
<tr>
<td height="30">密碼:</td>
<td height="30"><input name="password" type="password" id="password">
*</td>
</tr>
<tr>
<td height="30">確定密碼:</td>
<td height="30"><input name="password2" type="password" id="password2">
*</td>
</tr>
<tr>
<td height="30">性別:</td>
<td height="30"><input name="sex" type="text" id="sex"></td>
</tr>
<tr>
<td height="30">QQ:</td>
<td height="30"><input name="qq" type="text" id="qq"></td>
</tr>
<tr>
<td height="30">Mail:</td>
<td height="30"><input name="mail" type="text" id="mail"></td>
</tr>
<tr>
<td height="30">地址:</td>
<td height="30"><input name="add" type="text" id="add"></td>
</tr>
<tr>
<td>個人介紹</td>
<td><textarea name="personalinfo" cols="30" rows="6" id="personalinfo"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交"></td>
</tr>
</table>
</form>
</center>
</body>
</html>======================================================================6.(新建用戶注冊數據處理文件addnewdata.asp )
<!-- #include file="conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>成功</title>
</head>
<body>
<%
ac=request.QueryString("ac")
msg="注冊錯誤信息:"
if request.Form("username")="" then
msg=msg&"<br>"&"用戶名不能為空"
end if
if strcomp(cstr(request.Form("password")),cstr(request.Form("password2")))<>0 then
msg=msg&"<br>"&"兩次密碼輸入不同"
end ifif len(request.Form("password"))<6 then
msg=msg&"<br>"&"密碼過於簡單"
end ifif strcomp(msg,"注冊錯誤信息")>0 then
response.Redirect("reg.asp?msg="&msg)
end if
if ac="adser" then
set rsc=server.createobject("adodb.recordset")
sql="select * from info where username='"&request.Form("username")&"'"
rsc.open sql,conn,1,1
ck=rsc("username")
set rsc=nothing
if ck<>"" then
msg=msg&"<br>"&"用戶名被人注冊"
response.Redirect("reg.asp?msg="&msg)
end if
dsql="select * from info where id is null"
set rs=server.createobject("adodb.recordset")
rs.open dsql,conn,1,3
rs.addnew
rs("username")=request.Form("username")
rs("password")=request.Form("password")
rs("mail")=request.Form("mail")
rs("sex")=request.Form("sex")
rs("qq")=request.Form("qq")
rs("add")=request.Form("add")
rs("personalinfo")=request.Form("personalinfo")
rs("ntime")=now
rs.update
set rs=nothing
%>
<center>
<a href="index.asp" target="_self">注冊成功,點擊登陸</a>
</center>
<%
end if
%>
</body>
</html>

❺ 用asp做一個注冊頁面

怎麼用注冊名跟來資料庫源中已有的用戶名進行比較?
設計一個處理注冊信息的頁面,有表單信息傳過來的時候先打開資料庫,用表單傳過來的用戶名與資料庫里的用戶名比較,如果有相等的就返回不能注冊的提示
怎麼比較?
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("db.mdb")
rs.open "select * from [數據表] where [user] = '"&request("user")&"'",conn,1,1
if rs.eof then
沒有重名的處理
else
有重名的處理
end if

❻ asp 用戶注冊頁面

if (user<>"" and pw1<>"") and pw2<>"" then
用戶名user和密碼pw1都不為空的同時重復密碼pw2也不為空
if pw1=pw2 then
密碼pw1等於重復密碼pw2
sql="select * from 用戶表內 where 用戶名='"&request("reg_user")&"'"
rs.open sql,conn,1,1
查詢用戶名request("reg_user")是否存容在(此處好象與user又無關了,應該是user才對的)
if rs.RecordCount=0 then 等於0時查詢的用戶名不存在,大於0時查詢的用戶名存在就不能注冊
conn.execute("insert into 用戶表(用戶名,密碼,真實姓名,性別,電話,手機,電子郵件,住址,說明) values ('"+user+"','"+pw1+"','"+realname+"','"+sex+"','"+phone+"','"+mphone+"','"+email+"','"+add+"','"+inf+"')") 此代碼是注冊寫入資料庫

❼ ASP 簡單注冊

不知道是不是我頁面在手機網頁上顯示的問題,看不到大於符號,如果直接顯示了代碼,就說明代碼根本就沒有運行,可能就是沒有ASP標簽(<%%>)或者文件類型不是ASP

❽ asp注冊,怎麼防止重復帳號注冊..

if not rs.eof then
response.write("<script>alert('錯誤:用戶名抄已存在,請改名!');history.go(-1)</script>")
Response.end()
else
rs.addnew
rs("username")=username
rs.update
response.write("<script>alert('提交成功');</script>")
rs.close
end if

樓主說加上去就報錯.能把報錯信息貼上來么?你這代碼沒辦法看出是什麼錯誤

❾ asp會員注冊代碼

IF Trim(Request.Form("passstring"))="" Or Trim(Request.Form("passstring"))<>Trim(Request.Form("repassstring")) Then
Response.Write("<script language=javascript>alert('輸入錯誤,請檢查您兩次輸入的新密碼!');history.back();</script>")
Response.End()
End IF
IF Trim(Request.Form("userid"))="" Then
Response.Write("<script language=javascript>alert('呵呵,忘了輸入管理員了!');history.back();</script>")
Response.End()
Else
userid = Trim(Request.Form("userid"))
SQLString = "Select * From table_master Where userid ='" & userid &"'"
Set MM_RecordSet = GetRecordset(SQLString)
IF Not MM_Recordset.Eof Then '判定無記錄或密碼不符
Response.Write("<script language=javascript>alert('該管理員已經存在,請重新輸入!');history.back();</script>")
ReleaseRecordset(MM_Recordset)
Else
ReleaseRecordset(MM_Recordset)
passstring=Trim(Request.Form("passstring")) '讀取用戶輸入的新口令
passstring=md5(passstring) '新口令一次(md5)加密
'passstring=Trim(Request.Form("userpwd")) '新口令一次(SHA-1)加密
SQLString = "INSERT INTO table_master(username,mobile,email,msn,userid,passString,regdate,logtimes,lastaccess,popedom) VALUES("
SQLString = SQLString & "'" & Trim(Request.Form("username")) &"','" &Trim(Request.Form("mobile")) & "','" & Trim(Request.Form("email")) & "','" & Trim(Request.Form("msn")) &"','" &userid & "','" &passstring &"',#" & Date() & "#,0,#" & Date() & "#,1"
SQLString = SQLString & ")"
'Response.Write(SQLString)
GetRecordset SQLString
End IF
End IF
---------------------------------------------------
這是我某個網站的管理員添加部分的代碼,用戶注冊表單製作部分我就不給你寫了,相信你能做,然後你要做的就是把這段代碼中相應的部分修改一下就好了。——
----------------------------------------------------
ps:你的問題不是代碼怎麼改,而是你應該怎麼做。代碼沒問題。只要把代碼中提到的資料庫相關的東西完善就可以了。
留下郵箱我把改完的東西發給你。

❿ ASP網站用戶注冊怎麼寫

<form action="Reg.asp" method="post" name="form1">
用戶名:<input type="text" name="UserName" id="UserName" value="">
密碼:<input type="password" name="UserPass" Id="UserPass" value="">
確認密碼:<input type="Password" name="UserPass2" id="userpass2" value="">
E-mail:<input type="text" name="email" id="email" value="">
<input stype="submit" value="提交">
</form>
再建個reg.asp文件,用來接收數專據屬並添加亓資料庫即可

熱點內容
美發店認證 發布:2021-03-16 21:43:38 瀏覽:443
物業糾紛原因 發布:2021-03-16 21:42:46 瀏覽:474
全國著名不孕不育醫院 發布:2021-03-16 21:42:24 瀏覽:679
知名明星確診 發布:2021-03-16 21:42:04 瀏覽:14
ipad大專有用嗎 發布:2021-03-16 21:40:58 瀏覽:670
公務員協議班值得嗎 發布:2021-03-16 21:40:00 瀏覽:21
知名書店品牌 發布:2021-03-16 21:39:09 瀏覽:949
q雷授權碼在哪裡買 發布:2021-03-16 21:38:44 瀏覽:852
圖書天貓轉讓 發布:2021-03-16 21:38:26 瀏覽:707
寶寶水杯品牌 發布:2021-03-16 21:35:56 瀏覽:837