hi,,I developed website(asp.net vb)..on the login page the user have to enter not the whole passworad the page will ask him
to enter just 4 digits of his passworad and that number appear
randomly.my problem now I dont know how the compare will work between the passworad which he entered with the passworad which is saved on database.
But each random number is equal the index of the passworad which the password will be store in one string so, it should be compare one by one !!!!
Also the random numbers it repeated it shuld be not and I found by swap to be not repeated but is reapate.??
Just off the top of my head, I write in vb, not that quick in c sharp. But I put about 10 minutes into it just to test 1 char. I would have to come back to convert the program to test char positions 2-4-6-7. I'm a little fuzzy on integer array, in which I can loop the Integer array of p1 to test 2-4-6-7 in the same loop, and produce a exit code such as 0 for success or 1 for failure.
If I used the integer array of p1 for looping, I could just match the int value to the char position much faster. But that's my weakness.
Dim p1() asInteger = 2467
Anyways this is just a starter thought
ProtectedSub Page_Load(sender AsObject, e As System.EventArgs) HandlesMe.Load
Dim uPassword() AsChar = "fortune"Dim p1 AsInteger = 2Dim p1c AsChar = "r"Dim pMatch AsInteger = 1Dim input(uPassword.Length - 1) AsCharFor i AsInteger = 0To uPassword.Length - 1'Just building the password char array to validate the thought
input(i) = uPassword(i)
If (p1 = i) ThenIf (uPassword(i) = p1c) Then
pMatch = 0EndIfEndIfNext
Response.Write("<span style=""color: black;"">" & input & "</span>" & _
<span style=""color: black;"">" & pMatch.ToString & "</span>")
First on Page_Load the 4 random numbers are generated and store it in one array which
ispublicshared , thenon login buttom i retreve password based on user name to take one record
and store that passwoard on variable (passdbo) then I dolike this
x1 = (arrNumber(0) - 1)
a1 = passdbo.Chars(x1)
x2 = (arrNumber(1) - 1)
a2 = passdbo.Chars(x2)
x3 = (arrNumber(2) - 1)
a3 = passdbo.Chars(x3)
x4 = (arrNumber(3) - 1)
a4 = passdbo.Chars(x4)
passdb = Val(a1 + a2 + a3 + a4)
pass = Val(TextBox2.Text)
IfString.Compare(passdb, pass) Then
MsgBox("Invalid Username OR Password ")
Last Visit: 31-Dec-99 19:00 Last Update: 28-May-15 19:33