Results 1 to 5 of 5

Thread: Login System

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    15

    Question Login System

    I want to make a login system for my program, and i want it to pull the list from an ftp as an text document. (Lets say its ftp.notarealftpsite.lol)

    The text document will be arranged like this:
    Code:
    user:pass
    ipwn:not
    ilolz:yet
    and i want the program to search for the provided username and password in the list and switch to form2 if its found, else it will throw an error at the user.

    How will this be accomplished? Help.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Login System

    That is a very insecure system, but I assume that it is for learning purposes only, so I'll go with what you've asked for.

    First, create a WebClient and call its DownloadString method, which will download the file contents into a String object. You can then call Split on that String to split the lines into a String array. You can then loop through that array and call Split on each line to split it on the colon into another array containing user name and password. You can then compare the elements of the array to your user input. If you find a match then show your form and if you get to the end of the loop without a match then notify the user that their credentials are invalid.

    Now, your first instinct might to ask for the code to do all that but you should resist that. Look at each step and tackle each one in isolation, e.g. don't even think about splitting the file into lines until you can actually get the file contents. So, try it step by step and, if you have an issue with a step, show us what you have done and we can help you with that step. You can then move on and try the next step for yourself. This is obviously more effort and may take longer but it is the best way to learn. Reading other people's code and feeling that you understand how it works does less to help you write code of your own than most people want to admit.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    15

    Re: Login System

    How do i split the lines into a array?

  4. #4
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: Login System

    Quote Originally Posted by steamruler View Post
    How do i split the lines into a array?


    Really? The guy is trying to help you...
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Login System

    Quote Originally Posted by steamruler View Post
    How do i split the lines into a array?
    As I said:
    Quote Originally Posted by jmcilhinney View Post
    You can then call Split on that String to split the lines into a String array.
    If that's not clear enough in and of itself, here's the obvious web search:

    http://www.google.com.au/search?q=vb...ient=firefox-a

    and here's the second result, which contains the specific answer to your question:

    http://www.dreamincode.net/forums/to...-line-by-line/

    You may not have experience programming but I expect that you have experience searching the web, which is what you should always do first.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

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