-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathorders.php
146 lines (118 loc) · 5.64 KB
/
orders.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Everest - Orders</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/main.css" />
<link rel="stylesheet" type="text/css" href="../css/table.css" />
<link rel= "stylesheet" type="text/css" href = "../css/header_style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<style>
.tooltiptext {
visibility: hidden;
width: 120px;
color: #fff;
text-align: center;
border-radius: 6px;
/* Position the tooltip */
position: absolute;
z-index: 1;
top: 100%;
left: 50%;
margin-left: -21px;
margin-top: -14px;
}
.tooltiptext {
visibility: visible;
}
</style>
<!-- HEADER -->
<div id = "header">
<div style="float:left;height:50px;width:15%;min-width:120px;">
<a href = "/">
<img type = "everest_logo" src = "/imgs/everest-logo.png" alt = "Everest Logo" style="padding-left:28px;width: 107px;"/>
</a>
</div>
<?php
include_once ('./config.php');
$conn=mysqli_connect($servername,$username,$password,$dbname);
if (mysqli_connect_errno())
{
echo 'Failed to connect to MySQL: ' . mysqli_connect_error();
}
if(isset($_COOKIE['UID']))
{
//$_COOKIE['UID'];
$userid= $_COOKIE['UID'];
$query="select ccID from team_best_rds.tbl_credit_card where userID=$userid";
$result = mysqli_query($conn,$query);
if($row = mysqli_fetch_array($result))
{
$ccID = $row['ccID'];
}
else{$ccID=0;}
$query="select * from team_best_rds.tbl_orders where ccID = $ccID and cart =1";
$result = mysqli_query($conn,$query);
if($row = mysqli_fetch_array($result)){//if an order exist
$orderID=$row['orderID'];
$query="SELECT COUNT(*) as count FROM team_best_rds.tbl_orderdetails where orderID = $orderID";
$result = mysqli_query($conn,$query);
$row = mysqli_fetch_array($result);
echo'<a href="cart.php"style="color:white;margin-left: 67%;position: absolute;top: 15px; " ><span class="glyphicon glyphicon-shopping-cart"> Cart</span><span class = "tooltiptext">('.$row['count'].') </span> </a>';
}else{//if there's no order yet
echo'<a href="cart.php"style="color:white;margin-left: 67%;position: absolute;top: 15px; " ><span class="glyphicon glyphicon-shopping-cart"> Cart</span><span class = "tooltiptext"> (0) </span> </a>
';
}
}else{
echo'<a href="cart.php"style="color:white;margin-left: 67%;position: absolute;top: 15px; " ><span class="glyphicon glyphicon-shopping-cart"> Cart</span><span class = "tooltiptext"> </span> </a>';
}
?>
<form method="post" action="search.php" name="form">
<div id="search">
<input name = "searchbar" id = "searchbox" type="text" size="30" onkeyup="showResult(this.value)" placeholder="Search for an item..." />
</div>
<?php
if(isset($_COOKIE['email']) == "") {
echo '<a href="login.php"style="color:white;margin-left: 75%;position: absolute;top: 15px;" ><span class="glyphicon glyphicon-log-in"> Login</span> </a>
<a href="myaccount.php"style="color:white;margin-left: 41%;position: absolute;top: 15px;display:none"><span class="glyphicon glyphicon-user"> My Account</span> </a>
<a href="logout.php"style="color:white;margin-left: 75%;position: absolute;top: 15px;display:none"><span class="glyphicon glyphicon-log-out"> Logout</span> </a>
';
} else {
echo'
<a href="myaccount.php"style="color:white;margin-left: 41%;position: absolute;top: 15px;"><span class="glyphicon glyphicon-user"> My Account</span> </a>
<a href="logout.php"style="color:white;margin-left: 75%;position: absolute;top: 15px;"><span class="glyphicon glyphicon-log-out"> Logout</span> </a>
<a href="login.php"style="color:white;margin-left: 75%;position: absolute;top: 15px; display:none" ><span class="glyphicon glyphicon-log-in"> Login</span> </a>
';
}
?>
</div> <!-- End of Div header -->
<?php
include_once ('./getorderlist.php'); //get credit card
?>
<!-- Start of Footer -->
<div id="footer">
<div id="footer_inside">
<ul class="footer_menu">
<li><a href="index.php">Home Page</a>|</li>
<li><a href="index2.php">About Us</a>|</li>
<li><a href="index2.php">News & Events</a>|</li>
<li><a href="index2.php">Services</a>|</li>
<li><a href="index2.php">My Account</a>|</li>
<li><a href="index2.php">Contacts</a></li>
</ul><br /><br />
<p>Copyright ©. All rights reserved. Design by Team Best - CMPSC 431W</p>
</div>
</div>
<map name="Map">
<area shape="rect" coords="78,45,312,119" href="index.php">
<area shape="poly" coords="670,87,719,78,727,123,677,130" href="#">
<area shape="poly" coords="776,124,818,152,793,189,751,160" href="#">
<area shape="poly" coords="834,52,885,61,878,105,828,96" href="#">
</map>
</body>
</html>