You can see how I want the if statement to work, but please tell me why it does not work and how I can do it right...
passwd.txt
name=Kalle Anka:user=kalle:passw=rally name=Svante Carlsson:user=svante:passw=hopp
Program
# Open passwd.txt
passwd = open("passwd.txt", "r")
# Prompt for userdata
user = raw_input("Username: ")
password = raw_input("Password: ")
line1 = passwd.readline()
line2 = passwd.readline()
dict1 = line1.split(":")
dict2 = line2.split(":")
check_1_user = dict1[1]
check_1_pass = dict1[2]
check_2_user = dict2[1]
check_2_pass = dict2[2]
check_1_user = check_1_user[5:]
check_1_pass = check_1_pass[6:]
check_2_user = check_2_user[5:]
check_2_pass = check_2_pass[6:]
if (user == check_1_user) or (user == check_2_user):
if (password == check_1_pass) or (password == check_2_pass):
print "Okey, you have access to the secrete page..."
else:
print "You have not access..."
# Close passwd.txt
passwd.close()

New Topic/Question
Reply




MultiQuote





|