-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathitem_display.php
96 lines (81 loc) · 2.64 KB
/
item_display.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
<?
require('./conf.php');
$sql_update = "UPDATE items SET item_Status = 1 WHERE (UNIX_TIMESTAMP(item_Close_Date) - UNIX_TIMESTAMP()) <0";
$result = mysqli_query($connect, $sql_update);
$sql = "SELECT * FROM items WHERE item_Status = 0 ORDER BY UNIX_TIMESTAMP(item_Close_Date)";
$result = mysqli_query($connect, $sql);
while ($row = mysqli_fetch_array($result)) {
$id[] = $row['item_ID'];
$name[] = $row['item_Name'];
$price[] = $row['item_Actual_Price'];
$highest_bidder[] = $row['user_Name'];
$date[] = $row['item_Close_Date'];
$path[] = str_replace('..','.',$row['item_Path']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>SimpleAuction - Home</title>
<!-- Include CSS -->
<link href="./css/jquery.countdown.css" rel="stylesheet" type="text/css" />
<!-- Include Scripts -->
<script type="text/javascript" src="./js/jquery.countdown.js"></script>
<script type="text/javascript">
function highlight(periods) {
if ($.countdown.periodsToSeconds(periods) <= 30) {
$(this).addClass('highlight');
}
else {
$(this).removeClass('highlight');
}
}
$(document).ready(function(){
<?
for($i=0;$i<count($id);$i++) {
echo '$("#item_time_'.$id[$i].'").countdown({
until: new Date("'.$date[$i].'"),
format: "dHMS",
onTick: highlight,
onExpiry: function() {
$.ajax({
type: "POST",
url: "ajax_bid_winner_process.php",
data: {
itemid:'.$id[$i].'
},
dataType: "json",
success: function(data) {
$("#bid").attr("id","ended");
$("#ended").attr("src","./images/buttons/ended.png");
$("#time_box").countdown("destroy");
}
});
}
});';
}
?>
});
</script>
</head>
<body>
<?
if (isset($id)) {
for($i=0;$i<count($id);$i++) {
echo '<div id="item'.$id[$i].'" class="itemBox">';
echo '<p class="item_head"><strong>'.$name[$i].'</strong></p>';
echo '<a href="bid.php?id='.$id[$i].'"><img src="'.$path[$i].'" width="195" height="167" alt="" /></a>';
echo '<p class="item_price">S$'.$price[$i].'</p>';
echo '<p class="item_highest_bidder">'.$highest_bidder[$i].'</p>';
echo '<div id="item_time_'.$id[$i].'" class="item_time">'.$date[$i].'</div>';
echo '<a href="bid.php?id='.$id[$i].'"><img class"item_image" src="./images/buttons/open.png" alt="Bid Now" width="138" height="47" /></a>';
echo '</div>';
}
}
?>
</body>
</html>
<?
mysqli_close($connect);
?>