示例#1
0
#!/usr/bin/python3

import Helpers.db as db
import Helpers.structure as structure
import Helpers.nav as nav
import Helpers.myparser as parser
import os, sys
import Helpers.validator as validator

print("Content-Type: text/html\r\n\r\n")
db.connectDB()
cookie = parser.parseCookie(os.getenv("HTTP_COOKIE"))
autenticate = db.checkSession(parser.parseCookie(
    os.getenv("HTTP_COOKIE"))) if validator.validateSession(cookie) else None

structure.printStartSection()
if autenticate != None:
    nav.printNav(autenticate, db.cartCount(autenticate))
else:
    nav.printNav(autenticate)
structure.printSearchForm()
items = db.getAllItems()
structure.printItemContents(items, 1)
structure.printEndSection()
示例#2
0
#!/usr/bin/python3

import Helpers.myparser as parser
import Helpers.db as db
import os, sys
import Helpers.structure as structure
import Helpers.validator as validator
import Helpers.nav as nav

db.connectDB()
cookie = parser.parseCookie(os.getenv("HTTP_COOKIE"))
autenticate = db.checkSession(parser.parseCookie(os.getenv("HTTP_COOKIE"))) if validator.validateSession(cookie) else None
if autenticate == None :
	#print("Location: http://localhost/cgi-bin/MA-Shop/security_ec_shop/login.py")
	print("Location: https://172.24.129.8/login.py")
	print()

else :	
	# Form to get item data 
	print("Content-Type: text/html\r\n\r\n")
	structure.printStartSection()
	nav.printNav(autenticate, db.cartCount(autenticate))
	form = """<div>
		<h3>Enter your product information:</h3>
		<form method="POST">
		<label for="name">Item Name*: </label>
		<input id="name" name="name" maxlength="50" /><br />
		<label for="description">Description*: </label>
		<input id="description" name="description" 
			maxlength="100" /><br />
		<label for="price">Price*: </label>