Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random, sqlite3, datetime
- ### VARIABLES ###
- conn = sqlite3.connect('bank.db')
- c = conn.cursor()
- date = str(datetime.date.today())
- caeser_strings = []
- encrypt = []
- #################
- # Custom (bad) cipher
- def cipher(string):
- for letter in string:
- number = ord(letter) - 96
- caeser_strings.append(number + 12)
- for item in caeser_strings:
- item += 3
- item *= 15
- item -= 43
- encrypt.append(item)
- return str(encrypt)
- def login():
- pass
- def register():
- print("Welcome to PyBank, please input your desired credentials below.")
- print("===============================================================")
- ### While loop incase confirm password is wrong. ###
- while True:
- forename = input("Forename: ")
- surname = input("Surname: ")
- user = input("Username: ")
- pword = input("Password: ")
- cPassword = input("Confirm Password: ")
- e_mail = input("E-mail: ")
- ### If the inputs aren't up to standard ###
- if(len(forename) < 2 or len(surname) < 2): print("You cannot have a space in your name or it is less than two character. TIP: your first name is your forename.")
- elif('@' not in e_mail and pword != cPassword): print("Passwords do not match and you need a valid email address.")
- elif(pword != cPassword): print("Passwords do not match.") #Checking if the passwords are equal
- elif('@' not in e_mail): print("You need a valid email address.")
- else:
- pword = cipher(pword);
- c.execute('INSERT INTO accounts (date, forename, surname, username, password, email, balance) VALUES (?, ?, ?, ?, ?, ?, ?)',
- (date, forename, surname, user, pword, e_mail, 5000))
- conn.commit()
- break
- def home():
- pass
- ### SQLite creating a table ###
- c.execute('CREATE TABLE IF NOT EXISTS accounts(id INTEGER PRIMARY KEY AUTOINCREMENT, forename TEXT, surname TEXT, date TEXT, username TEXT, password TEXT, email TEXT, balance REAL)')
- ### Choosing whether the client would like to log in or register. ###
- while True:
- user_choice = input("Login or Register: ").lower()
- if(user_choice == "login"):
- login();
- break
- elif(user_choice == "register"):
- register();
- break
- else:
- print("Invalid input, login or register only.")
- # TO DO
- # 1) Register system [x]
- # 2) Cipher system [x]
- # 3) Login system
- # 4) Home screen
- # 5) Withdraw money
- # 6) Transfer money to another account
- # 7) Deposit money
- # 8) Possibly a system to send emails.
- # 8) Make into a GUI
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement