473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Trying to make a simple login/registration vb6

15
Ok First I have a very simple way of entering data into a form and saving that into a text file,

I made two text files for username(text1) and password(text2), I would like to make a simple login with the outcome out this,

Code for Registration:

Expand|Select|Wrap|Line Numbers
  1. Dim savefile As Long
  2. savefile = FreeFile()
  3. Open "I:\College Work ------- Updated 2008 March\new-work\savedfile.txt" For Output As #savefile
  4. Write #savefile, (Text1.Text); (Text2.Text)
  5. Close #savefile
From entering data it is saved into 'savedfile.txt', and is displayed as:

"carl2k2","mypassword"

I would Like to have a simple login form so it would ask for the user to input their username and password(using two seperate text boxes again), so it will read the 'savedfile.txt' to see if what the user entered is correct, if then not then a simple if statement would be like msgbox("Incorrect Values,") or something like that,

(ps, I did have a similar post but that was about something else which I dont think I need now)
Apr 2 '08 #1
1 3056
jeffstl
432 Expert 256MB
Ok First I have a very simple way of entering data into a form and saving that into a text file,

I made two text files for username(text1) and password(text2), I would like to make a simple login with the outcome out this,

Code for Registration:

Expand|Select|Wrap|Line Numbers
  1. Dim savefile As Long
  2. savefile = FreeFile()
  3. Open "I:\College Work ------- Updated 2008 March\new-work\savedfile.txt" For Output As #savefile
  4. Write #savefile, (Text1.Text); (Text2.Text)
  5. Close #savefile
From entering data it is saved into 'savedfile.txt', and is displayed as:

"carl2k2","mypassword"

I would Like to have a simple login form so it would ask for the user to input their username and password(using two seperate text boxes again), so it will read the 'savedfile.txt' to see if what the user entered is correct, if then not then a simple if statement would be like msgbox("Incorrect Values,") or something like that,

(ps, I did have a similar post but that was about something else which I dont think I need now)
One thing to note is that the format of your .txt string must be consistent for this below to work.

In other words, in this example user name is always 5 characters long as well as password


Expand|Select|Wrap|Line Numbers
  1. Open strFileName For Input As #1
  2. Line Input #1, strrecord   
  3. strUser= Left(strrecord, 5) 'use these string filters to get your values 
  4. strPass= Mid(strrecord, 10, 5) 'use these string filters to get your values 
  5.  
  6.  
I didn't actually test this for accuracy but check this out for a better examples
http://www.w3schools.com/vbscript/func_mid.asp

It will be something like that though to get those values then compare them to the entered values of the text boxes

Expand|Select|Wrap|Line Numbers
  1. if txtUserName.Text <> strUser then
  2.      'invalid user
  3. end if
  4.  
Apr 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JaNE | last post by:
Hello, I have made my cms... and is working, but have some, let me say "bugs"... And I don't know all reasons, please allow me slightly longer and most probably confusing post (that "confusing" is...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
5
by: Newbie | last post by:
Hi all, Just want to comment on this thread. Seems like every discussion about this matter (setting up DB provider for membership) and all the samples/references given by some MVPs always...
2
by: drah | last post by:
Hello not exactly sure if it is a php script problem or a database/table issue i apologize if i'mposting in wrong category. I was asked to put a login script on a site for someone and i made the...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
1
by: wislace | last post by:
Please I have created a Login Page and a Registration Page Using Dreamweaver.Please Can somebody help me so that when somebody Login,it opens a Window that contains only His Registration Page
0
by: sandy | last post by:
hello,,,,,,,,, i am creating login page using Perl/CGI facing prob... able to connect DB but from there facing prob If u have related code of login page in Perl please send me on...
3
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it...
3
by: jerrydigital | last post by:
Hello, I have created a login.asp page which i have posted below. When I login into my site, it automatically takes me to the redirect page "index.html" which means that i entered the wrong login...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.