1、asp网页设计中用户登录
<script language=javascript>
<!--
//验证输入
function CheckForm()
{
if(document.Login.uid.value=="")
{
alert("请输入用户名!");
document.Login.uid.focus();
return false;
}
if(document.Login.pwd.value == "")
{
alert("请输入密码!");
document.Login.pwd.focus();
return false;
}
if (document.Login.verifycode.value==""){
alert ("请输入您的验证码!");
document.Login.verifycode.focus();
return(false);
}
}
-->
</script>
//表单
FORM name="Login" action="admin_check.asp" method="post" onSubmit="return CheckForm();">
<table width="682" height="170" border="0" align="center" cellpadding="0" cellspacing="0" background="images/backlogin.jpg"class="t_table">
<tr>
<th width="134" height="100" scope="col"> </th>
<th width="53" scope="col"> </th>
<th width="84" scope="col"> </th>
<th width="100" scope="col"> </th>
<th width="111" scope="col"> </th>
<th width="44" scope="col"> </th>
</tr>
<tr>
<td height="35"> </td>
<td><span class="STYLE3">管理员:</span></td>
<td colspan="2"><input name="uid" class="inputname" type="text" id="uid" style="border: 1px solid #999999;FONT-SIZE: 9pt; height:21;width:165" size="16"></td>
<td rowspan="3"> </td>
<td> </td>
</tr>
<tr>
<td height="35"> </td>
<td><span class="STYLE3">密 码:</span></td>
<td colspan="2"><input name="pwd" class="inputpassword" type="password" id="pwd" style="border: 1px solid #999999;FONT-SIZE: 9pt; height:21;width:165" size="16"></td>
<td> </td>
</tr>
<tr>
<td height="35"> </td>
<td>验证码:</td>
<td><input name=verifycode type=text value="<%If GetCode=9999 Then Response.Write "9999"%>" maxlength=4 size=10 style="border: 1px solid #999999; FONT-SIZE: 9pt;"></td>
<td><img src=GetCode.asp></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="4" valign="middle">
<input name="button" type="image" src="images/login.gif" width="74" height="39" border="0"> <a href="../index.asp"><img src="images/quxiao.gif" width="75" height="39" border="0"></a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="4"> </td>
<td> </td>
</tr>
</table>
</FORM>
以上的放在同一个asp文件中
//admin_check.asp
<%response.Expires = 0%>
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
'防SQL注入
function errsql(strget)
strcheck=strget
dim nothis(16)
nothis(0) = "net user"
nothis(1) = "xp_cmdshell"
nothis(2) = "/add"
nothis(3) = "exec%20master.dbo.xp_cmdshell"
nothis(4) = "net localgroup administrators"
nothis(5) = "select"
nothis(6) = "count"
nothis(7) = "asc"
nothis(8) = "char"
nothis(9) = "mid"
nothis(10) = "'"
nothis(11) = """"
nothis(12) = "insert"
nothis(13) = "delete"
nothis(14) = "drop"
nothis(15) = "truncate"
nothis(16) = "from"
for i=1 to ubound(nothis)
if instr(strget,nothis(i)) then
response.write "<script language=javascript>alert('输入信息含有非法字符,请重新输入!');history.go(-1);</script>"
response.End
end if
next
errsql = strcheck
end function
%>
<%
dim admin,password,webpassword
admin=errsql(trim(request("uid")))
webpassword=errsql(trim(request("pwd")))
password=md5(webpassword)
if cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from master where name='"&admin&"' and password='"&password&"' " ,conn,1,1
if not(rs.bof or rs.eof) then
if password=rs("password") then
session("admin")=trim(rs("name"))
session.Timeout=20
rs.Close
set rs=nothing
response.Redirect "index.asp"
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
%>
上面的conn.asp是连接Access数据库的,数据库和数据库的表,自己建立没问题吧
2、javascript html 设计一个登录界面
注册页面代码:
登录页面代码:
以上代码使用了WEB SQL,还请选择合适的浏览器查看。
3、html网页设计:一个简单的登录界面代码!
是这样的效果吗?
<!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>
<title>3</title>
<script>
function r()
{
var username=document.getElementById("username");
var pass=document.getElementById("password");
if(username.value=="")
{
alert("请输入用户名");
username.focus();
return;
}
if(pass.value=="")
{
alert("请输入密码");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table width="350" bgcolor="#ccffcc" style="border-color" border="1">
<tr align=center>
<td>用户名</td><td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 码</td><td><input type="password" name="password" id="password"></td></tr>
<tr align=center><td>验证码</td><td><input type="text" name="yanzheng"></td></tr>
<tr align=center><td colspan="2"><input type="button" value="登 录" onclick="r();"/> <input type="reset" value="重 置"/></td></tr>
</table>
</form>
</body>
</html>
4、asp网页设计中,怎么实现用户登录,并且登陆状态保持在当前页面,类似于这种
html5以前是不可能实现,html页面之间的参数传递,但是现在可用localStorage或者sessionStorage来实现,百度下就有了。
5、网页设计中用户登陆设计时怎样与数据库连接?
这样:
一个数据库,表名为login,假设为Access数据库,内有name,pw两个字段。
一个登陆页面:login.asp
一个检验页面:check.asp
login.asp部分代码(省略html代码,只列部分关键代码,不会的可发送消息给我):
<form method="post" action="info.asp">
<input type="type" name="name">
<input type="password" name="pw">
</form>
check.asp部分代码:
<%
dim name,pw
name=trim(request("name"))
pw=trim(request("pw"))
if name="" or pw="" then
response.Write "<script language='javascript'>window.confirm('对不起,用户名或密码均不能为空!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
set rs=server.CreateObject("adodb.recordset")
sql="select * from info where name='"&name&"' and pw='"&pw&"'"
rs.open sql,conn,1,1
if rs.recordcount=0 then
response.Write "<script language='javascript'>window.confirm('对不起,用户名或密码错误,请重新登陆!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
response.Write "<script language='javascript'>alert('登陆成功!');</script>"
response.Write "location.href='admin.asp';" ''admin.asp为登陆成功后转向的页面
end if
end if
%>
6、网页制作中登陆界面设计代码
<%@language=vbscript codepage=936 %>
<%
option explicit
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'主要是使随机出现的图片数字随机
%>
<html>
<head>
<title>管理员登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="Admin_Style.css">
<script language=javascript>
function SetFocus()
{
if (document.Login.UserName.value=="")
document.Login.UserName.focus();
else
document.Login.UserName.select();
}
function CheckForm()
{
if(document.Login.UserName.value=="")
{
alert("请输入用户名!");
document.Login.UserName.focus();
return false;
}
if(document.Login.Password.value == "")
{
alert("请输入密码!");
document.Login.Password.focus();
return false;
}
//if (document.Login.CheckCode.value==""){
// alert ("请输入您的验证码!");
// document.Login.CheckCode.focus();
// return(false);
}
}
</script>
</head>
<body onLoad="SetFocus();">
<p> </p>
<form name="Login" action="Admin_ChkLogin.asp" method="post" target="_parent" onSubmit="return CheckForm();">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="0" class="border" >
<tr class="title">
<td colspan="2" align="center"> <strong>管理员登录</strong></td>
</tr>
<tr>
<td height="120" colspan="2" class="tdbg">
<table width="250" border="0" cellspacing="8" cellpadding="0" align="center">
<tr>
<td align="right">用户名称:</td>
<td><input name="UserName" type="text" id="UserName2" size="23" maxlength="20"></td>
</tr>
<tr>
<td align="right">用户密码:</td>
<td><input name="Password" type="password" size="23" maxlength="20"></td>
</tr>
<tr>
<td align="right">验 证 码:</td>
<td><input name="CheckCode" size="15" maxlength="6">
1109 </td>
</tr>
<tr>
<td colspan="2"> <div align="center">
<input type="submit" name="Submit" value=" 确认 ">
<input name="reset" type="reset" id="reset" value=" 清除 ">
<br>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center">后台管理页面需要屏幕分辨率为 <font color="#FF0000"><strong>1024*768</strong></font>
或以上才能达到最佳浏览效果!<br>
需要浏览器为<strong><font color="#FF0000"> </font></strong><font color="#FF0000"><strong>IE5.5</strong></font>
或以上版本才能正常运行!!!</p>
</form>
</body>
</html>
7、我要设计一个网站,现在做一个登陆页面,怎样使登陆页面与SQL数据库相连?
最简单的
string connString = ConfigurationManager.AppSettings["ConnectionString"]
string username=Request.QueryString["username"]
string sql="select username , password from user where username=username"
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
conn.Open();
DataSet ds = new DataSet();
adapter.Fill(ds);
if(ds.table[0].Rows[0]["username"])
{
Response.Write "登录成功"
}
8、网站设计中怎么实现让用户登录后还跳到原来的页面
1.可以用session记录登录前的页面地址;
2.在登录页面用个隐藏的input记录refer页面,然后和登录信息一块提交。
9、如何设计网站的用户注册登录这一部分的数据库。
说的不太明白,首先要制作用户登录是使用表单实现的,最基本的要有四个页面可以实现,第一个页面时登录页面,第二个是登录成功的页面,第三个是登录失败的页面,第四个页面是验证的页面,在登陆页面上使用form action=“验证的页面”在验证的页面上使用 session获取对象,具体方法<body> <% Session("name")=request.form("name") Session("password")=request.form("pass") If Session("name")="王明"and Session("password")="123" Then Response.Redirect"chonggong.asp" Else Response.Redirect"shi.asp" End If %> </body>这与数据库连接可以在Dreamweaver中添加实现。有什么不明白的给我回话。希望我说的对你有所帮助
10、网站的登录页面应该怎么设计
网站的登录页面要求简单、干净;主要展示用户名、密码;下面就有个注册和忘记密码,以这样的形式来展示就可以了。