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

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




PostPosted: Wed Jan 07, 2004 5:52 pm   Post subject: password and username program problem

username and password check...
if it fails let the person try 3 times.

I dont know how to do it
plz help
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: Wed Jan 07, 2004 5:57 pm   Post subject: (No subject)

heres your only freebie you'll get...from me atleast lol

code:

const username:="username"
const pwd:="password"
var uname:string
var passw:string
var count:=0
var win:=Window.Open("position:top,center,graphics:300;200")

proc userLogin
loop
put "Enter username"
get uname

if uname=username then
put "Correct username"
return
else
put "Access Denied"
count +=1
end if

if count=3 then
loop
Window.Close(win)
end loop
end if
end loop
end userLogin

proc userPwd
loop
put "Now enter the password"
get passw

if passw=pwd then
put "Login succesful"
return
else
put "Acess Denied"
count +=1
end if

if count=3 then
loop
Window.Close(win)
end loop
end if
end loop
end userPwd

userLogin
userPwd


there you go, you got yourself to login procedures

PS, if you get a problem with the "return" part of the procedure(im not sure about it) just replace return with "exit"
DanShadow




PostPosted: Thu Jan 08, 2004 11:26 am   Post subject: (No subject)

Also you could have it, that it saves the logins, and when the user types in the password/username, it loads from disk. Something like this:
code:

var datafile:int
var uname,upass,name,pass:string:=""
open :datafile, FiLeNaMe:get
get:datafile,name
uname:=name
put "Enter user name: "..
get name
if name=uname then
get:datafile,pass
put "Welcome ",name,", enter password: "..
get upass
if upass not=pass then
put "Password incorrect."
break
else
put "Login Accepted."
end if
elsif name not=uname
put "Username incorrect."
break
end if
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  [ 3 Posts ]
Jump to:   


Style:  
Search: