|
-
Jul 25th, 2011, 04:17 PM
#1
Thread Starter
New Member
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.
-
Jul 25th, 2011, 10:27 PM
#2
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.
-
Jul 26th, 2011, 02:24 PM
#3
Thread Starter
New Member
Re: Login System
How do i split the lines into a array?
-
Jul 26th, 2011, 02:54 PM
#4
Re: Login System
 Originally Posted by steamruler
How do i split the lines into a array?

Really? The guy is trying to help you...
-
Jul 26th, 2011, 08:46 PM
#5
Re: Login System
 Originally Posted by steamruler
How do i split the lines into a array?
As I said:
 Originally Posted by jmcilhinney
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.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|