Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 password and window
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JayLo




PostPosted: Wed Jan 29, 2003 7:21 pm   Post subject: password and window

I would like to create a password window. When you first run the program it will go to the password screen and ask for the password. If the password is correct then it will go to the main window (my translating program, thank you tony).
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Wed Jan 29, 2003 8:35 pm   Post subject: ok

this is a very simple one.

code:

var pass:string %var for input
var goodpass:string:="swat" %the real pass

%main loop
loop
put "put in pass: "..
get pass %get input

if pass = goodpass then %check input
put "loading...."
put ""
exit %exit loop
end if

put "bad pass"
put ""
end loop


put code in fornt of the part that needs a pass.
chage good pass to the password.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Vicous




PostPosted: Mon Mar 03, 2003 12:14 am   Post subject: password

also, there is a code (look up exec in the turing help screens) that allows you to execute other programs, so try making an 'if then' statement that if they get the right password, it starts the normal program, but this isn't as secure
Tony




PostPosted: Mon Mar 03, 2003 12:22 am   Post subject: (No subject)

that what they do with those textbook CDs... Confused Basically you can directly access files with Adobe Reader instead of loading reader from the program thats password protected Wink

So its a good idea to encript the files and password protect the program that decrypts them.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
JayLo




PostPosted: Sun Mar 16, 2003 7:01 pm   Post subject: hey...

what about covering up the password with stars?
Asok




PostPosted: Sun Mar 16, 2003 7:09 pm   Post subject: (No subject)

well it would need to get the password in the background and then for each character put a * in. This can be done in a getch loop. The tricky part of it is backspacing. I know there is a keyboard command for backspace I just don't know it off the top of my head.
Tony




PostPosted: Sun Mar 16, 2003 7:23 pm   Post subject: (No subject)

i remember writing the password program, I just cant find it at the moment Confused

ASCII value of backspace is 8

in a loop, you run untill enter is pressed (ASCII 10 i belive). When you backspace, then you check that current password entered is more then 0 and if so, just cut the last character. Then using locate put a blank space instead of *
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
JayLo




PostPosted: Sun Mar 16, 2003 9:18 pm   Post subject: what if...

what if it's in a GUI text Field?
Tony




PostPosted: Sun Mar 16, 2003 9:47 pm   Post subject: (No subject)

still get input using getch, but instead of outputing on screen, write *s in textbox.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: Sun Mar 16, 2003 9:51 pm   Post subject: (No subject)

yeah, so have it like:

code:
for i : 1.. length(word)
put "*" .. %makes all text on one line
end for
put "" %Ends the single line string



And then it will display a * for every letter in the password. If you want it to use getch, then just have it display the * character, and have it loop until some sort of 'exit' key is pressed.

Mod Edit: Azndragon is awarded 8 bits - Asok
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: