① 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设置
⑩ 网页中加入用户名、密码、登陆及新用户注册源代码
如果在网络中使用登陆机制一般都需要数据库支持具体的代码,特别是数据库操作部分和自身的数据库各表及字段名称有关,同时实现的方式还有很多特殊情况的处理,在这里很难提供,并且从安全的角度讲,登陆与注册也不易放置在同一页面,同时还要有数据审核处理页面,甚至可以说这需要一个系统。,建议你到免费的源代码基地去找。