『壹』 asp中的登錄注冊的源碼怎麼寫
分類: 教育/科學 >> 學習幫助
問題描述:
希望大家多多幫忙!!!!!!
解析:
1,(index 用戶登陸頁面)
<!-- #include file="conn" -->
<!-- blog.soowooo 悠悠長假期 -->
<>
<head>
<meta -equiv="Content-Type" content="text/; 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">
<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" target="_self">注冊</a></td>
</tr>
</table>
</form>
</center>
</body>
</>
2,(login 用戶數據處理文件)
<!-- #include file="conn" -->
<%
'打開資料庫判斷用戶是否存在,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")
'如果用戶不存在,session("username")為空
%>
3,(change 用戶信息修改頁面)
<!-- #include file="conn" -->
<>
<head>
<meta -equiv="Content-Type" content="text/; 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")
end if
if strp(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")
end if
%>
<form name=form1 method="post" action="change?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?se=y" target="_self">退出系統</a></td>
<% if strp(request.QueryString("se"),"y")=0 then
session("username")=""
response.Redirect("index")
end if
%>
</tr>
</table>
</form>
<%
if strp(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>
</>
4,(reg 新用戶注冊頁面)
<>
<head>
<meta -equiv="Content-Type" content="text/; 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?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>
</>
5,(addnewdata 新用戶注冊數據處理文件)
<!-- #include file="conn" -->
<>
<head>
<meta -equiv="Content-Type" content="text/; charset=gb2312">
<title>成功</title>
</head>
<body>
<%
ac=request.QueryString("ac")
msg="注冊錯誤信息"
if request.Form("username")="" then
msg=msg&"<br>"&"用戶名不能為空"
end if
if strp(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 strp(msg,"注冊錯誤信息")>0 then
response.Redirect("reg?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?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" target="_self">注冊成功,點擊登陸</a>
</center>
<%
end if
%>
</body>
</>
6,(conn 資料庫連接文件)
<%
'連接資料庫開始
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 文本
『貳』 求網頁登錄注冊源碼
分5個文件:
1:登錄頁面 login.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登錄</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="33%" height="64" id="table1">
<form name="form" action="go.asp" method="post"><tr>
<td>用戶名:<input name="user"></td>
</tr>
<tr>
<td>密 碼:<input type="password" name="pwd"></td>
</tr>
<tr>
<td><input name="sub" value="登錄" type="submit"></td>
</tr></form>
</table>
</body>
</html>
------------------------
2.資料庫連接文件 conn.asp
<%set rs=server.createobject("adodb.recordset")
conn = "driver={Microsoft Access Driver (*.mdb)};DBQ="&server.mappath("data.mdb")
%>
-------------------------
3:登錄檢測頁面 go.asp
<!-- #include file="conn.asp" -->
<%
pwd=request.Form("pwd")
set rs=server.createobject("adodb.recordset")
sql="select * from user where name='"&request.Form("user")&"'"
rs.open sql,conn,1,1
if rs.eof or rs.bof then'如果用戶名不存在
response.Write"<script language=javascript>alert('請輸入正確的用戶名!');history.go(-1);</script>"
Response.End()
else
if rs("pwd")<>pwd then'如果密碼不對
response.write "<script language=JavaScript>alert('密碼有誤!');history.back();</script>"
else
response.write("登錄成功")'
end if
end if%>
-------------------------------
4。注冊文件 add.asp
<!-- #include file="conn.asp" -->
<%
sql="select * from user where u_user='"&request.Form("user")&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.BOF or rs.EOF then
rs.addnew
rs("name")=request.Form("user")
rs("pwd")=request.Form("pwd")
rs.update
rs.close
set rs=nothing
response.Write ("注冊成功!")
else
rs.close
set rs=nothing
response.write ("此用戶已被注冊")
end if
%>
4。注冊頁面 re.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>注冊</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="33%" height="64" id="table1">
<form name="form" action="add.asp" method="post"><tr>
<td>用戶名:<input name="user" size="23"></td>
</tr>
<tr>
<td>密 碼:<input name="pwd" size="23" id="pwd"></td>
</tr>
<tr>
<td><input name="sub" value="注冊" type="submit"></td>
</tr></form>
</table>
</body>
</html>
將這幾個文件和資料庫「data.mdb」放在同一目錄內
資料庫建一個USER表
含name pwd 兩個欄位 文本類型
運行login.htm測試登錄
運行re.htm測試注冊
『叄』 易語言軟體賬號注冊系統和賬號後台管理系統源碼(簡單就行)
那就是數組里出問題了唄。比如只有5個人點名,你非要點第6個名當然沒人回答了,也就出錯了也就是超出范圍了
『肆』 求ASP源碼,功能:可注冊用戶,用戶可登記、添加、修改某物品資料,管理員可管理、查詢、統計用戶添加的物
有很多,你說具體點什麼類型的asp源碼
『伍』 求軟體注冊源碼和注冊機源碼 (易語言)
程序名 返回值類型 公開 備 注
__啟動窗口_創建完畢 精易論壇
參數名 類 型 參考 可空 數組 備 注
變數名 類 型 靜態 數組 備 注
注冊碼 文本型
注冊表 文本型
XP風格 (1)
注冊碼 = 到文本 (取硬碟特徵字 () + 2234240 × 0)
注冊表 = 到文本 (取文本注冊項 (4, 「SOFTWARE\ceshi\zhucema」, ))
如果 (注冊碼 = 注冊表)
載入 (窗口1, , 假)
銷毀 ()
編輯框1.內容 = 到文本 (取硬碟特徵字 ())
子程序名 返回值類型 公開 備 注
_按鈕1_被單擊 精易論壇
參數名 類 型 參考 可空 數組 備 注
如果 (編輯框2.內容 = 到文本 (取硬碟特徵字 () + 2234240 × 0))
信息框 (「注冊成功」, 0, )
寫注冊項 (4, 「SOFTWARE\ceshi\zhucema」, 到文本 (取硬碟特徵字 () + 2234240 × 0))
載入 (窗口1, , 假)
銷毀 ()
信息框 (「注冊失敗」, 0, )
子程序名 返回值類型 公開 備 注
_按鈕2_被單擊 精易論壇
參數名 類 型 參考 可空 數組 備 注
結束 ()
-------------------------------------------------------------------------------
【注冊機源碼】
窗口程序集名 基 類 公 開 備 注
窗口程序集1 精易論壇
變數名 類 型 數組 備 注
子程序名 返回值類型 公開 備 注
__啟動窗口_創建完畢 精易論壇
參數名 類 型 參考 可空 數組 備 注
XP風格 (1)
子程序名 返回值類型 公開 備 注
_按鈕1_被單擊 精易論壇
參數名 類 型 參考 可空 數組 備 注
變數名 類 型 靜態 數組 備 注
注冊碼 文本型
機器碼 整數型
機器碼 = 到整數 (編輯框1.內容)
注冊碼 = 到文本 (機器碼 + 2234240 × 0)
編輯框2.內容 = 注冊碼
子程序名 返回值類型 公開 備 注
_按鈕2_被單擊 精易論壇
參數名 類 型 參考 可空 數組 備 注
銷毀 ()
『陸』 JAVA用戶注冊 (我要源代碼)
跑這兒作家庭作業了? 如果連用哪種頁面技術都不知道提的話,恐怕別人給你源代碼你也看不懂哦,想想別人給你個tapestry、Wicket之類的寫的代碼,拿給老師肯定挨批的喲(一看就露餡了)。
『柒』 php 用戶注冊源碼
<html>
<head>
<title>用戶注冊</title>
</head>
<body>
<strong>用戶注冊</strong>
<form action="reg.php" method="post">
用戶名稱:<input type="text" name="user"><br>
您的密碼:<input type="password" name="pass"><br>
確定密碼:<input type="password" name="pass2"><br>
<input type="submit" name="submit" value="注冊">
</form>
</body>
</html>
<?php
include ('conn.php'); //這里是您配置的資料庫
if($_POST[submit]){
//判斷用戶名不低於字數
$struser=strlen($_POST[user]);
if($struser <= 4){
echo "<script language=javascript>alert('注冊請輸入5位數以上');history.go(-1);</script>";
exit;
}
//判斷用戶是否存在
$users=$_POST[user];
$result=mysql_query("select * from manage where user='$users'");
$row=mysql_fetch_array($result);
if($_POST[user]==$row[user]){
echo "<script language=javascript>alert('啊!這個名字有人注冊啦!');history.go(-1);</script>";
exit;
}
//判斷用戶密碼兩次輸入正確
if($_POST[pass]!=$_POST[pass2]){
echo "<script language=javascript>alert('親,別耍我啦,兩次密碼怎麼能輸入不一樣呢?');history.go(-1);</script>";
exit;
}
$_POST[pass]=md5($_POST[pass]);
$sql=mysql_query("insert into manage(id,user,pass)
VALUES('','$_POST[user]','$_POST[pass]')
");
if($sql){
echo "<script language=javascript>alert('親,注冊成功!');history.go(-1);</script>";
}
else {
echo "<script language=javascript>alert('對不起,親!注冊失敗咯!');history.go(-1);</script>";
}
exit;
}
mysql_close($con)
?>
我自己寫的 很簡單,100%適合新人。加密了密碼,利用的是MD5
『捌』 跪求簡單的php用戶注冊源碼
<?php
include 'conn.php';
if($_POST['submit']){
$sql = "INSERT INTO admin (Aid,Aname,Apass) values ('','$_POST[Aname]','$_POST[Apass]')";
mysql_query($sql);
echo $sql;
}
?>
<script type="text/javascript">
function regcheck(){
if(regform.Aname.value==""){
alert("用戶名不得為空");
regform.Aname.focus();
return false;
}
if(regform.Apass.value==""){
alert("密碼不得為空");
regform.Apass.focus();
return false;
}
}
</script>
<form action="zhuceyeA.php" name="regform" method="post" onsubmit="return regcheck()">
注冊管理員<br>
用戶名:<input type="text" name="Aname">
密碼:<input type="password" name="Apass">
<input type="submit" name="submit" value="注冊">
</form>
//我也是初學者 大四 這個代碼是我自己練手做的 資料庫很簡單 ID 用戶名 密碼(明文顯示,為了簡便起見) 高手不要笑話我。。。。
『玖』 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 文本
『拾』 用戶注冊及登錄管理 編寫c語言程序,實現軟體用戶登錄、注冊功能。
/ /你看到自己專門為你燙一下注冊和登錄系統
1新用戶注冊
2登錄
3退出
1
注冊帳號:
請輸入您的姓名:
KA西瓜
請輸入您的密碼:!
注冊成功
注冊和登錄系統
1新用戶注冊
2登錄
3退出
2
登錄帳號:
請輸入用戶名:
KA西瓜
請輸入密碼:
確定登錄成功
歡迎回來,KA西瓜
按任意鍵繼續
! >#包括中
#包括的
無效新用戶注冊(); / /用戶注冊功能
無效登錄(); / /用戶登錄功能
的main()
{
整數selectNum;
的printf(「\ nRegistered和登錄系統\ n \ n已」);
printf(「請1新用戶注冊\ N」);
printf(「請2登錄\ N」);
printf(「請3退出\ n」);
的scanf(「%d個」,&selectNum);
開關(selectNum)
{
案例1:新用戶注冊();
突破;
案例2:登錄();
突破; 案例3:printf(「請!退出程序\ n」);
出口(1);
突破;
無效新用戶注冊()
{
文件*計劃生育;
字元Linedata [50] = {0},用戶[20],通[20];
計劃生育=打開(「data.dat文件」,「在」);
printf(「請注冊帳號:\ n」);
printf(「請輸入你的姓名:\ n」);
FFLUSH(標准輸入);
得到(用戶);
printf(「請輸入您的密碼:\ n」);
FFLUSH(標准輸入);
得到(通行證);
的strcpy(Linedata,用戶);
的strcat(Linedata,「,」);
strcat的(Linedata,通行證);
strcat的(Linedata,「\ N」;);
FPUTS(Linedata,FP);
FCLOSE(FP);
printf(「請!注冊成功\ n」);
的main();
}
無效登錄()
{
文件*計劃生育;
整型發現= 0;
用戶的char [20],通[20],Userstrcat [50] = {0};
字元使用用戶數據[50] = {0};
計劃生育=打開(「data.dat文件」,「R」);
printf(「請登錄帳號:\ n」);
printf(「請輸入用戶名:\ n」);
FFLUSH(標准輸入);
得到(用戶);
printf(「請輸入密碼:\ n」);
FFLUSH(標准輸入);
得到(通行證);
的strcpy(Userstrcat,用戶);
的strcat(Userstrcat,「,」);
strcat的(Userstrcat,通行證);
strcat的(Userstrcat,「\ N」);!
而(的feof(計劃生育))
{
與fgets(使用用戶數據,19,FP);
如果(STRCMP(保留使用者,Userstrcat)== 0)
{
printf(「請確定登錄成功\ n!」);
printf(「請歡迎回來,%s的\ n!」,用戶);
發現= 1;
突破;
如果
(find!){
的printf(「用戶名或密碼不正確\ n」);
FCLOSE(FP);
}