Results 1 to 8 of 8

Thread: [RESOLVED] Login System problem

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    42

    Resolved [RESOLVED] Login System problem

    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

    Code:
    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.

    Code:
    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.

    Code:
    "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?

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Login System problem

    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:

    Code:
    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.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    42

    Re: Login System problem

    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?

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    42

    Re: Login System problem

    Never mind got it and thank you very much.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Login System problem

    What did you do to get it to work?

    It might help others.

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    42

    Re: Login System problem

    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.

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Login System problem

    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.

  8. #8

    Thread Starter
    Member
    Join Date
    Aug 2007
    Posts
    42

    Re: Login System problem

    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.

    Code:
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width