当前位置:首页 » 操作系统 » 网站登录源码

网站登录源码

发布时间: 2022-08-23 18:45:43

① jsp登陆界面源代码

1、login.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>登录页面</title>

</head>

<body>

<form name="loginForm" method="post" action="judgeUser.jsp">

<table>

<tr>

<td>用户名:<input type="text" name="userName" id="userName"></td>

</tr>

<tr>

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

</tr>

<tr>

<td><input type="submit" value="登录" style="background-color:pink"> <input

type="reset" value="重置" style="background-color:red"></td>

</tr>

</table>

</form>

</body>

</html>

2、judge.jsp文件

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>身份验证</title>

</head>

<body>

<%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

String password = request.getParameter("password");

if(name.equals("abc")&& password.equals("123")) {

3、afterLogin.jsp文件

%>

<jsp:forward page="afterLogin.jsp">

<jsp:param name="userName" value="<%=name%>"/>

</jsp:forward>

<%

}

else {

%>

<jsp:forward page="login.jsp"/>

<%

}

%>

</body>

</html>

<%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>登录成功</title>

</head>

<body>

<%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

out.println("欢迎你:" + name);

%>

</body>

</html>

(1)网站登录源码扩展阅读:

java web登录界面源代码:

1、Data_uil.java文件

import java.sql.*;

public class Data_uil

{

public Connection getConnection()

{

try{

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

}catch(ClassNotFoundException e)

{

e.printStackTrace();

}

String user="***";

String password="***";

String url="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=***";

Connection con=null;

try{

con=DriverManager.getConnection(url,user,password);

}catch(SQLException e)

{

e.printStackTrace();

}

return con;

}

public String selectPassword(String username)

{

Connection connection=getConnection();

String sql="select *from login where username=?";

PreparedStatement preparedStatement=null;

ResultSet result=null;

String password=null;

try{

preparedStatement=connection.prepareStatement(sql);

preparedStatement.setString(1,username);

result=preparedStatement.executeQuery();//可执行的 查询

if(result.next())

password=result.getString("password");

}catch(SQLException e){

e.printStackTrace();

}finally

{

close(preparedStatement);

close(result);

close(connection);

}

System.out.println("找到的数据库密码为:"+password);

return password;

}

public void close (Connection con)

{

try{

if(con!=null)

{

con.close();

}

}catch(SQLException e)

{

e.printStackTrace();

}

}

public void close (PreparedStatement preparedStatement)

{

try{

if(preparedStatement!=null)

{

preparedStatement.close();

}

}catch(SQLException e)

{

e.printStackTrace();

}

}

public void close(ResultSet resultSet)

{

try{

if(resultSet!=null)

{

resultSet.close();

}

}catch(SQLException e)

{

e.printStackTrace();

}

}

}

2、login_check.jsp:文件

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<!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=utf-8">

<title>验证用户密码</title>

</head>

<body>

<jsp:useBean id="util" class="util.Data_uil" scope="page" />

<%

String username=(String)request.getParameter("username");

String password=(String)request.getParameter("password");

if(username==null||"".equals(username))

{

out.print("<script language='javaScript'> alert('用户名不能为空');</script>");

response.setHeader("refresh", "0;url=user_login.jsp");

}

else

{

System.out.println("输入的用户名:"+username);

String passwordInDataBase=util.selectPassword(username);

System.out.println("密码:"+passwordInDataBase);

if(passwordInDataBase==null||"".equals(passwordInDataBase))

{

out.print("<script language='javaScript'> alert('用户名不存在');</script>");

response.setHeader("refresh", "0;url=user_login.jsp");

}

else if(passwordInDataBase.equals(password))

{

out.print("<script language='javaScript'> alert('登录成功');</script>");

response.setHeader("refresh", "0;url=loginSucces.jsp");

}

else

{

out.print("<script language='javaScript'> alert('密码错误');</script>");

response.setHeader("refresh", "0;url=user_login.jsp");

}

}

%>

</body>

</html>

3、loginSucces.jsp文件

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<!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=ISO-8859-1">

<title>Insert title here</title>

</head>

<body>

<hr size="10" width="26%" align="left" color="green">

<font size="6" color="red" >登录成功 </font>

<hr size="10" width="26%" align="left" color="green">

</body>

</html>

4、user_login.jsp文件

<%@ page language="java" contentType="text/html; charset=utf-8"

pageEncoding="utf-8"%>

<!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=ISO-8859-1">

<title>登录界面</title>

</head>

<body background="C:Userswin8workspaceLoginimage\_10.jpg" >

<center>

<br><br><br><br><br><br>

<h1 style="color:yellow">Login</h1>

<br>

<form name="loginForm" action="login_check.jsp" method="post">

<table Border="0" >

<tr >

<td>账号</td>

<td><input type="text" name="username"></td>

</tr>

<tr>

<td>密码</td>

<td><input type="password" name="password">

</td>

</tr>

</table>

<br>

<input type="submit" value="登录" style="color:#BC8F8F">

</form>

</center>

</body>

</html>

② 进入网站后台如何获得网站源码

进入网站后台是无法获得网站源码的,需要你登录网站的空间才可以获得源码

③ 求教网站登录之后的网页源码如何获取

wmf19990425

④ 易语言 获取网页源代码

先post登录网站再取回登录后源码 先抓post登录包
精益模块 网页源码=网页_访问(post地址,“POST”,post数据)

⑤ 易语言如何在网页登录的情况下获取网页源码

