html登录页面代码(html语言如何实现帐号密码登陆)

本文目录
html语言如何实现帐号密码登陆
html可以使用表单进行的最简单的账号密码登录的页面设计,但是不具备判断账号密码正确性等逻辑的能力,这个需要后台语言处理反馈。
工具原料:器、浏览器
1、使用form表单事件最简单的账号密码登录的数据提交,代码如下:
《!DOCTYPE html》
《html》
《body》
《form action="login.php"》
用户名:《br》
《input type="text" name="firstname" value="请输入账号"》
《br》
密码:《br》
《input type="text" name="lastname" value="请输入密码"》
《br》《br》
《input type="submit" value="Submit"》
《/form》
《/body》
《/html》
2、点击提交数据将会提交给login.php进行处理,运行的结果如下:
网上商城系统登录页面html代码怎么写
《div》
《div》
《lable》账号《/lable》
《input placeholder="输入你的账号"》
《/div》
《div》
《lable》密码《/lable》
《input placeholder="输入你的密码"》
《/div》
《button》登录《/botton》
《/div》
结构大致这样 样式自己调了
求html登陆界面详细代码 要可以登陆,用数据库保存
上面给你的是asp的,这边给你个php的,你看下,不懂再问我
《?php
include("config.php");
session_start();
/*--------------------删除cookies记录,让cookies过期-----------------------------------*/
if($_GET=="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!="")
{
$username=$_POST;
$userpassword=$_POST;
$sql=mysql_query("select * from user where username=’$username’ and userpassword=’$userpassword’");
$rs=mysql_fetch_array($sql);
echo"自动跳转成功";
//exit();
}
/*----------------------------点击登录按钮后的动作act=login----------------------------------*/
if($_GET=="login")
{
/*------------------判断获取的验证码是否一致-------------------------*/
/*if(strtoupper($_SESSION))
{
echo("《script type=’text/javascript’》 alert(’对不起,验证码错误!’);location.href=’javascript:onclick=history.go(-1)’;《/script》");
exit();
}*/
/*------------------------点击登录按钮后如果判断已经有cookies存在,则进行自动登录操作----------------------------------*/
if($_COOKIE!="")
{
$username=$_POST;
$userpassword=$_POST;
$sql=mysql_query("select * from user where username=’$username’ and userpassword=’$userpassword’");
$rs=mysql_fetch_array($sql);
if($_POST)
{
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;
$userpassword=md5($_POST);
$sql=mysql_query("select * from user where username=’$username’ and userpassword=’$userpassword’");
if($rs=mysql_fetch_array($sql))
{
/*---------------------用户名密码判断正确,写入cookies动作,同时进行跳转------------------------------------*/
setcookie("usercookies", $_POST, time()+3600*48);
setcookie("pwdcookies", md5($_POST), time()+3600*24);
header(’Location: echo "《script type=’text/javascript’》 alert(’用户名或密码错误,请重新输入!’);location.href=’javascript:onclick=history.go(-1)’;《/script》";
exit();
}
}
/*
$user_IP = $_SERVER;//获取访问者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;}?》" /》
《input name="userpassword" type="password" id="userpassword" value="《?php if($_COOKIE;}?》"/》
《!--《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》

更多文章:
招聘会应该注意什么问题?请问东莞智通人才市场现场招聘会的时间段为多少(周日)
2026年9月7日 19:50
开发一个h5网站多少钱(网站建设报价,建一个这样的网站,需要多少钱)
2026年9月7日 18:30







