You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
753 B

import sqlite3
def valid(username, password):
db_connection = sqlite3.connect('sports-registration.sqlite')
base_cursor = db_connection.cursor()
password_cursor = base_cursor.execute(f'SELECT password FROM user WHERE username=="{username}";')
db_password = password_cursor.fetchone()
if db_password is None:
return False
if db_password[0] == password:
return True
def register(username, program_type, program_name):
db_connection = sqlite3.connect('sports-registration.sqlite')
base_cursor = db_connection.cursor()
base_cursor.execute(f'INSERT INTO list (username, program_type, program_name) '
f'VALUES ("{username}", "{program_type}", "{program_name}")')
return True