网页编码是utf你需要转换成gbk

⑥ 网站登录源代码怎莫看

在网站上点击鼠标右键出现:

点击查看原文件即可。


希望能够帮助你!

⑦ 谁有登录的网站源码

JSP登陆系统 源代码 很好的源代码
<!-- 该Login页面是一个简单的登录界面 -->
<!--
该JSP程序是用来测试与MySQL数据库的连接,
需要一个数据库:LearnJSP,和其中一个表:userinfo
表中有两个字段分别为:UserName varchar (20) not null,UserPwd varchar (20) not null
-->
<html>
<head>
<title>登录</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="ch-cn">
</head>
<body>
<!-- Form 用来提取用户填入并提交的信息-->
<form method="post" name="frmLogin" action="LoginServlet">
<h1 align="center">用户登录</h1><br>

⑧ 有什么源码可以实现要登陆之后才能显示一个网页,请直接附上源码和教程谢谢啦~

登录后建立Session 如:Session["User"]=用户名;
判断如果存在这个Session不为空则进入页面 if(Session["User"]!=null){Response.Redirect("LuRusysterm.aspx")} 否则提示登录
或者在WebConfig里配置表单验证 在System.web下添加
<authentication mode="Forms">
<forms loginUrl="LRperson.aspx" defaultUrl="LuRusysterm.aspx" name=".ASPNETFORMSTEST" protection="All" timeout="30" ></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>

php网站登录注册源码

//login.php 负责处理用户登录与退出动作
if(!isset($_POST['submit'])){
exit('非法访问!');
}
$username = htmlspecialchars($_POST['username']);
$password = MD5($_POST['password']);

//包含数据库连接文件
include('conn.php');
//检测用户名及密码是否正确
$check_query = mysql_query("select uid from user where username='$username' and password='$password' limit 1");
if($result = mysql_fetch_array($check_query)){
//登录成功
$_SESSION['username'] = $username;
$_SESSION['userid'] = $result['uid'];
echo $username,' 欢迎你!进入 <a href="my.php">用户中心</a>
';
echo '点击此处 <a href="login.php?action=logout">注销</a> 登录!
';
exit;
} else {
exit('登录失败!点击此处 <a href="javascript:history.back(-1);">返回</a> 重试');
}
注:上述源码是在TP中的登录验证方法,供参考!!

⑩ 求网页登录注册源码

分5个文件:
1:登录页面 login.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登录</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="33%" height="64" id="table1">
<form name="form" action="go.asp" method="post"><tr>
<td>用户名:<input name="user"></td>
</tr>
<tr>
<td>密 码:<input type="password" name="pwd"></td>
</tr>
<tr>
<td><input name="sub" value="登录" type="submit"></td>
</tr></form>
</table>

</body>

</html>
------------------------
2.数据库连接文件 conn.asp
<%set rs=server.createobject("adodb.recordset")
conn = "driver={Microsoft Access Driver (*.mdb)};DBQ="&server.mappath("data.mdb")
%>
-------------------------

3:登录检测页面 go.asp
<!-- #include file="conn.asp" -->
<%
pwd=request.Form("pwd")
set rs=server.createobject("adodb.recordset")
sql="select * from user where name='"&request.Form("user")&"'"
rs.open sql,conn,1,1
if rs.eof or rs.bof then'如果用户名不存在
response.Write"<script language=javascript>alert('请输入正确的用户名!');history.go(-1);</script>"
Response.End()
else
if rs("pwd")<>pwd then'如果密码不对
response.write "<script language=JavaScript>alert('密码有误!');history.back();</script>"
else
response.write("登录成功")'
end if
end if%>
-------------------------------
4。注册文件 add.asp
<!-- #include file="conn.asp" -->
<%
sql="select * from user where u_user='"&request.Form("user")&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.BOF or rs.EOF then
rs.addnew
rs("name")=request.Form("user")
rs("pwd")=request.Form("pwd")
rs.update
rs.close
set rs=nothing
response.Write ("注册成功!")
else
rs.close
set rs=nothing
response.write ("此用户已被注册")
end if
%>
4。注册页面 re.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>注册</title>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" width="33%" height="64" id="table1">
<form name="form" action="add.asp" method="post"><tr>
<td>用户名:<input name="user" size="23"></td>
</tr>
<tr>
<td>密 码:<input name="pwd" size="23" id="pwd"></td>
</tr>
<tr>
<td><input name="sub" value="注册" type="submit"></td>
</tr></form>
</table>
</body>
</html>
将这几个文件和数据库“data.mdb”放在同一目录内
数据库建一个USER表
含name pwd 两个字段 文本类型
运行login.htm测试登录
运行re.htm测试注册

热点内容
app怎么提供服务器地址 发布:2025-05-16 11:48:27 浏览:397
双面警长第一季ftp 发布:2025-05-16 11:41:20 浏览:664
php取数组第一个 发布:2025-05-16 11:30:58 浏览:423
解调算法 发布:2025-05-16 11:21:09 浏览:136
python密码暴力破解 发布:2025-05-16 11:13:28 浏览:592
倒角刀编程 发布:2025-05-16 11:12:55 浏览:350
数据库的酸性 发布:2025-05-16 11:03:17 浏览:124
phpmysql长连接 发布:2025-05-16 10:51:50 浏览:734
android横屏全屏 发布:2025-05-16 10:47:43 浏览:475
服务器直链下载搭建 发布:2025-05-16 10:47:38 浏览:176