473,327 Members | 1,896 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,327 software developers and data experts.

read/write username/password in txt

15
Ok trying to setup a simple user login system

The first attempt I just used if statements for example

Expand|Select|Wrap|Line Numbers
  1. If txtusername = "carl" and txtpassword = "password" Then
  2. OK = True
  3. Form4.show
  4. else
  5. MSGbox("please enter correct details")
  6. end if
Anyway the way above works, but I would like it if I can store the username/password in text file, so I can eventually setup self registration.

I need a little push in the write direction for the code I need to start me off,
Apr 1 '08 #1
6 3214
lotus18
866 512MB
Follow this link.

Rey Sean
Apr 1 '08 #2
kadghar
1,295 Expert 1GB

Anyway the way above works, but I would like it if I can store the username/password in text file, so I can eventually setup self registration.

I need a little push in the write direction for the code I need to start me off,
hi Carl

Check the syntax of OPEN (for input, for output)

e.g.
Expand|Select|Wrap|Line Numbers
  1. Dim txtNumber as Integer
  2. txtnumber = freefile
  3. Open "C:\Passwords.txt" For Input As #txtnumber
Then you can use INPUT to store into a string and CLOSE, to do so.

HTH
Apr 1 '08 #3
carl2k2
15
Ok I used that tutorial although have a few errors since vista won't give me correct permissions(stupid vista :@)

This code needs modifying

Expand|Select|Wrap|Line Numbers
  1. Dim savefile As Long
  2. savefile = FreeFile()
  3. Open "F:\Users\Kate\Documents\savedfile.txt" For Output As #savefile
  4. Write #savefile, (Text1.Text), (Text2.Text)
  5. Close #savefile
I need it so (text2.text) will be displayed under text 1,

atm it displays as(in text file)

"username1", "password1"


I need it so it will display as

username1
password1
Apr 1 '08 #4
kadghar
1,295 Expert 1GB
atm it displays as(in text file)

"username1", "password1"


I need it so it will display as

username1
password1
Hate Vista too

Use the SPLIT function to separate the string into an array
to remove the " use REPLACE(yourString, chr(34), "") before using the SPLIT, with comma as delimiter.
Apr 1 '08 #5
carl2k2
15
Hate Vista too

Use the SPLIT function to separate the string into an array
to remove the " use REPLACE(yourString, chr(34), "") before using the SPLIT, with comma as delimiter.
Can you show me example in :

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); Split(Text2.Text)
  5. Close #savefile
I was reading, do i have to setup more variables for this :S?



trying but getting errors,

[PHP]Dim savefile As Long
Dim test
Dim test2
Dim spilt
spilt = Split((test), (test2))
test = (Text1.Text)
test2 = (Text2.Text)
savefile = FreeFile()
Open "I:\College Work ------- Updated 2008 March\new-work\savedfile.txt" For Output As #savefile
Write #savefile, spilt
Close #savefile[/PHP]

im lost :/
Apr 2 '08 #6
kadghar
1,295 Expert 1GB
Can you show me example in :

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); Split(Text2.Text)
  5. Close #savefile
I was reading, do i have to setup more variables for this :S?


im lost :/
ok, you're not that lost:

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
So far, so good, now you have your file number 'savefile' where you wanted it.

now, if i remember well, your first line was something like: "username","password".

now, lets create a couple of strings, and store the first line of your file there:
Expand|Select|Wrap|Line Numbers
  1. dim Str1 as string
  2. dim Str2 as string
  3. input #savefile, str1 'reads "username"
  4. input #savefile,str2  'reads "password"
  5.  
now, all you have to do is compare str1 with user name, and str2 with password

you can put this two last lines inside a

While not eof(savefile) / wend

HTH
Apr 2 '08 #7

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

Similar topics

5
by: j-marvin | last post by:
hi- i am going through the process of password protecting a directory using ..htaccess and .htpasswd i am experiencing difficulty. so my question is without making life anymore difficult is...
9
by: deko | last post by:
I want to use htaccess for authentication on my php site since I only have a few users who need access to secure areas. So, I created a new directory off public_html (secretDocs) and in that...
4
by: Lobang Trader | last post by:
Hi all, I am trying to create a username and a password class. I would like to know what are the RECOMMENDED minimum and maximum length for both fields? These fields will be something like...
2
by: john brown | last post by:
There is a web page that I access frequently and would like to automate the authentication of the username and password. I would like to user a perl script but I'm not really sure about the steps....
1
by: thoducng | last post by:
I am writing some code to access share folder on a remote network. DirectoryInfo dicInfo = new DirectoryInfo("remoteNetwork\shareFolder"); if (dicInfo.Exists) { //application code...
12
by: Cecil | last post by:
Does this make sense for a logon table: CREATE TABLE Logon ( ID INT NOT NULL IDENTITY PRIMARY KEY, name VARCHAR(15) NOT NULL, password VARCHAR(15) NOT NULL ) GO CREATE UNIQUE INDEX...
2
by: Jim in Arizona | last post by:
I made up a service that will move files from a folder on the machine that the service is running to a share on another machine. I use a try/catch incase an error is thrown and write that error to...
5
by: jehugaleahsa | last post by:
Hello: We have a request for an console application to change the administrative password on our user's machines during an upcoming update. The console application will be called from a batch...
0
by: =?Utf-8?B?TW9uaXF1ZQ==?= | last post by:
I just reinstalled IIS as I worked with wamp before and yet I didn't find out how to have a php and a asp server working the same time on a computer. (I had to uninstall the IIS to get wamp at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.