29 posts
Posted 25 November 2012 - 05:38 AM
I've made a password protection for my computer, but I need a username/ password. I was thinking like first it starts on username, on input it adds 1 to x, when x is 2 it changes cursor to password then sum how checks? Could sum1 whip up me a code? ;p thanks
2088 posts
Location
South Africa
Posted 25 November 2012 - 05:54 AM
term.setCursorPos(1,3)
print("Username: ")
print("Password: ")
term.setCursorPos(11, 3)
userName = read()
term.setCursorPos(11, 4)
passWord = read()
536 posts
Posted 25 November 2012 - 05:57 AM
Well remix has given you the code already but for future referance, please don't just as for code, at lease make some attempt at creating it, or do some research.
Not having a go, just mentioning it :D/>/>
29 posts
Posted 25 November 2012 - 06:14 AM
Ok thankyou but how would I like make it say recognised or whatever after user? Sorry I'm iPod so quite hard to type :D/>/>
1114 posts
Location
UK
Posted 25 November 2012 - 06:21 AM
Just use userName and passWord variables
user = "CHEESE"
pass = "CAKE"
term.setCursorPos(1,3)
print("Username: ")
print("Password: ")
term.setCursorPos(11, 3)
userName = read()
term.setCursorPos(11, 4)
passWord = read()
if userName = user and passWord = pass then
print("Logged in")
else
print("Error")
end
29 posts
Posted 25 November 2012 - 07:43 AM
thankyou :D/>/>
34 posts
Location
Programming Land
Posted 25 November 2012 - 12:32 PM
Just use userName and passWord variables
user = "CHEESE"
pass = "CAKE"
term.setCursorPos(1,3)
print("Username: ")
print("Password: ")
term.setCursorPos(11, 3)
userName = read()
term.setCursorPos(11, 4)
passWord = read()
if userName = user and passWord = pass then
print("Logged in")
else
print("Error")
end
There's an error here. On the if statements there should be 2 equal signs. Below is what it should be.
if userName == user and passWord == pass then