-
Notifications
You must be signed in to change notification settings - Fork 3
/
startpage.php
146 lines (135 loc) · 6.4 KB
/
startpage.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
<html>
<head>
<link href = "css_m.css" rel = "stylesheet" type = "text/css" >
<title>Start Page</title>
<style type = "text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #CCC;
}
</style>
</head>
<body>
<?php
//header("Location: bid_table_check.php");
include "bid_table_check.php";
?>
<div id = "Container">
<div id = "Top">
<div style = "height : 100%; width : 40%; float : left; background-color : #6CA1DA"><h1><a href = "startpage.php">Online Auction System</a></h1></div>
<div style = "height : 100%; width : 10%; float : right; background-color : #6CA1DA">
<p align = 'right'><a href = "login.php"><b><u>Log In</u></b></a> <a href = "signupinfo.php"><b><u>Sign Up</u></b></a></p>
<form method = "post" action = "productform.php" align = "right">
<input type = "submit" value = "Add your item!">
</form>
</div>
</div>
<div id = "Search">
<form method = 'post' action = 'search.php'>
<input type = 'text' name = 'product_name' placeholder = 'Product Name' style = 'width : 46.5%; height : 80%; margin-top : .4%'>
<select name = "status" style = "width : 40% height : 80%; margin-top : .4%; padding : .7%; background-color : white; font-size : 15px">
<option value = "ongoing" style = "font-size : 15px">Ongoing</option>
<option value = "finished" style = "font-size : 15px">Finished</option>
<option value = "yet to bid" style = "font-size : 15px">Yet To Bid</option>
</select>
<button type = 'submit' name = 'search' style = 'width : 10%; height : 80%; margin-top : .4% padding : .7%; font-size : 15px; background-color : #6CA1DA'>Search</button>
</form>
</div>
<div id = "Sidebar" >
<div id = "Ongoing" style = "width : 100%; height : 50%; background-color : #E0E7F4">
<div style = "width : 99%; height : 10%; background-color : white; border : 1px solid; border-color : white white black white"><h3 align = 'center' style = 'color : green; margin-top : 2px'><u>Ongoing Bid!</u></h3></div>
<?php
$user = "root";
$pass = "";
$db = "online_auction_system";
$db_connect = mysqli_connect("localhost", $user, $pass, $db) or die("no database found");
//echo "Database Connected"."<br>";
$qry = "SELECT product.Product_Name, locations.Name, product.Initial_Bid, bid.Status, time_track.Start_Time, time_track.End_Time, bid.Bid_ID
FROM product, bid, locations, time_track
WHERE product.Product_ID = bid.Bid_ID AND product.Location = locations.ID
AND time_track.Track_ID = product.Product_ID AND bid.Status LIKE 'ongoing'";
$res = mysqli_query($db_connect, $qry);
echo '<table>';
$cnt = 0;
while($row = mysqli_fetch_assoc($res))
{
if($cnt > 3)break;
echo '<tr>';
echo '<td align = "center" style = "border : 1px solid">' . $row['Product_Name'] . '</td>';
echo '<td align = "center" style = "border : 1px solid ; padding-top : 15px">' . '<form method = "post" action = "item_details.php"><button name = "details" type = "submit" value = ' . $row['Bid_ID'] . '>Details</button></form></td>';
echo '</tr>';
$cnt++;
}
echo '</table>';
?>
</div>
<div id = "Yet To Bid" style = "width : 100%; height : 50%; background-color : #E0E7F4">
<div style = "width : 99%; height : 10%; background-color : white; border : 1px solid; border-color : white white black white"><h3 align = 'center' style = 'color : orange; margin-top : 2px'><u>Yet To Bid!</u></h3></div>
<?php
$user = "root";
$pass = "";
$db = "online_auction_system";
$db_connect = mysqli_connect("localhost", $user, $pass, $db) or die("no database found");
//echo "Database Connected"."<br>";
$qry = "SELECT product.Product_Name, locations.Name, product.Initial_Bid, bid.Status, time_track.Start_Time, time_track.End_Time, bid.Bid_ID
FROM product, bid, locations, time_track
WHERE product.Product_ID = bid.Bid_ID AND product.Location = locations.ID
AND time_track.Track_ID = product.Product_ID AND bid.Status LIKE 'yet to bid'";
$res = mysqli_query($db_connect, $qry);
echo '<table>';
$cnt = 0;
while($row = mysqli_fetch_assoc($res))
{
if($cnt > 1)break;
echo '<tr>';
echo '<td align = "center">' . $row['Product_Name'] . '</td>';
echo '<td align = "center">' . '<form method = "post" action = "item_details.php"><button name = "details" type = "submit" value = ' . $row['Bid_ID'] . '>Details</button></form></td>';
echo '</tr>';
$cnt++;
}
echo '</table>';
?>
</div>
</div>
<div id = "Mainpanel">
<?php
$user = "root";
$pass = "";
$db = "online_auction_system";
$db_connect = mysqli_connect("localhost", $user, $pass, $db) or die("no database found");
//echo "Database Connected"."<br>";
$qry = "SELECT product.Product_Name, locations.Name, product.Initial_Bid, bid.Status, time_track.Start_Time, time_track.End_Time, bid.Bid_ID
FROM product, bid, locations, time_track
WHERE product.Product_ID = bid.Bid_ID AND product.Location = locations.ID
AND time_track.Track_ID = product.Product_ID AND bid.Status IN ('ongoing', 'yet to bid', 'finished')";
$res = mysqli_query($db_connect, $qry);
$cnt = 0;
echo '<table><th>Product Name</th><th>Location</th><th>Initial Bid</th><th>Status</th><th>Bid Start Time</th><th>Bid End Time</th><th>Product Details</th>';
while($row = mysqli_fetch_assoc($res))
{
if($cnt >= 9)
break;
echo '<tr>';
/*$name = $row['Product_Name'];
$loc = $row['Name'];
$start_bid = $row['Initial_Bid'];
$status = $row['Status'];*/
echo '<td align = "center">' . $row['Product_Name'] . '</td>';
echo '<td align = "center">' . $row['Name'] . '</td>';
echo '<td align = "center">' . $row['Initial_Bid'] . '</td>';
echo '<td align = "center">' . $row['Status'] . '</td>';
echo '<td align = "center">' . $row['Start_Time'] . '</td>';
echo '<td align = "center">' . $row['End_Time'] . '</td>';
echo '<td align = "center">' . '<form method = "post" action = "item_details.php"><button name = "details" type = "submit" value = ' . $row['Bid_ID'] . '>Details</button></form></td>';
echo '</tr>';
$cnt++;
}
echo '</table>'
?>
</div>
</div>
</body>
</html>