导航:首页 > 编程语言 > 登陆页面代码

登陆页面代码

发布时间:2023-03-29 16:02:03

A. asp用户登陆界面代码

login.asp:
<form name="login" method="post" action="after_login.asp">
用户名:<input name="user_name" size="12" maxlength="16">密 码:<input name="password" size="12" type="password" maxlength="16">
<input align="absMiddle" id="image1" name="image1" src="images/login.gif" type="image" WIDTH="37" HEIGHT="20">
</form>

coon.asp:
<%
connstr = "DBQ=" + server.mappathuser.mdb") + ";DRIVER={Microsoft Access Driver (*.mdb)}"
Set conn=Server.createobject("ADODB.CONNECTION")
conn.Open connstr
%>

外加after_login.asp登录验证页面:
<!--#include file="Conn.Asp"-->
<%
Dim UserName,PassWord
UserName=replace(trim(Request.Form("Username")),"'","‘")
PassWord=replace(trim(Request.Form("PassWord")),"'","‘")

If UserName="" or PassWord="" Then
Response.Write ("<script>alert('会员登陆失败!\n\n错误原因:会员帐号和密码未填。');history.back();</script>")
Response.end
End If

if Instr(UserName,">")>0 or Instr(UserName,"<")>0 or Instr(UserName,"=")>0 or Instr(UserName,"%")>0 or Instr(UserName,chr(32))>0 or Instr(UserName,"?")>0 or Instr(UserName,"&")>0 or Instr(UserName,";")>0 or Instr(UserName,",")>0 or Instr(UserName,"'")>0 or Instr(UserName,chr(34))>0 or Instr(UserName,chr(9))>0 or Instr(UserName,"")>0 or Instr(UserName,"$")>0 then
Response.Write ("<script>alert('会员登陆失败!\n\n错误原因:会员含有非法字符!');history.back();</script>")
Response.end
else
UserName=Trim(UserName)
end if

set rs=server.createobject("adodb.recordset")
sql="select * from [user] where UserName='"&UserName&"'"
rs.open sql,conn,1,3
if rs.eof then
Response.Write ("<script>alert('会员登陆失败!\n\n错误原因:会员帐号错误。');history.back();</script>")
Response.end
else
if rs("PassWord")<>PassWord then
rs.close
set rs=nothing
Response.Write ("<script>alert('会员登陆失败!\n\n错误原因:会员密码错误。');history.back();</script>")
Response.end
else

session("UserName")=UserName'登录成功传递一个session值以便以后调用用户相关
session.timeout=300
end if
end if
rs.close
set rs=nothing
CloseDatabase
%>

B. 用ASP制作登陆页面的代码

时间关系,没给你写 所以就复制了一段 可到我论坛看看

http://forum.liehuo.net/

代码如下:

1.connection.asp里的代码是:

<%

set conn=server.createobject("adodb.connection")

conn.open "provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("student.mdb")

%>

2.yanzheng.asp里的代码是:

<!--#include file="connection.asp"-->

<%

dim zhanghao,mima

zhanghao=request("zhanghao")

mima=request("mima")

if zhanghao="" then

%>

<script language=javascript>

alert("帐号为空");

location.href="denglu.asp"

</script>

<% end if %>

<% if mima="" then

%>

<script language=javascript>

alert("密码为空");

location.href="denglu.asp"

</script>

<% end if %>

<%set rs=server.createobject("adodb.recordset")

rs.open "select * from student where zhanghao='"&zhanghao&"'",conn,1,3

if not rs.eof then

if mima=rs("mima") then

session("zhanghao")=zhanghao

Response.write("<script>location.href('index.asp')</script>" )

else

response.write ("<script>alert('用户密码错误');location.href('denglu.asp')</script>")

end if

end if

if rs.eof then

response.write ("<script>alert('用户帐号错误');location.href('denglu.asp')</script>")

end if

set rs=nothing

rs.close

%>

二、

conn.asp

<%

Set conn=Server.CreateObject("ADODB.Connection")

