Spaces:
Sleeping
Sleeping
| import sqlite3 | |
| conn = sqlite3.connect("fitplan.db", check_same_thread=False) | |
| cursor = conn.cursor() | |
| # Create Users Table | |
| cursor.execute(""" | |
| CREATE TABLE IF NOT EXISTS users( | |
| name TEXT, | |
| age INTEGER, | |
| gender TEXT, | |
| email TEXT PRIMARY KEY, | |
| password TEXT, | |
| goal TEXT | |
| ) | |
| """) | |
| conn.commit() | |
| # Create user | |
| def create_user(name, age, gender, email, password, goal): | |
| cursor.execute( | |
| "INSERT INTO users VALUES (?,?,?,?,?,?)", | |
| (name, age, gender, email, password, goal) | |
| ) | |
| conn.commit() | |
| # Verify login | |
| def verify_user(email, password): | |
| cursor.execute( | |
| "SELECT * FROM users WHERE email=? AND password=?", | |
| (email, password) | |
| ) | |
| return cursor.fetchone() |