Add files via upload
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
import database
|
||||||
|
|
||||||
|
MENU = """-- Netflox --
|
||||||
|
|
||||||
|
1) Sign Up.
|
||||||
|
2) Log in.
|
||||||
|
0) Exit.
|
||||||
|
|
||||||
|
Your Selection: """
|
||||||
|
|
||||||
|
|
||||||
|
def menu():
|
||||||
|
conn = database.conn()
|
||||||
|
|
||||||
|
while (user_input := input(MENU)) != "0":
|
||||||
|
print(user_input)
|
||||||
|
if user_input == "1": # if
|
||||||
|
name = input("Enter your name: ")
|
||||||
|
email = input("Enter your e-mail: ")
|
||||||
|
password = input("Enter your password: ")
|
||||||
|
|
||||||
|
database.create_user(conn, name, email, password)
|
||||||
|
|
||||||
|
elif user_input == "2":
|
||||||
|
email = input("Enter your e-mail: ")
|
||||||
|
password = input("Enter your password: ")
|
||||||
|
else:
|
||||||
|
print("Invalid input, please try again")
|
||||||
|
|
||||||
|
|
||||||
|
menu()
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
import psycopg2
|
||||||
|
conn = psycopg2.connect("host=localhost dbname=Netflox user=postgres password=postgres")
|
||||||
|
|
||||||
|
CREATE_USER = "INSERT INTO users (adminid, clientid, name, email, password, balance) VALUES (?, ?, ?, ?, ?, ?);"
|
||||||
|
|
||||||
|
adminid = 0
|
||||||
|
clientid = 0
|
||||||
|
|
||||||
|
def create_user(conn, adminid, clientid, name, email, password):
|
||||||
|
with conn:
|
||||||
|
conn.execute(CREATE_USER, (adminid, clientid, name, email, password, 20))
|
||||||
|
|
||||||
|
|
||||||
|
conn.close()
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user