1、asp網頁設計中用戶登錄
<script language=javascript>
<!--
//驗證輸入
function CheckForm()
{
if(document.Login.uid.value=="")
{
alert("請輸入用戶名!");
document.Login.uid.focus();
return false;
}
if(document.Login.pwd.value == "")
{
alert("請輸入密碼!");
document.Login.pwd.focus();
return false;
}
if (document.Login.verifycode.value==""){
alert ("請輸入您的驗證碼!");
document.Login.verifycode.focus();
return(false);
}
}
-->
</script>
//表單
FORM name="Login" action="admin_check.asp" method="post" onSubmit="return CheckForm();">
<table width="682" height="170" border="0" align="center" cellpadding="0" cellspacing="0" background="images/backlogin.jpg"class="t_table">
<tr>
<th width="134" height="100" scope="col"> </th>
<th width="53" scope="col"> </th>
<th width="84" scope="col"> </th>
<th width="100" scope="col"> </th>
<th width="111" scope="col"> </th>
<th width="44" scope="col"> </th>
</tr>
<tr>
<td height="35"> </td>
<td><span class="STYLE3">管理員:</span></td>
<td colspan="2"><input name="uid" class="inputname" type="text" id="uid" style="border: 1px solid #999999;FONT-SIZE: 9pt; height:21;width:165" size="16"></td>
<td rowspan="3"> </td>
<td> </td>
</tr>
<tr>
<td height="35"> </td>
<td><span class="STYLE3">密 碼:</span></td>
<td colspan="2"><input name="pwd" class="inputpassword" type="password" id="pwd" style="border: 1px solid #999999;FONT-SIZE: 9pt; height:21;width:165" size="16"></td>
<td> </td>
</tr>
<tr>
<td height="35"> </td>
<td>驗證碼:</td>
<td><input name=verifycode type=text value="<%If GetCode=9999 Then Response.Write "9999"%>" maxlength=4 size=10 style="border: 1px solid #999999; FONT-SIZE: 9pt;"></td>
<td><img src=GetCode.asp></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="4" valign="middle">
<input name="button" type="image" src="images/login.gif" width="74" height="39" border="0"> <a href="../index.asp"><img src="images/quxiao.gif" width="75" height="39" border="0"></a></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="4"> </td>
<td> </td>
</tr>
</table>
</FORM>
以上的放在同一個asp文件中
//admin_check.asp
<%response.Expires = 0%>
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
'防SQL注入
function errsql(strget)
strcheck=strget
dim nothis(16)
nothis(0) = "net user"
nothis(1) = "xp_cmdshell"
nothis(2) = "/add"
nothis(3) = "exec%20master.dbo.xp_cmdshell"
nothis(4) = "net localgroup administrators"
nothis(5) = "select"
nothis(6) = "count"
nothis(7) = "asc"
nothis(8) = "char"
nothis(9) = "mid"
nothis(10) = "'"
nothis(11) = """"
nothis(12) = "insert"
nothis(13) = "delete"
nothis(14) = "drop"
nothis(15) = "truncate"
nothis(16) = "from"
for i=1 to ubound(nothis)
if instr(strget,nothis(i)) then
response.write "<script language=javascript>alert('輸入信息含有非法字元,請重新輸入!');history.go(-1);</script>"
response.End
end if
next
errsql = strcheck
end function
%>
<%
dim admin,password,webpassword
admin=errsql(trim(request("uid")))
webpassword=errsql(trim(request("pwd")))
password=md5(webpassword)
if cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('請輸入正確的驗證碼!');history.go(-1);</script>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from master where name='"&admin&"' and password='"&password&"' " ,conn,1,1
if not(rs.bof or rs.eof) then
if password=rs("password") then
session("admin")=trim(rs("name"))
session.Timeout=20
rs.Close
set rs=nothing
response.Redirect "index.asp"
else
response.write "<script LANGUAGE='javascript'>alert('對不起,登陸失敗!');history.go(-1);</script>"
end if
else
response.write "<script LANGUAGE='javascript'>alert('用戶名或密碼錯誤!');history.go(-1);</script>"
end if
%>
上面的conn.asp是連接Access資料庫的,資料庫和資料庫的表,自己建立沒問題吧
2、javascript html 設計一個登錄界面
注冊頁面代碼:
登錄頁面代碼:
以上代碼使用了WEB SQL,還請選擇合適的瀏覽器查看。
3、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>
<script>
function r()
{
var username=document.getElementById("username");
var pass=document.getElementById("password");
if(username.value=="")
{
alert("請輸入用戶名");
username.focus();
return;
}
if(pass.value=="")
{
alert("請輸入密碼");
return;
}
return true;
}
</script>
</head>
<body>
<form>
<table width="350" bgcolor="#ccffcc" style="border-color" border="1">
<tr align=center>
<td>用戶名</td><td><input type="text" name="username" id="username"></td>
</tr>
<tr align=center><td>密 碼</td><td><input type="password" name="password" id="password"></td></tr>
<tr align=center><td>驗證碼</td><td><input type="text" name="yanzheng"></td></tr>
<tr align=center><td colspan="2"><input type="button" value="登 錄" onclick="r();"/> <input type="reset" value="重 置"/></td></tr>
</table>
</form>
</body>
</html>
4、asp網頁設計中,怎麼實現用戶登錄,並且登陸狀態保持在當前頁面,類似於這種
html5以前是不可能實現,html頁面之間的參數傳遞,但是現在可用localStorage或者sessionStorage來實現,百度下就有了。
5、網頁設計中用戶登陸設計時怎樣與資料庫連接?
這樣:
一個資料庫,表名為login,假設為Access資料庫,內有name,pw兩個欄位。
一個登陸頁面:login.asp
一個檢驗頁面:check.asp
login.asp部分代碼(省略html代碼,只列部分關鍵代碼,不會的可發送消息給我):
<form method="post" action="info.asp">
<input type="type" name="name">
<input type="password" name="pw">
</form>
check.asp部分代碼:
<%
dim name,pw
name=trim(request("name"))
pw=trim(request("pw"))
if name="" or pw="" then
response.Write "<script language='javascript'>window.confirm('對不起,用戶名或密碼均不能為空!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
set rs=server.CreateObject("adodb.recordset")
sql="select * from info where name='"&name&"' and pw='"&pw&"'"
rs.open sql,conn,1,1
if rs.recordcount=0 then
response.Write "<script language='javascript'>window.confirm('對不起,用戶名或密碼錯誤,請重新登陸!');</script>"
response.Write "<script language='javascript'>parent.window.history.go(-1);</script>"
else
response.Write "<script language='javascript'>alert('登陸成功!');</script>"
response.Write "location.href='admin.asp';" ''admin.asp為登陸成功後轉向的頁面
end if
end if
%>
6、網頁製作中登陸界面設計代碼
<%@language=vbscript codepage=936 %>
<%
option explicit
'強制瀏覽器重新訪問伺服器下載頁面,而不是從緩存讀取頁面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'主要是使隨機出現的圖片數字隨機
%>
<html>
<head>
<title>管理員登錄</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="Admin_Style.css">
<script language=javascript>
function SetFocus()
{
if (document.Login.UserName.value=="")
document.Login.UserName.focus();
else
document.Login.UserName.select();
}
function CheckForm()
{
if(document.Login.UserName.value=="")
{
alert("請輸入用戶名!");
document.Login.UserName.focus();
return false;
}
if(document.Login.Password.value == "")
{
alert("請輸入密碼!");
document.Login.Password.focus();
return false;
}
//if (document.Login.CheckCode.value==""){
// alert ("請輸入您的驗證碼!");
// document.Login.CheckCode.focus();
// return(false);
}
}
</script>
</head>
<body onLoad="SetFocus();">
<p> </p>
<form name="Login" action="Admin_ChkLogin.asp" method="post" target="_parent" onSubmit="return CheckForm();">
<table width="300" border="0" align="center" cellpadding="5" cellspacing="0" class="border" >
<tr class="title">
<td colspan="2" align="center"> <strong>管理員登錄</strong></td>
</tr>
<tr>
<td height="120" colspan="2" class="tdbg">
<table width="250" border="0" cellspacing="8" cellpadding="0" align="center">
<tr>
<td align="right">用戶名稱:</td>
<td><input name="UserName" type="text" id="UserName2" size="23" maxlength="20"></td>
</tr>
<tr>
<td align="right">用戶密碼:</td>
<td><input name="Password" type="password" size="23" maxlength="20"></td>
</tr>
<tr>
<td align="right">驗 證 碼:</td>
<td><input name="CheckCode" size="15" maxlength="6">
1109 </td>
</tr>
<tr>
<td colspan="2"> <div align="center">
<input type="submit" name="Submit" value=" 確認 ">
<input name="reset" type="reset" id="reset" value=" 清除 ">
<br>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center">後台管理頁面需要屏幕解析度為 <font color="#FF0000"><strong>1024*768</strong></font>
或以上才能達到最佳瀏覽效果!<br>
需要瀏覽器為<strong><font color="#FF0000"> </font></strong><font color="#FF0000"><strong>IE5.5</strong></font>
或以上版本才能正常運行!!!</p>
</form>
</body>
</html>
7、我要設計一個網站,現在做一個登陸頁面,怎樣使登陸頁面與SQL資料庫相連?
最簡單的
string connString = ConfigurationManager.AppSettings["ConnectionString"]
string username=Request.QueryString["username"]
string sql="select username , password from user where username=username"
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
conn.Open();
DataSet ds = new DataSet();
adapter.Fill(ds);
if(ds.table[0].Rows[0]["username"])
{
Response.Write "登錄成功"
}
8、網站設計中怎麼實現讓用戶登錄後還跳到原來的頁面
1.可以用session記錄登錄前的頁面地址;
2.在登錄頁面用個隱藏的input記錄refer頁面,然後和登錄信息一塊提交。
9、如何設計網站的用戶注冊登錄這一部分的資料庫。
說的不太明白,首先要製作用戶登錄是使用表單實現的,最基本的要有四個頁面可以實現,第一個頁面時登錄頁面,第二個是登錄成功的頁面,第三個是登錄失敗的頁面,第四個頁面是驗證的頁面,在登陸頁面上使用form action=「驗證的頁面」在驗證的頁面上使用 session獲取對象,具體方法<body> <% Session("name")=request.form("name") Session("password")=request.form("pass") If Session("name")="王明"and Session("password")="123" Then Response.Redirect"chonggong.asp" Else Response.Redirect"shi.asp" End If %> </body>這與資料庫連接可以在Dreamweaver中添加實現。有什麼不明白的給我回話。希望我說的對你有所幫助
10、網站的登錄頁面應該怎麼設計
網站的登錄頁面要求簡單、干凈;主要展示用戶名、密碼;下面就有個注冊和忘記密碼,以這樣的形式來展示就可以了。