出来るのだASP Q&A掲示板(過去LOG)  訪問数 52046 昨日 889 今日 776
    【PR】 パソコン入門からIT専門書まで幅広く取り揃えています。セブン-イレブン受取り手数料無料のセブンアンドワイ。
Topに戻る 掲示板に戻る 検索 削除 管理者

[4890] IDだけでもログインできてしまう なぜ?
投稿者:Aさん 2005/01/18 18:57:26
こんにちは。
Login.htmlからパラメータを受け取り、以下のEnter.aspでそれを変数
userid,passwordに代入しログインを判定し,tool.xlsを起動させています。

またログイン判定の元データはLogin.txtというテキスト形式で以下のように記述しています。

USERID:test
PASSWORD:testtest

以下のソースから本来はID:test、PW:testtestでログインが可能になるはずですが、ID:test、PW:test でもログインができてしまいます。

Enter.asp
<%
'パラメータ取得
userid = Request.Form("userid")
password = Request.Form("password")

response.write userid & "<BR>"
response.write password & "<br>"

'ユーザ情報をチェックするサブルーチン
Sub ninshou(Rtc,userid, password)
filespec = server.mapPath("login.txt")
set fs = server.createobject("scripting.fileSystemObject")
'set f = fs.openTextFile(filespec, 1)
Dim Flg1, Flg2
Dim A(),B
Flg1 = false
Flg2 = false
'on error resume next
if userid <>"" and password <>"" then
s= 0
set f = fs.openTextFile(filespec, 1)
Do while not f.AtEndOfStream
redim preserve A(s)
A(s) = f.readLine
response.write A(s) & "<BR>"
s = s + 1
Loop
f.close
set f = nothing

response.write s & "<BR>"

For i = 0 to s -1
B = split(A(i),":")
response.write ubound(b) & "<br>"
for j = 0 to Ubound(B)
If B(j) = userid then
Flg1 = true
response.write B(j) & "=" & userid & " では " & flg1 & "1" & "<br>"
end if
If B(j) = password then
Flg2 = true
response.write B(j) & "=" & password & " では " & flg2 & "2" &"<br>"
end if
next
next
end if

If Flg1 = true and Flg2 = true Then
Rtc = "OK"
response.write rtc
Else
Rtc ="NG"
response.write rtc
End If

End Sub

Call ninshou(Rtc,userid,password)

If Rtc = "OK" Then
'Response.Redirect "tool.xls"

else
'Response.Redirect "login.htm"
End If

%>

なぜかということで原因をresponse.writeで調べた結果以下のようになりました。
要は、上記のFor〜next間が悪い事まではわかりましたが、何故悪いのかが分りません。


test
test
USERID:test
PASSWORD:testtest
2
1
test=test では True1
test=test では True2
1
OK

恐れ入りますが、For next間のどのソースを変更すれば、ID:test、PW:testtestだけでログインできるでしょうか?

IDだけでもログインできてしまう なぜ?   Aさん [2005/01/18 18:57:26] [4890]
  Re:IDだけでもログインできてしまう なぜ?   暇人さん [2005/01/19 16:06:20] [4891]
  Re:IDだけでもログインできてしまう なぜ?   あささん [2005/01/27 11:28:39] [4902]


TreeBBS For ASP V.0.1.3
Program By YasNet