-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.py
35 lines (32 loc) · 952 Bytes
/
login.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import mysql.connector
from mysql.connector.cursor import MySQLCursor
#connect to database
mydb = mysql.connector.connect(
host = "localhost",
user ="root",
password= "",
database ="travel"
)
mycursor = mydb.cursor()
print('Welcome to Rocket Travel Agency')
#LOGIN
username = input('Enter your Username: ')
password = input('Enter password: ')
mycursor.execute("SELECT user_name FROM user_info")
record = mycursor.fetchall()
for x in record:
for y in x:
if y == username:
mycursor.execute("SELECT user_password FROM user_info")
record1 = mycursor.fetchall()
for a in record1:
for b in a:
if b == password:
print("Welcome!")
else:
print("Wrong Password, try again")
break
break
else:
print('Wrong Username, try again')
break