Somthing wrong :( I'm sad about this, but try again!
"
else:
printError = "
Login page. Enter please
"
if create_db.check_db():
if create_db.create_table():
print('
DB was created ')
create_db.update_all()
print(' Now you can login, default: admin/admin
')
ref = form.getvalue('ref')
if ref is None:
ref = "/index.html"
print('
')
if form.getvalue('logout') is not None:
print("Set-cookie: login=; expires=Wed May 18 03:33:20 2003; path=/app/; httponly")
print("Set-cookie: role=; expires=Wed May 18 03:33:20 2003; path=/app/; httponly")
print("Content-type: text/html\n")
print('')
if login is None:
funct.head("Login page")
login_page("n")
if login is not None and password is not None:
USERS = sql.select_users()
for users in USERS:
if login in users[1] and password == users[3]:
if users[4] == "admin":
role = 1
elif users[4] == "editor":
role = 2
else:
role = 3
c = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
c["login"] = login
c["login"]["path"] = "/app/"
c["login"]["expires"] = "Wed May 18 03:33:20 2033"
c["role"] = role
c["role"]["path"] = "/app/"
c["role"]["expires"] = "Wed May 18 03:33:20 2033"
c["group"] = users[4]
c["group"]["path"] = "/app/"
c["group"]["expires"] = "Wed May 18 03:33:20 2033"
print(c)
if form.getvalue('ref') is None:
ref = "/index.html"
print("Content-type: text/html\n")
print('Redirecting')
print('')
print('' % ref)
sys.exit()
login_page("error")
funct.footer()