connstr="DBQ="+server.mappath("haha.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}"

conn.Open connstr

%>

index.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>无标题文档</title>

</head>

<body>

<form name="form1" method="post" action="login.asp">

<table width="50%" height="108" border="0" cellpadding="0" cellspacing="0">

<tr>

<td>用户名:</td>

<td><input name="us" type="text" id="us"></td>

</tr>

<tr>

<td>密码:</td>

<td><input name="pa" type="password" id="pa" value=""></td>

</tr>

<tr>

<td></td>

<td><input type="submit" name="Submit" value="提交"></td>

</tr>

</table>

</form>

</body>

</html>

login.asp

<!--#include file="conn.asp"-->

<%

us=replace(request.form("us"),"'","’")

pa=replace(request.form("pa"),"'","’")

%>

<%

set rs=server.createobject("adodb.recordset")

sql="select * from haha where us='"&us&"' and pa='"&pa&"'"

rs.open sql,conn,1,1

%>

<%

if rs.eof or rs.bof then

response.write"密码错误~"

else

response.redirect"main.asp"

end if

%>

三、

连接数据库(conn.asp)

<%

dim db,conn,connstr

db="@data.mdb"

set Conn = server.CreateObject("ADODB.Connection")

connstr="provider=microsoft.jet.oledb.4.0;data source="& server.MapPath("../data/"&db&"")

conn.Open connstr

%>

登录页面(login.asp)

<% @language=vbscript %>

<!--#include file="conn.asp"-->

<%

On Error Resume Next

dim uid

dim pwd

uid=trim(request.Form("uid")) '获得用户名

pwd=trim(request.form("pwd")) '获得密码

dim rs

set rs=server.createobject("adodb.recordset")

if uid<>"" then

dim sqlstr

sqlstr="select uid,pwd from admin where uid='"&replace(uid,"'","''")&"' and pwd='"&replace(pwd,"'","''")&"'"

rs.open sqlstr,conn,3,1

if not rs.eof then

session("uid")=uid

response.redirect "login_ok.asp" '重定位url

else

response.redirect "error.htm"

end if

else

response.redirect "error.htm"

end if

%>

C. 登陆成功代码怎么写

if Not rs.Bof And Not rs.Eof Then
response.write username&",您已来经成功自登陆成功"
else
response.write ("<script language=javascript> alert('用户名或密码输入错误,请确认!') ; history.back(-1);</script>")

D. 注册/登陆页面HTML代码该怎么写

以下为个人原创教学例子,任何人引用需注明出自网络知道用户am7972,楼主可供参考x0dx0a该例子涵盖了文本框、密码框、下拉菜单、单选框、复选框及文本区的使用x0dx0a同时在数据的使用方面涵盖了文本型、数值型、日期型、布尔型的使用x0dx0a也涵盖了在会员信息入数据库前,进行严格的数据检查x0dx0a不足处,js验证还不是太完善,不过有服务端认证足够了x0dx0a会员仿慧注册x0dx0ax0dx0ax0dx0ax0dx0a

x0dx0ax0dx0a x0dx0a x0dx0ax0dx0a x0dx0a x0dx0a x0dx0ax0dx0a x0dx0a x0dx0ax0dx0ax0dx0a

会员注员

姓名:
密码:
性别备姿答:
生日:
年龄:
爱好: 上网 读书 体育
上网方式: x0dx0a x0dx0a
个人简介:

x0dx0a====bb.asp的会员注册非法数据监测====x0dx0a<%x0dx0ausername = Request("username")x0dx0auserPassword = Request("userPassword")x0dx0aSex = Request("Sex")x0dx0auserSR = Request("userSR")x0dx0auserNL = Request("userNL")x0dx0aah = Request("ah")x0dx0aswfs = Request("swfs")x0dx0auserGrjs = Request("userGrjs")x0dx0a'判断数据合法性,绝对不能让非法数据进入系统x0dx0a'判断姓名username合不合法,是否包含非法数据x0dx0ausername = Trim(username) '例如:" 张 三 "经过处理之后变成"张 三"x0dx0aIf username ="" Thenx0dx0a Response.write "姓名不能为空"x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf Len(username)>10 Thenx0dx0a Response.write "姓名字数不能超过10个字" 'Len("Z")=1 Len("国")=2x0dx0a Response.Endx0dx0aEnd Ifx0dx0aFor i = 1 To Len(username)x0dx0a q = Mid(username,i,1) x0dx0a If InStr("!@#$%^&*()_-+|<>?/"",.",q)>0 Thenx0dx0a Response.write "姓名不能包含特殊符号!@#$%^&*()_-+|<>?/"",." x0dx0a Response.End x0dx0a End Ifx0dx0aNextx0dx0a'判断密码合不合法,是否包含非法数据userPassword = Trim(userPassword)If userPassword ="" Then Response.write "密码不能为空" Response.EndEnd Ifx0dx0aIf Len(userPassword)>20 Thenx0dx0a Response.write "密码字数不能超过20个字" x0dx0a Response.Endx0dx0aEnd Ifx0dx0a'判断密码合不合法,是否包含非法数据x0dx0aSex = Trim(Sex)x0dx0aIf Sex = "" Thenx0dx0a Response.write "性别不能为空"x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf Sex <> "True" And Sex <> "False" Thenx0dx0a Response.write "性别不能为不男不女"x0dx0a Response.Endx0dx0aEnd Ifx0dx0a'判断生日合不合法,是否包含非法数据x0dx0auserSR = Trim(userSR)x0dx0aIf userSR ="" Thenx0dx0a Response.write "生日不能为空"x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf Len(userSR)<8 Or Len(userSR)>10 Then '例如:2012-6-3 2012-11-23x0dx0a Response.write "你输入的生日字数不对,应为2012-6-3或2012-11-23格式" x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf IsDate(userSR)=False Thenx0dx0a Response.write "你输入的生日格式不能转化为日期,请核实" x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf DateDiff("yyyy",userSR,Date())<1 Or DateDiff("yyyy",userSR,Date())>200 Thenx0dx0a Response.write "根据你输入的生日你可能小于1岁或已经超过200岁了,请核查重新输入" x0dx0a Response.Endx0dx0aEnd Ifx0dx0a'判断年龄合不合法,是否包含非法数据userNL = Trim(userNL)If userNL ="" Thenx0dx0a Response.write "年龄不能为空" x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf IsNumeric(userNL)=False Thenx0dx0a Response.write "你输入的年龄不能转化为数值,请核查"x0dx0a Response.Endx0dx0aEnd Ifx0dx0auserNL = CInt(userNL)x0dx0aIf userNL<0 Or userNL>200 Thenx0dx0a Response.write "你输入的年龄不能小于0岁或者大于200岁,请核查"x0dx0a Response.Endx0dx0aEnd Ifx0dx0a'判断爱好合不合法,是否包含非法数据ah = Trim(ah) '选择多个爱好则系统会用,分开 //测试x0dx0aah = Replace(ah," ","")x0dx0aarrAh = Split(ah,",")x0dx0aFor i = LBound(arrAh) To UBound(arrAh)x0dx0a If arrAh(i)<>"sw" And arrAh(i)<>"ds" And arrAh(i)<>"ty" Then x0dx0a Response.write i & "你选择的爱好有问题,请核查" & arrAh(i)x0dx0a Response.Endx0dx0a End Ifx0dx0aNextx0dx0a'判断上网方式合不合法,是否包含非法数据swfs = Trim(swfs)If swfs = "" Thenx0dx0a Response.write "上网方式不能为空"x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf swfs<>"bhsw" And swfs<>"wxsw" And swfs<>"gxsw" Thenx0dx0a Response.write "你选择的上网方式有问题,请核查"x0dx0a Response.Endx0dx0aEnd Ifx0dx0a'判断个人简介是否为空,是否超出1000个字x0dx0auserGrjs = Trim(userGrjs)x0dx0aIf userGrjs = "" Thenx0dx0a Response.write "个人简介不能为空" x0dx0a Response.Endx0dx0aEnd Ifx0dx0aIf Len(userGrjs) > 1000 Thenx0dx0a Response.write "个人简介不能超过1000个字"x0dx0a Response.Endx0dx0aEnd Ifx0dx0aResponse.write "数据合法性检测通过"x0dx0a%>x0dx0a====登陆的HTML代码可相信楼主参照会员注册代码应该没问题了====

E. javascript 网页登陆代码

你需要增加一个servlet,读用户名密码,查询数据库都可以在 的doPost()方法中操作,判断登录成功失败后,直接用response.sendRedirect("/xs.html");跳转到成功后的界面。如果用js是操作不了数据库的。
如果不加数据库判断的话,可不用servlet,js可直接判断,写法如下:
1、submit加上onclick
<input type="submit" name="submit" id="submit" value="提交" onclick="logon()"/></td>

2、加一个方法提交请求。注:加servlet的话可以在表单的action中直接提交,如:action="<%=path %>/servlet/TestServlet"
<title>无标题文档</title>

<script type="text/javascript">

function logon()
{
var username = document.all.form1.username.value;
var password = document.all.form1.password.value;
//alert(username + password);
if(username=='admin' && password=='admin')
{
alert('success');
}
else
{
alert('failed');
}

}
</script>
</head>

F. 求写个比较简单的php登陆页面代码

主页面:index.php <form name="form1" action="login.php" method="post" onsubmit="return check()"><!--这里注意onclick的用法-->
账号:<input name="adminAccount" type="text" />

密码:<input type="password" name="adminPass" />

输入验证码:<input type="text" name="validate" />
< br />
<input type="submit" value="登陆" /><input type="reset" value="重置">
</form>判断页面:login.php<?php
//再连库判断账号密码
require_once("../inc/dbconfig.php");
$adminAccount=$_POST['adminAccount'];
$adminPass=md5($_POST['adminPass']);
$sql="select * from admin where adminAccount='$adminAccount' and adminPass='$adminPass'";
$result=mysql_query($sql) or die($sql);
$rows=mysql_num_rows($result);
if($rows==0){
?>
<script language="javascript">
alert("管理员账号密码错误!");
window.location="index.php";
</script>
<?
exit();
}
//将管理员账号赋值给session
$_SESSION['adminAccount']=$adminAccount;
?>
<script language="javascript">
window.location="command.php";
</script>配置文件自己来就行了!

G. 网站登录代码怎么写

yonghu=request.Form("yonghu")
mima= request.Form("mima")
SqlStr = "select * from [biaoge] Where yonghu="&yonghu&" and mima="& mima &" order by id desc"
Set Rs = Server.CreateObject("adodb.recordset")
Rs.Open SqlStr, Conn, 1, 1
IF Not(Rs.bof and Rs.EOF) Then
response.write("登陆成功")
Else
response.write("登陆失败")
End If
Rs.close
Set Rs = nothing

H. 用html代码编写一个简单的登陆界面

<!DOCTYPE html><html lang="zh-CN"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登录</title>
<link href="css/bootstrap.min.css" rel="stylesheet"></head><body><nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="./">jsp作业</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="login.html">登录</a></li>
</ul>
</div>
</div></nav><div class="container">
<div class="row">
<div class="col-md-4">

</div>
<div class="col-md-4">
<form class="form-signin" target="submitFrame" method="post">
<h2 class="form-signin-heading">登录到jsp作业</h2>
<label for="inputEmail">Email</label>
<input type="email" id="inputEmail" class="form-control" placeholder="请输入Email" required autofocus><br>
<label for="inputPassword">密码</label>
<input type="password" id="inputPassword" class="form-control" placeholder="请输入密码" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me" checked="checked"> 记住密码 </label>
</div>
<button type="submit" class="btn btn-primary" id="btn-login">登录</button>
<a href="reg.html" class="btn btn-default">注册</a>
</form>
<iframe style="display: none;" name="submitFrame" src="about:blank"></iframe>
</div>
<div class="col-md-4">
</div>
</div>
<script src="js/jquery.min.js"></script></body></html>

I. JSP编写一个登陆界面

1、首来先准备Dreamweaver8软件,解自压安装。如下图所示:这件点击安装程序,然后输入序列号就可以了。

J. 用户登录html代码有哪些

<html>
<head>
<title>登陆页面</title>
</head>

<form action="login_conf.jsp" method="post">
用户登陆
用户名:<input type="text" name="uname">
密码: <input type="password" name="upassword">
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
</body>
</html>

****************************************************
验证页面jsp代码如下:
<html>
<head>
<title>用户验证页面</title>
</head>

<h1> 登陆范例-登陆成功 </h1>
</html>

不知道你用啥样的前台 是jsp还是asp.net或者是php

阅读全文

与登陆页面代码相关的资料

热点内容
maya粒子表达式教程 浏览:84
抖音小视频如何挂app 浏览:283
cad怎么设置替补文件 浏览:790
win10启动文件是空的 浏览:397
jk网站有哪些 浏览:134
学编程和3d哪个更好 浏览:932
win10移动硬盘文件无法打开 浏览:385
文件名是乱码还删不掉 浏览:643
苹果键盘怎么打开任务管理器 浏览:437
手机桌面文件名字大全 浏览:334
tplink默认无线密码是多少 浏览:33
ipaddgm文件 浏览:99
lua语言编程用哪个平台 浏览:272
政采云如何导出pdf投标文件 浏览:529
php获取postjson数据 浏览:551
javatimetask 浏览:16
编程的话要什么证件 浏览:94
钱脉通微信多开 浏览:878
中学生学编程哪个培训机构好 浏览:852
荣耀路由TV设置文件共享错误 浏览:525

友情链接