① 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="
'創建記錄對象
set rs=server.createobject("adodb.recordset")
%>
7,(userinfo.mdb ACCESS 資料庫)
在ACCESS中建一個表,然後在這個表中建立欄位名稱
表名:info
欄位名稱 數據類型
id 自動編號
username 文本
password 文本
sex 文本
quest 文本
qq 文本
mail 文本
personalinfo 文本
ntime 文本
② 幫忙寫個網頁用戶登錄注冊的java ee源碼,最好寫上詳細注釋。我是java ee初學者,謝謝...
可以網路私信我的
③ 我們學校的校園網登錄之後查看網頁源代碼可以直接看到用戶名和密碼,請問這樣做的風險是什麼,我對安全不
。。網頁源碼可以直接看到用戶名和密碼,當然就不安全了。。直接說:「網頁源碼可以直接看到用戶名和密碼,不安全」就夠了啊。。
④ 誰有登錄的網站源碼
JSP登陸系統 源代碼 很好的源代碼
<!-- 該Login頁面是一個簡單的登錄界面 -->
<!--
該JSP程序是用來測試與MySQL資料庫的連接,
需要一個資料庫:LearnJSP,和其中一個表:userinfo
表中有兩個欄位分別為:UserName varchar (20) not null,UserPwd varchar (20) not null
-->
<html>
<head>
<title>登錄</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="ch-cn">
</head>
<body>
<!-- Form 用來提取用戶填入並提交的信息-->
<form method="post" name="frmLogin" action="LoginServlet">
<h1 align="center">用戶登錄</h1><br>
⑤ 跪求C#網頁登陸源代碼,我的是VS2010+sql2008
這是界面,下面是源代碼,用的是三層架構
protected void Page_Load(object sender, EventArgs e)
{
EventLog log = new EventLog();
log.Source = "login:test";
log.WriteEntry("aaa", EventLogEntryType.Error);
//Response.Write("Page_Load<br/>");
}
protected void Btn_Login_Click(object sender, EventArgs e)
{
// Response.Write("Btn_Login_Click<br/>");
//取得用戶輸入的信息:類型,用戶名,密碼
int nUserType = int.Parse(DDL_Type.SelectedValue);
string strUserName = TXT_UserName.Text.Trim();
string strPassword = TXT_Password.Text.Trim();
//調用業務邏輯的用戶信息實現登陸功能
PaperSys_BLL.UserInfomation user = new PaperSys_BLL.UserInfomation();
bool bResult = user.UserDoLogin(nUserType, strUserName, strPassword);
//登陸成功
if (bResult)
{
Session["UserType"] = nUserType;
Session["UserName"] = strUserName;
Response.Redirect("~/Default.aspx");
}
else
{
System.Web.UI.ScriptManager.RegisterStartupScript(Btn_Login, this.GetType(), "message", "alert('用戶名或者密碼不正確,登陸失敗');", true);
// PaperSys_Common.MessageBox.Show(this.UpdatePanel1, "用戶名或者密碼不正確,登陸失敗");
}
}
下面是BLL層UserDoLogin方法代碼
public bool UserDoLogin(int nUserType, String strUserName, String strPassword)
{
int nResult = -1;
switch (nUserType)
{
case 3://教師登陸
break;
case 4://學生登陸
break;
default://管理員
nResult = user.DoAdminLogin(nUserType, strUserName, strPassword);
break;
}
if (nResult == 1)
{
return true;
}
else
{
return false;
}
}
}
下面是DAL層DoAdminLogin方法代碼
public int DoAdminLogin(int nUserType, String strUserName, String strPassword)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(*) from admin where adminname = @username and adminpsd = @password ");
SqlParameter[] sqlparas = { new SqlParameter("@username", SqlDbType.VarChar, 30),
new SqlParameter("@password", SqlDbType.VarChar, 33)};
sqlparas[0].Value = strUserName;
sqlparas[1].Value = strPassword;
object obj_result = DbHelperSQL.GetSingle(strSql.ToString(), sqlparas);
if (obj_result == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj_result);
}
}
望採納,謝謝
⑥ php網站登錄注冊源碼
//login.php 負責處理用戶登錄與退出動作
if(!isset($_POST['submit'])){
exit('非法訪問!');
}
$username = htmlspecialchars($_POST['username']);
$password = MD5($_POST['password']);
//包含資料庫連接文件
include('conn.php');
//檢測用戶名及密碼是否正確
$check_query = mysql_query("select uid from user where username='$username' and password='$password' limit 1");
if($result = mysql_fetch_array($check_query)){
//登錄成功
$_SESSION['username'] = $username;
$_SESSION['userid'] = $result['uid'];
echo $username,' 歡迎你!進入 <a href="my.php">用戶中心</a>
';
echo '點擊此處 <a href="login.php?action=logout">注銷</a> 登錄!
';
exit;
} else {
exit('登錄失敗!點擊此處 <a href="javascript:history.back(-1);">返回</a> 重試');
}
註:上述源碼是在TP中的登錄驗證方法,供參考!!
⑦ asp用戶登陸源代碼及處理頁面代碼
你把登錄的form的action指向一個asp文件,如check.asp。那麼這個文件的內容如下:(註:data.mdb是你的資料庫所在目錄,login.asp是你成功登錄以後所指向的頁面,user是資料庫里的一個表;表裡要有username和password兩個欄位。)
<%
set conn=Server.Createobject("adodb.connection")adoconn.Open"Driver={Microsoft Access Driver(*.mdb)};DBQ="& _Server.MapPath("data.mdb")
username=request.form("usename")
password=request.form("password")
if username="" or password="" then
response.write ("<script language=javascript>alert'用戶名和密碼不能為空!';history.go(-1);</script>")
else
set rs=Createobject("adodb.connection")
sql="select * from user"
rs.open.sql conn,1,3
if username=rs("username") and password=rs("password") then
response.redirct "login.asp"
else
response.write ("<script language=javascript>alert'用戶名或密碼輸入錯誤,請確認!';history.go(-1);</script>")
%>
<%end if%>
<%end if%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
差不多就這樣了。你自己去調試吧。可能有些單詞寫錯了。哈哈。不好意思。如果行就多給點分吧。
⑧ 有什麼源碼可以實現要登陸之後才能顯示一個網頁,請直接附上源碼和教程謝謝啦~
登錄後建立Session 如:Session["User"]=用戶名;
判斷如果存在這個Session不為空則進入頁面 if(Session["User"]!=null){Response.Redirect("LuRusysterm.aspx")} 否則提示登錄
或者在WebConfig里配置表單驗證 在System.web下添加
<authentication mode="Forms">
<forms loginUrl="LRperson.aspx" defaultUrl="LuRusysterm.aspx" name=".ASPNETFORMSTEST" protection="All" timeout="30" ></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
⑨ 網頁登陸源代碼 (高手請進!!)
那就在IIS設置
⑩ 網頁中加入用戶名、密碼、登陸及新用戶注冊源代碼
如果在網路中使用登陸機制一般都需要資料庫支持具體的代碼,特別是資料庫操作部分和自身的資料庫各表及欄位名稱有關,同時實現的方式還有很多特殊情況的處理,在這里很難提供,並且從安全的角度講,登陸與注冊也不易放置在同一頁面,同時還要有數據審核處理頁面,甚至可以說這需要一個系統。,建議你到免費的源代碼基地去找。