氧登陸源碼
Ⅰ 有什麼源碼可以實現要登陸之後才能顯示一個網頁,請直接附上源碼和教程謝謝啦~
登錄後建立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>
Ⅱ JSP+javaBEAN+SERVLET登陸源碼
他的意思是要,jsp裡面,用了javabean,和servlet技術實現的注冊登陸的源代碼
Ⅲ 本地試運行源代碼,想登陸後台,輸入http://localhost/admin/後出現如下,怎麼辦
是IIS,不是ISS...
樓主是開啟了目錄瀏覽,正常的
Ⅳ JSP登陸源碼
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=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="login" method="post">
用戶名:<input type="text" name="username"/><br/>
密碼:<input type="password" name="password"/><br/>
<input type="submit" value="確定"/>
</form>
</body>
</html>
success.jsp 和 error.jsp 你自己寫就好一個登陸成功 一個登陸失敗
三個頁面都放在WebRoot下
後台
login.java
package test;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Login extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String username = request.getParameter("username");
String password = request.getParameter("password");
if("admin".equals(username)){
request.getRequestDispatcher("/success.jsp").forward(request, response);
}else{
request.getRequestDispatcher("/error.jsp").forward(request, response);
}
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>test.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>
直接訪問
http://127.0.0.1:8080/項目名稱
用戶名 admin 點擊確定 登陸成功 否則 失敗
Ⅳ 網頁登陸源代碼 (高手請進!!)
那就在IIS設置
Ⅵ asp登錄界面源代碼
要是你要的話。我可以發一個文件給你。裡面的內容是一本書的所有例子。包括有
「留言板、注冊和登陸、Blog、小型論壇、新聞發布等等。」
都是ASP版的。只要你建好站點。復制相應的文件到你站點下就行了。
Ⅶ 求一個用Java寫的登陸界面的源代碼,輸入用戶名,密碼,登錄後顯示歡迎登錄,加分
這個是我之前做著玩的,只做了個登錄,不要介意,登錄名:admin,密碼:admin。
Ⅷ 求php實現登錄成功後返回首頁並在原登錄處顯示用戶名的源代碼(類似於鐵血網的登錄)
<?php
session_start();//用SESSION記錄模式,並開啟。
//用戶登錄信息,並記錄
if(@$_POST['GoLog']){
$_SESSION['user']=@$_POST['login'];
}
//主頁的檢查用戶登錄與否,並顯示歡迎信息
if(@$_SESSION['user']==''){
echo"目前沒有登錄";
}else{
echo$_SESSION['user']."歡迎你的回來!";
}
?>
<formaction=''method='post'>
<inputtype='text'name='login'/>
<inputtype='submit'name='GoLog'value='登錄'/>
</form>
我只是給你寫了個原理,你可以加入更多的判斷。
Ⅸ 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>
(9)氧登陸源碼擴展閱讀:
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>
Ⅹ 求一個php的登陸源碼。功能簡單就行
index.php
<html>
<head>
<title>登錄界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
//將用戶提交的用戶名和密碼和資料庫中的用戶名和密碼逐一比對,如正確,則進入2.php,錯誤則提示錯誤。
$username=$_post['username'];
$password=$_post['password'];
$sql="select * from userinfo where username='$username' and password='$password'";
$re=mysql_query($sql);
$row=mysql_num_rows[$re];
if(!$row){
echo "<script>alert('用戶名或密碼錯誤!');history.back(-1);</script>";
}
else {
echo '用戶登錄成功!';
echo '<meta http-equiv=refresh content=2;url=2.php>';
}
?>
<form name="login" method="post" action="index.php">
用戶名:<input type="text" name="username" /><br/>
密碼:<input type="password" name="password" /><br/>
<input type="submit" name="submit" value="登錄">
</form>
</body>
<html>