PDA

Click to See Complete Forum and Search --> : [RESOLVED] Login System problem


boxhead283
Aug 30th, 2007, 04:04 AM
Hey guys,
I currently have a login system made already. It works but if I add more than 1 login or password it wont work correcty. I tried making something with out a sql data base. I will post the code below.


This is my username and password. Text1 = Username and Text2 = Password


Private Sub cmdLogin_Click()

Dim intU As Integer

If Text1 = "" Then Exit Sub
For intU = 1 To uCur
If U(intU, 2) = Text1 Then Exit For
Next intU
If intU > uCur Then

Else

End If


If Text2 = "" Then Exit Sub


If U(intU, 1) <> (Text2) Then MsgBox "ACCESS DENIED!": Exit Sub

Label1.Visible = True
End Sub





Now the way I have the code writen it reads off 1 file. I cant point it to my site. The code to know what parts of the db file to read off of is below here.



Private Sub Form_Load()
Label1.Visible = False
Dim Data As String

Data = Inet1.OpenURL("http://www.site.net/Data.db")


If Data <> "" Then
Open Data For Input As #1
For uCur = 1 To uMax
If EOF(1) Then Exit For
Input #1, U(uCur, 1), U(uCur, 2)
Next uCur
uCur = uCur - 1:
Close #1
End If
End Sub





In the data base file, here is a example of what it looks like.


"t551","John"
"62afdr4","Chris"



I've tried so many other ways but the way I have shown these codes above, I compile and get a error of ' File Not Found - Runtime error 53'
If I point it to a location on my computer the code works.
Does anyone know how I can get this all to work correctly?

DigiRev
Aug 30th, 2007, 04:19 AM
Glancing over the code...Data is a string variable (which contains the HTML that the inet control returned). You can't treat a variable as a file. Save it to disk first before you use the: Open Data As Whatever... line.

ex:

Data = Inet1.OpenURL("http://www.site.net/Data.db")

dim i as integer
i = freefile
open app.path & "\dump.html" for output as #i
print #i, data
close #i

If Data <> "" Then
Open app.path & "\dump.html" For Input As #1
'etc...


But I would prefer to process the data as a variable rather than dumping to disk first.

boxhead283
Aug 30th, 2007, 07:18 AM
When the program closes I have the Data.db file Delete on automatic. The file for some reason everytime I run it back up, and it redownloads as it supose to, the file is the same old info. It downloads from my website everytime it is started back up. I over wrote the Data.db file on the site, started my program back up, and its the same old info. Why?

boxhead283
Aug 30th, 2007, 09:03 AM
Never mind got it and thank you very much.

Hack
Aug 30th, 2007, 11:39 AM
What did you do to get it to work?

It might help others.

boxhead283
Sep 6th, 2007, 02:27 AM
Well its kinda tricky. What I did was I had it on my website right. Well my program downloads it to a dir in the windows folder so its hard to find and the person using the program wont know about it and one the program is terrminated, its suppose to delete the file downloaded in the windows folder. If you like I can post some codes to you showing what I did.

Hack
Sep 6th, 2007, 07:08 AM
Sure....post your code.

As I said, it may help others in a similiar situation.

Also, if you consider this resolved, you could help us out by pulling down the Thread Tools menu and clicking the Mark Thread Resolved menu item. That will let everyone know that you have your answer.

Thank you. :)

boxhead283
Sep 11th, 2007, 08:15 AM
Let me explain how I did my code real quick. Using a login and password base system without sql data base. What this will do is download a file off a site directory and read BUT when the program is terrminated, the file is deleted.
I also have it download secretly, and into a random directory where not to many people would look. :)

I hope this helps.


Private Sub Form_Load()
frmForm1.Caption = "Login" + Format(Now, " mm/dd/yyyy")
News.Show vbModal




Label1.Visible = False
Dim Data As String

Call DownloadFile("http://www.Site.com/account/Data.dll", "C:/WINDOWS/Help/Data.dll") ' Downloads..
Close #1



Data = "C:/WINDOWS/Help/Data.dll"


If Data <> "" Then
Open Data For Input As #1
For uCur = 1 To uMax
If EOF(1) Then Exit For
Input #1, U(uCur, 1), U(uCur, 2)
Next uCur
uCur = uCur - 1:
Close #1
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)



DeleteFile "C:/WINDOWS/Help/Data.dll"


Close #0
End Sub






Btw, the Data.dll is really just a notepad file, and save as a dll file, plus the passwords are hashed incase someone finds it and trys stealing passwords. :)