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.

24 lines
867 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:
db_connection.close()
return False
if db_password[0] == password:
db_connection.close()
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}");')
db_connection.commit()
db_connection.close()
return True