navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

case sensitive

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> case sensitive
Page: [1]
 
Dan Wheeler

 

Posts: 103
Joined: 12/31/2002
Status: offline

 
case sensitive - 2/7/2003 14:59:58   
Hi everyone! Im trying to figure out how to get this password code to be case sensitive for both the username, and password, or at least for the password. Any ideas how I can do that? The code might look a little messy, i' m pretty new to coding. Thanks!



<%
Set MyConn=Server.CreateObject(" ADODB.Connection" )
MyConn.Open (" your connectionString" )
Set mine = New Regexp
mine.global = True
mine.Pattern = " [^0-9a-zA-Z]"
UserName = mine.Replace(Request.Form(" username" ), " " )
Password = mine.Replace(Request.Form(" password" ), " " )
SQL = " Select UserName, Password From tblLogin " _
& " Where UserName = ' " &UserName&" ' And Password = ' " &Password&" ' "
Set RS = MyConn.Execute(SQL)
If Not RS.EOF Then
Session(" work" ) = True
If Session(" work" ) = True Then
Response.Redirect " default.asp"
Else
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
End If
End If
%>
<FORM ACTION=" userlogin.asp" METHOD=" post" >
<TABLE BORDER=0>
<TR>
<TR>
<TD ALIGN=" right" >Login:</TD>
<TD><INPUT TYPE=" text" NAME=" username" size=" 20" ></INPUT></TD>
</TR>
<TR>
<TD ALIGN=" right" >Password:</TD>
<TD><INPUT TYPE=" password" NAME=" password" size=" 20" ></INPUT></TD>
</TR>
<TR>
<TD ALIGN=" right" ></TD>
<TD><INPUT TYPE=" submit" VALUE=" Login" ></INPUT>
<INPUT TYPE=" reset" VALUE=" Reset" ></INPUT>
</TD>
</TR>
</TABLE>
</FORM>
SerenityNet

 

Posts: 1364
Joined: 6/12/2001
From: Allen, TX, USA
Status: offline

 
RE: case sensitive - 2/7/2003 23:51:36   
Instead of:
quote:

Set mine = New Regexp
mine.global = True


Try:
quote:

Set mine = New Regexp
RegExp.IgnoreCase = False
mine.global = True


Sorry that I' m just passing by right now and don' t have time to check this for you. Please, let me know how it works. I' m learning too.

_____________________________

</Chaos, panic, & disorder - my work here is done.>

(in reply to Dan Wheeler)
Doug G

 

Posts: 1189
Joined: 12/29/2001
From: SoCal
Status: offline

 
RE: case sensitive - 2/8/2003 0:21:13   
You can do a case-sensitive comparison using the StrComp() function in VBScript.

http://msdn.microsoft.com/library/en-us/script56/html/vsfctStrComp.asp


_____________________________

======
Doug G
======

(in reply to Dan Wheeler)
Dan Wheeler

 

Posts: 103
Joined: 12/31/2002
Status: offline

 
RE: case sensitive - 2/8/2003 4:43:04   
I tried
mine.IgnoreCase = False
among many other thing, but it didn' t make a difference. According to anything I' ve read, by default it should be case sensitive. Is there something in the code that is changing that, maybe the Replace? I tried using the StrComp, but anything that I tried that didn' t get an error didn' t make a difference. How exactly would I set the StrComp up? Thanks for the suggestions.

(in reply to Dan Wheeler)
SerenityNet

 

Posts: 1364
Joined: 6/12/2001
From: Allen, TX, USA
Status: offline

 
RE: case sensitive - 2/8/2003 12:17:02   
Hi Dan,

I' m validating against an Access DB. Whether I use the FP DRW or your code above, it is not case sensitive. [:' (] If UserName is " Aa" and Password is " Aa" then " aa" and " AA" are still accepted. :) I don' t know why. I tried commenting out the cleansing lines and it didn' t make any difference. :)

I give up. :) There must be something that can be added to the query string, a validation rule to be added to the Access table, or something!


HELP!

_____________________________

</Chaos, panic, & disorder - my work here is done.>

(in reply to Dan Wheeler)
SerenityNet

 

Posts: 1364
Joined: 6/12/2001
From: Allen, TX, USA
Status: offline

 
RE: case sensitive - 2/9/2003 16:19:01   
Got it! :)

