Add files via upload

This commit is contained in:
agsNeto20
2020-11-26 12:50:21 +00:00
committed by GitHub
commit 8f3ca62d95
4 changed files with 46 additions and 0 deletions
+31
View File
@@ -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
View File
@@ -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
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

+1
View File
File diff suppressed because one or more lines are too long