導航:首頁 > 編程語言 > 登陸頁面代碼

登陸頁面代碼

發布時間: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

友情鏈接