html登錄界面源碼
A. 求html登陸界面詳細代碼 要可以登陸,用資料庫保存
上面給你的是asp的,這邊給你個php的,你看下,不懂再問我
<?php
include("config.php");
session_start();
/*--------------------刪除cookies記錄,讓cookies過期-----------------------------------*/
if($_GET["del"]=="cookies")
{
setcookie("usercookies", "", time()-3600);
setcookie("pwdcookies", "", time()-3600);
echo "<SCRIPT type=text/javascript>
var n = 5;
var timer = setInterval(function() {
n--;
document.getElementById('second').innerHTML = n;
if (n == 0) {
clearInterval(timer);
window.location = 'login.php';
}
}, 1000);
</SCRIPT>刪除成功<br><B class='chengse STYLE1' id=second>5</B>秒後回到首頁";
exit();
}
/*------------------------如果判斷已經有cookies存在,則進行自動登錄操作----------------------------------*/
if($_COOKIE["usercookies"]!="" and $_COOKIE["pwdcookies"]!="")
{
$username=$_POST["username"];
$userpassword=$_POST["userpassword"];
$sql=mysql_query("select * from user where username='$username' and userpassword='$userpassword'");
$rs=mysql_fetch_array($sql);
echo"自動跳轉成功";
//exit();
}
/攔局*----------------------------點擊登錄按鈕後亮衡如的動作act=login----------------------------------*/
if($_GET["act"]=="login")
{
/*------------------判斷獲取的驗證碼是否一致-------------------------*/
/*if(strtoupper($_SESSION["vcode"])!=strtoupper($_POST["Code"]))
{
echo("<script type='text/javascript'> alert('對不起,驗證碼錯誤!');location.href='javascript:onclick=history.go(-1)';</script>");
exit();
}*/
/*------------------------點擊登錄按鈕後如果判斷已經有cookies存在,則進行自動登錄操作----------------------------------*/
if($_COOKIE["usercookies"]!="" and $_COOKIE["pwdcookies"]!="")
{
$username=$_POST["username"];
$userpassword=$_POST["userpassword"];
$sql=mysql_query("select * from user where username='$username' and userpassword='敬啟$userpassword'");
$rs=mysql_fetch_array($sql);
if($_POST["username"]==$rs["username"] and $_POST["userpassword"]==$rs["userpassword"])
{
echo"<script type='text/javascript'> alert('存在cookies登錄跳轉成功!');location.href='javascript:onclick=history.go(-1)';</script>";
exit();
}
else
{
echo"<script type='text/javascript'> alert('存在cookies登錄跳轉失敗!');location.href='javascript:onclick=history.go(-1)';</script>";
exit();
}
exit();
}
/*-------------------點擊登錄後判斷cookies不存在則進行登錄比較用戶名密碼------------------------------*/
$username=$_POST["username"];
$userpassword=md5($_POST["userpassword"]);
$sql=mysql_query("select * from user where username='$username' and userpassword='$userpassword'");
if($rs=mysql_fetch_array($sql))
{
/*---------------------用戶名密碼判斷正確,寫入cookies動作,同時進行跳轉------------------------------------*/
setcookie("usercookies", $_POST["username"], time()+3600*48);
setcookie("pwdcookies", md5($_POST["userpassword"]), time()+3600*24);
header('Location: http://www..com/');
exit();
}
else
{
/*-------------------判斷用戶名密碼錯誤,彈出錯誤提示---------------------------*/
echo "<script type='text/javascript'> alert('用戶名或密碼錯誤,請重新輸入!');location.href='javascript:onclick=history.go(-1)';</script>";
exit();
}
}
/*
$user_IP = $_SERVER["REMOTE_ADDR"];//獲取訪問者IP
$file_name=date('Y-m-d').'.txt';//以當前的日期建立txt文件
$file=fopen($file_name,"a+");//如果存在該文件就打開,如果不存在就創建
fwrite($file,$user_IP.'--'.date('Y-m-d H:i:s')."\r\n");//將訪問者IP及當前時刻寫到文件最後,\r\n在文檔最後換行
fclose($file);//關閉文件
*/
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>COOKIES判斷是否自動登錄</title>
</head>
<body>
<form action="?act=login" method="post">
<input name="username" type="text" id="username" value="<?php if($_COOKIE["usercookies"]!=""){echo $_COOKIE["usercookies"];}?>" />
<input name="userpassword" type="password" id="userpassword" value="<?php if($_COOKIE["pwdcookies"]!=""){echo $_COOKIE["pwdcookies"];}?>"/>
<!--<img src="yanzhengma_class.php" title="看不清楚?請點擊刷新驗證碼" onClick="this.src='yanzhengma_class.php?t='+(new Date().getTime());" height="20px;"><input name="Code" type="text" id="Code" value="" />-->
<input name="" type="submit" />
</form>
<a href="?del=cookies">刪除cookies</a>
</body>
</html>
B. 用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>
C. 怎麼在html登陸界面源碼添加判斷用戶名密碼。就一個用戶。無資料庫
用正則啊,沒有資料庫的意思,自己前端寫的死數據吧。
正則隨時判斷,數組(自己寫的數組)中與輸入框內容是否一致。
如果一致,點擊登錄,登錄成功。
這是用的熱載入。可以不用提交到後端就可以判斷。
也可以點擊按鈕後,判斷輸入框內容是否和你自己想要的數據一致
if(username==「admin」&&password=="123"){
alert("登錄成功")}else{
alert("密碼或者賬號不正確")}
D. 求代碼,用html做一個用戶名密碼登錄界面,用JavaScript調用XML文件中已有的列表進行對比
你好,我幫你實現了你需要的功能。
首先你建立一個xml文件穗做:data.xml用來保存用戶名和密碼,我寫了如下內容保存至此data.xml文件內
————————————————
<?xml version="1.0" encoding='gb2312'?>
<user>
<id>001</id>
<name>leezi</name>
<pass>ms#leezi</pass>
</user>
———————————————————
然後寫登錄頁面login.html,代碼如下:
——————————
<html>
<head>
<style type="text/css"察族咐>
</style>
</head>
<body>
name:<input type="text" id="input_name"/>
pass:<input type="password" id="input_pass"/>
<input type="button" value="login" onclick="validate()"/>
<script type="text/javascript">
function loadXMLDoc(dname)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
catch(e) {alert(e.message)}
return(null);
}
function validate(){
xmlDoc=loadXMLDoc("data.xml");
if(window.ActiveXObject){
var nodes=xmlDoc.documentElement.childNodes;
var xml_name=nodes[1].childNodes[0].nodeValue;
var xml_pass=nodes[2].childNodes[0].nodeValue;
if((xml_name==document.getElementById("input_name").value)&&(xml_pass==document.getElementById("input_pass").value)){
document.write("successfully login");
return true;
}else{
document.write("敗純name or pass,one is wrong");
return false;
}
}else if(typeof DOMParser!="undefined"){
var doc=xmlDoc.documentElement;
var xml_name=doc.childNodes[3].childNodes[0].nodeValue;
var xml_pass=doc.childNodes[5].childNodes[0].nodeValue;
if((xml_name==document.getElementById("input_name").value)&&(xml_pass==document.getElementById("input_pass").value)){
document.write("successfully login");
return true;
}else{
document.write("name or pass,one is wrong");
return false;
}
}
}
</script>
</body>
</html>
——————————————————————
注意data.xml和login.html兩個文件放到同一個目錄下面。處理完上述步驟後打開login.html輸入用戶名和密碼進行測試,你可以在data.xml裡面看到我設置的name和pass分別為:leezi和ms#leezi
你可以輸入進行測試。
E. 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>
</head>
<body>
<div align="center">
<form action="" name="myform">
<table>
<tr>
<td>用戶名:</td>
<td><input type="text" id="user" /></td>
</tr>
<tr>
<td>密 碼:</td>
<td><input type="text" id="password" /></td>
</tr>
<tr>
<td>驗證碼:</td>
<td align="left"><input type="text" size="5" id="code" /></td>
</tr>
</table>
</form>
<table>
<tr>
<td>
<input type="submit" value="提交" onclick=myfun_submit() />
</td>
<td>
<input type="submit" value="重置" onclick=myfun_reset() />
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function myfun_submit(){
var user_val = document.getElementById("user").value;
var password_val = document.getElementById("password").value;
if(user_val==""){
alert("用戶名不能為空!!");
}else if(password_val==""){
alert("密碼不能為空!!!");
}
}
function myfun_reset(){
document.getElementById("user").value = "";
document.getElementById("password").value = "";
document.getElementById("code").value = "";
}
</script>
</body>
</html>
F. HTML網頁設計:一個簡單的登錄界面可以連接到資料庫記錄的代碼
如下參考:
1.首先孝物沖,在您的計算機桌面上創建一個新文件夾,然後在該文件夾中創建一個新的文本文檔。
G. 求html登陸界面詳細代碼。要可以登陸,用資料庫保存。
這是我曾經寫過的一寬消毀個登錄頁面的詳細代碼,供你參考,asp的代碼,不知道你看得懂不?x0dx0a文件名是:deafaule.aspx0dx0a x0dx0a<% @ Language=VBScript %>x0dx0ax0dx0ax0dx0a
x0dx0aH. html登陸界面代碼
實現這個功能要兩個網頁,一個是前台靜態網頁,用兩個文本框分別為t1,t2,一個按鈕active後面寫上你要跳轉的後台網頁的名稱如"houtai.asp"
以下是houtai.asp的代碼
<%
dim
a,b
a=request.from("t1")
b=request.from("t2")
if
a<>admin
then
response.write
"用戶名錯誤"
else
if
b<> 123456
then
response.write
"密碼錯誤"
else
response.redirect
"你要轉到的主頁.asp"
end
if
end
if
%>