Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
verifying a username and password
#1
The current set up for my programming is as follows:

LOCATE 2, 15
PRINT "******Primary School Main Menu******"
LOCATE 8, 22
LINE INPUT "Please enter your username: "; USERNAME$
IF USERNAME$ = USER$ THEN
LOCATE 12, 22
LINE INPUT "Please enter your password: "; PASSWORD$
ELSE
END IF
IF PASSWORD$ = PWD$ THEN
CALL TEACHER
ELSE
END

i have tried to design it so that you can only type in your password if the username is entered correctly. user$ is stored in a password file but a message appears stating 'duplicate definition".
how do i solve this problem?
Reply
#2
I am working on a similar program to what you have already... Post your code with the OPEN statement you are using to get the usernames and passwords that are valid (If you don't know what I mean just post all your prog :wink: ) and I'll have a look.

Are you encrypting the passwords in the file, btw? This is not relevant to your problem but I can show you how to make it so that users cannot just open the file and grab the password out of that.
Reply
#3
OPEN "U:\PASSWORD.DAT" FOR OUTPUT AS #9

and so forth....

On the original file name, do i need to set the fields as password(1 to count), and then on the actual screen that i previously posted, make username$ = user$(x)

???

something like that, i aint exactly sure sorry.

ive kinda given up on passwords, as long as they enter the correct one, i dont care (after too much time spent working on it Sad ) I did try using inkey$ to replace the password with "*"'s, but never got my head round that one
Reply
#4
Quote:I did try using inkey$ to replace the password with "*"'s, but never got my head round that one
http://forum.qbasicnews.com/viewtopic.php?t=2263
I knew that posting a password program that I wrote would come in handy!
It supports the backspace key, and terminates the password when you press enter. Of course, get rid of the last line in the program, or else it will show the password you entered. (Password is stored in pswd$ variable).
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#5
Or you could look at my program that I was offering to post up there. It supports password encryption, stars and the backspace and escape key and I could easily modify it to support encrypted usernames.

We could all work on it together. Zack, you could work out code for the password and username input, I could work on encryption to files and MickeyBR, you can put it all together so the variables are all correct (eg the password variable has the same name in both our progs) and you could perhaps do it in screen 12 or 13 and give it a windows style login look. Just make sure that we do all our coding in the main module - no subs unless you need them. Smile
Reply
#6
Heh, we could do that.
Problem is, I am terrible at graphical programming, and I have almost no experience with it.
I could do the Windows-like part easily with VBDOS, though.
Email me, kickflip_dude@email.com if you want.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#7
Try using STRING$ to replace the letters with *****s.
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#8
That problem's already solved, just use LOCATE to move to where the character is and print a *. Check Zacks prog prOgger (pun hehe)

Zack, I'll email you later today (31/3), at the moment I'm on a school pc. What do you want me to send you or talk about?
Reply
#9
heh, oh. Smile
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#10
Well, oracle... If you had any plans for the project mentioned, feel free to email me with an assignment, and I'll see what I can do.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)