Thank you Doug. It took me a while, but I never would have figured it out without your reference to MSDN.

Dan, following is the code. I' ve been procrastinating again, so I really need to get going. I haven' t cleaned up the code at all. I' ve left in my lines of code where I showed what variables were doing what. You will need to change it back to your variables, your tables, delete my proofing lines, etc. Also, you really should declare all your variables and use option explicit. But I think you will be able to follow what I' ve done and make your UserName &/or Password case sensitive.

Have fun,
Andrew



<%
Set MyConn=Server.CreateObject(" ADODB.Connection" )
MyConn.Open (" DSN=Validate" )
Set mine = New Regexp
mine.Pattern = "
[^0-9a-zA-Z]"
mine.IgnoreCase = False
mine.global = True
fUserID = Request.Form(" username" )
fUserPassword = Request.Form(" password" )
UserID = mine.Replace(Request.Form(" username" ), " " )
UserPassword = mine.Replace(Request.Form(" password" ), " " )
SQL = " Select * From tbl_PasswordLevel " _
& " Where UserID = ' " &fUserID&" ' And UserPassword = ' " &fUserPassword&" ' "

Set RS = MyConn.Execute(SQL)

If Not RS.EOF Then
Session(" work" ) = " good"

UserID = RS(" UserID" )
UserPassword = RS(" UserPassword" )
MatchID = StrComp(fUserID,UserID,0)
MatchPswd = StrComp(fUserPassword,UserPassword,0)

If MatchID <> 0 then Session(" work" ) = " bad"
If MatchPswd <> 0 then Session(" work" ) = " bad"

response.write " MatchID = "
response.write MatchID
response.write " <br>"
response.write " MatchPswd = "
response.write MatchPswd
response.write " <br>"
Response.Write " <b>Form</b><br>"
Response.Write fUserID
Response.Write " <br>"
Response.Write fUserPassword
Response.Write " <br>"
Response.Write " <b>Database</b><br>"
Response.Write UserID
Response.Write " <br>"
Response.Write UserPassword
Response.Write " <br>"

Else
Session(" work" ) = " bad"
End If

RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
If Session(" work" ) = " good" Then
' Response.Redirect " LoginDan.asp"
Response.Write " <font color=" " green" " >Did it :-)<br>"
Response.Write " The session variable work equals "
Response.Write Session(" work" )
Response.Write " </font>"
Else
' Response.Redirect " LoginDan.asp"
Response.Write " <font color=" " red" " >Didn' t do it :-( <br>"
Response.Write " The session variable work equals "
Response.Write Session(" work" )
Response.Write " </font>"
End If
%>


< Message edited by SerenityNet -- 2/9/2003 4:26 PM >


_____________________________

</Chaos, panic, & disorder - my work here is done.>

(in reply to Dan Wheeler)
Dan Wheeler

 

Posts: 103
Joined: 12/31/2002
Status: offline

 
RE: case sensitive - 2/9/2003 20:24:25   
You Da Man!! I was sooo close too. When I was trying the StrComp, I was using the exact same lines you wrote, but had 1 character different on one of the lines. It didn' t give me an error, but it didn' t make it case sensitive either. Makes me feel good that I was at least close. Thank you very, very much.

(in reply to Dan Wheeler)
Doug G

 

Posts: 1189
Joined: 12/29/2001
From: SoCal
Status: offline

 
RE: case sensitive - 2/9/2003 21:34:00   
I' m glad you got it going :)



_____________________________

======
Doug G
======

(in reply to Dan Wheeler)
SerenityNet

 

Posts: 1364
Joined: 6/12/2001
From: Allen, TX, USA
Status: offline

 
RE: case sensitive - 2/10/2003 8:21:20   
Hi Dan.

I' m guessing you tried, MatchID = StrComp(fUserID,UserID,1) For whatever reason, the " text" comparison doesn' t catch the case either. (I' d have thought it would.) But a " binary" comparison (0) does.

Thanks again Doug.

Later,
Andrew

_____________________________

</Chaos, panic, & disorder - my work here is done.>

(in reply to Dan Wheeler)
Dan Wheeler

 

Posts: 103
Joined: 12/31/2002
Status: offline

 
RE: case sensitive - 2/10/2003 8:56:43   
yup

(in reply to Dan Wheeler)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> case sensitive
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts