線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2010
推到 Plurk!
推到 Facebook!

使用者帳號和密碼如何在登入時區分大小寫?

尚未結案

kenny_yeh
一般會員


發表:8
回覆:8
積分:3
註冊:2008-03-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-07-30 17:58:11 IP:203.75.xxx.xxx 訂閱
各位先進:
請問一下在以下的Code中我如何使
使用者帳號和密碼如何在登入時區分大小寫?
是否有範例參考?
謝謝!!

[code xml]
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="950"%>
<!--#include file="Connections/LinkDB.asp" -->
<% Session("UserName") = String(Request.Form("Name")) %>
<% Session("UserPassword") = String(Request.Form("Password")) %>
<% Session("UserDate") = Date() %>
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_LinkDB_STRING;
Recordset1.Source = "SELECT * FROM UserAcount ORDER BY Name ASC";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
AddNew.Delete與Update方法都不可以使用 -->
Recordset1.LockType = 3;
Recordset1.Open();
var Recordset1_numRows = 0;
%>
<%
var Recordset2 = Server.CreateObject("ADODB.Recordset");
Recordset2.ActiveConnection = MM_LinkDB_STRING;
Recordset2.Source = "SELECT * FROM Data ORDER BY 日期時間 ASC";
Recordset2.CursorType = 0;
Recordset2.CursorLocation = 2;
Recordset2.LockType = 1;
Recordset2.Open();
var Recordset2_numRows = 0;
%>
<%
var MM_LoginAction = Request.ServerVariables("URL");

if (Request.QueryString!="") MM_LoginAction = "?" Server.HTMLEncode(Request.QueryString);

var MM_valUsername=String(Request.Form("Name"));
var MM_valUserpassword=String(Request.Form("Password"));


if (MM_valUsername != "undefined") {

var MM_fldUserAuthorization="";
var MM_redirectLoginSuccess="/DataBase.asp";
var MM_redirectLoginFailed="/Login-Fail.asp";
var MM_flag="ADODB.Recordset";
var MM_rsUser = Server.CreateObject(MM_flag);
MM_rsUser.ActiveConnection = MM_LinkDB_STRING;
MM_rsUser.Source = "SELECT Name, Password";
if (MM_fldUserAuthorization != "")
MM_rsUser.Source = "," MM_fldUserAuthorization;
MM_rsUser.Source = " FROM UserAcount WHERE Name='" MM_valUsername.replace(/'/g, "''") "' AND Password='" MM_valUserpassword.replace(/'/g, "''") "'";


MM_rsUser.CursorType = 0;
MM_rsUser.CursorLocation = 2;
MM_rsUser.LockType = 3;
MM_rsUser.Open();




if (!MM_rsUser.EOF || !MM_rsUser.BOF) {
user
Session("MM_Username") = MM_valUsername; //BrowSer輸入的值


if (MM_fldUserAuthorization != "") {


Session("MM_UserAuthorization") = String(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value);
} else {
Session("MM_UserAuthorization") = ""; //沒有清空
}//if (MM_fldUserAuthorization != "")


if (String(Request.QueryString("accessdenied")) != "undefined" && false) {
MM_redirectLoginSuccess = Request.QueryString("accessdenied");
}//if (String(Request.QueryString("accessdenied"))


MM_rsUser.Close();


Response.Redirect(MM_redirectLoginSuccess);
}//if (!MM_rsUser.EOF || !MM_rsUser.BOF)


MM_rsUser.Close();
Response.Redirect(MM_redirectLoginFailed);
}//if (MM_valUsername != "undefined")
%>
<%
function MM_findObj(n, d) { //v4.01
var p,i,x;
if(!d)
d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p 1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all)
x=d.all[n];
for (i=0;!x&&i x=d.forms[i][n];
for(i=0;!x&&d.layers&&i x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById)
x=d.getElementById(n);
return x;
}//function MM_findObj(n, d)

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i =3)
{
test=args[i 2];
val=MM_findObj(args[i]);
if (val)
{
nm=val.name;
if ((val=val.value)!="")
{
if (test.indexOf('isEmail')!=-1)
{
p=val.indexOf('@');
if (p<1 || p==(val.length-1))
errors ='- ' nm ' must contain an e-mail address.\n';
}
else if (test!='R')
{
num = parseFloat(val);
if (isNaN(val))
errors ='- ' nm ' must contain a number.\n';
if (test.indexOf('inRange') != -1)
{
p=test.indexOf(':');
min=test.substring(8,p);
max=test.substring(p 1);
if (num errors ='- ' nm ' must contain a number between ' min ' and ' max '.\n';
}//if (test.indexOf('inRange') != -1)
}//if (test.indexOf('isEmail')!=-1)
}//if ((val=val.value)!="")
else if (test.charAt(0) == 'R')
errors = '- ' nm ' is required.\n';
}//if (val)
}//for (i=0; i<(args.length-2); i =3)
if (errors)
alert('The following error(s) occurred:\n' errors);
document.MM_returnValue = (errors == '');
}//function MM_validateForm()
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" c />
<title>補隙站網管子系統</title>
</head>

<body>









Logo







帳號:
<input name="Name" type="text" id="Name" />


密碼:
<input name="Password" type="password" id="Password" />



<input name="Login" type="submit" id="Login" value="登入" />
<input type="reset" value="更正" name="Modify" />


</form>



<form name="f1" id="f1">





</form>



</body>
</html>
<%
Recordset1.Close();
%>
<%
Recordset2.Close();
%>

[/code]

------
對權威愚忠就是真理最大的敵人!!
http://www.2a.com.tw">得安科技有限公司 TEL:(02)2596-0696 Copyright c 2008 - Double Advance Technology LTD. All Rights Reserved

程式版權所有:得安科技有限公司 程式人員:Kenny
系統時間:2024-05-03 16:34:20
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!