예제 #1
0
def checkout():
    if checkSession() == False:
        return redirect('login')
    l = lineItemList()
    l.getOrder(session['orderid'])
    ot = 0.0
    for item in l.data:
        ot += float(item['price']) * int(item['quantity'])
    o = orderList()
    o.getById(session['orderid'])
    o.data[0]['status'] = 'completed'
    o.data[0]['orderprice'] = ot
    o.update()
    o = orderList()
    now = datetime.now()
    o.set('createtime', str(now))
    o.set('status', 'shopping')
    o.set('userid', session['user']['id'])
    o.add()
    o.insert()
    session['orderid'] = o.data[0]['oid']
    print('oid', session['orderid'])

    print(o.data)
    return render_template('checkedout.html', title='Check Out Completed')
예제 #2
0
def login():
    if request.form.get('email') is not None and request.form.get(
            'password') is not None:
        u = userList()
        if u.tryLogin(request.form.get('email'), request.form.get('password')):
            #print('Login Okay')
            session['user'] = u.data[0]
            session['active'] = time.time()
            o = orderList()
            o.getLast(session['user']['id'])
            if len(o.data) > 0:
                session['orderid'] = o.data[0]['oid']
            else:
                now = datetime.now()
                o.set('createtime', str(now))
                o.set('status', 'shopping')
                o.set('userid', session['user']['id'])
                o.add()
                o.insert()
                session['orderid'] = o.data[0]['oid']
            print('oid', session['orderid'])
            return redirect('main')
        else:
            #print('Login Failed')
            return render_template('login.html',
                                   title='Login',
                                   msg='Incorrect username or password.')
    else:
        if 'msg' not in session.keys() or session['msg'] is None:
            m = 'Type your email and password to continue.'
        else:
            m = session['msg']
            session['msg'] = None

        return render_template('login.html', title='Login', msg=m)
예제 #3
0
def deleteorder():
    if checkSession() == False:
        return redirect('login')
    o = orderList()
    o.deleteByID(request.form.get('id'))
    return render_template('deletedOrder.html',
                           title='Order Deleted',
                           msg='Order deleted.')
예제 #4
0
def orders():
    if checkSession() == False:
        return redirect('login')
    o = orderList()
    o.getAll()

    print(o.data)
    return render_template('orders.html', title='Orders', orders=o.data)
예제 #5
0
def myorders():
    if checkSession() == False:
        return redirect('login')
    o = orderList()
    o.getByCustomer(session['user']['id'])

    print(o.data)
    #return''
    return render_template('myorders.html', title='Your Orders', orders=o.data)
예제 #6
0
파일: urlTry.py 프로젝트: RHawkins77/pyPros
        break
vulnCounter(titleList)
browser.quit()
broken, bountyPriceList, spot, nonePaidCounters, geTenThou, leOneHun = findIfPaid(
    linkList, titleList, bountyPriceList, paidBounties, spot, geTenThou,
    leOneHun)
#print(bountyPriceList,nonePaidCounters,geTenThou,leOneHun)
#print(len(bountyPriceList))
#print(spot)
#print("I skipped?")
#print(linkList)
#vulnCounter(textList)
if broken == 1:
    writeToBrokenFile(bountyPriceList, spot, linkList, titleList)
if broken == 0:
    bountyPriceList, spot = orderList(bountyPriceList, spot)
    writeList(bountyPriceList, spot, titleList, linkList)
    writeLastList(bountyPriceList, spot, titleList, linkList)

with open('AboveAndBelow.txt', 'a+') as g:
    g.write("Greater than or equal to 10K:\n")
    g.write(str(geTenThou))
    g.write("Less than or equal to 100:\n")
    g.write(str(leOneHun))

with open('Count.txt', 'a+') as f:
    f.write("SQL Count: ")
    f.write(str(sqlCount))
    f.write("\n")
    f.write("CSRF Count: ")
    f.write(str(CSRFCount))