forked from lorinn/B3-First_Year_TeamProject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·151 lines (117 loc) · 4.28 KB
/
index.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
147
148
149
150
151
<!-- header and menu left -->
<?php include('header_menuleft.php'); ?>
<!-- Main body for page -->
<div class="index_box">
<div class="index_box_body">
<?php include('slider.php'); ?>
</div>
</div>
<div class="index_box">
<!-- Feature row -->
<div class="index_box_body">
<h2>Featured</h2>
<?
include('config.php');
$item1 = mysql_query("SELECT * FROM items WHERE type='2' AND status=1 ORDER BY views DESC LIMIT 4");
while ($row = mysql_fetch_assoc($item1))
{
$item_id = stripslashes($row['item_id']);
$picture = stripslashes($row['picture']);
$price = stripslashes($row['price']);
$name = strlen($row['name']) > 21 ? substr(stripslashes($row['name']),0,18).'...' : stripslashes($row['name']);
if($picture == NULL)
$picture='images/no_image.jpg';
else
$picture="uploads/".$picture;
echo "
<div class='prod_box'>
<div class='top_prod_box'></div>
<div class='center_prod_box'>
<div class='product_title'><a title='{$row['name']}' href='item_page.php?id=".$item_id."'>".$name."</a></div>
<div class='product_img'><a href='item_page.php?id=".$item_id."'><img border='0' height='94' width='94' src='".$picture."'></a></div>
<div class='prod_price'><span class='price'>£".$price."</span></div>
</div>
<div class='bottom_prod_box'></div>
</div>
";
}
?>
</div>
</br></br>
<!-- End Feature row -->
<br>
<!-- 2 column -->
<div id="buy_sell">
<!-- column1 -->
<div class="column1">
<h2>Recently Posted</h2>
<?php
$item1 = mysql_query("SELECT * FROM items WHERE type='2' ORDER BY item_id DESC LIMIT 8");
while ($row = mysql_fetch_assoc($item1))
{
$item_id = stripslashes($row['item_id']);
$picture = stripslashes($row['picture']);
$price = stripslashes($row['price']);
$name = strlen($row['name']) > 21 ? substr(stripslashes($row['name']),0,18).'...' : stripslashes($row['name']);
if($picture == NULL)
$picture='images/no_image.jpg';
else
$picture="uploads/".$picture;
echo "
<div class='prod_box'>
<div class='top_prod_box'></div>
<div class='center_prod_box'>
<div class='product_title'><a title='{$row['name']}' href='item_page.php?id=".$item_id."'>".$name."</a></div>
<div class='product_img'><a href='item_page.php?id=".$item_id."'><img border='0' height='94' width='94' src='".$picture."'></a></div>
<div class='prod_price'><span class='price'>£".$price."</span></div>
</div>
<div class='bottom_prod_box'></div>
</div>
";
}
?>
</div>
<!-- end column1 -->
<!-- column2 -->
<div class="column2">
<h2>Recently Requested</h2>
<?php
$item1 = mysql_query("SELECT * FROM items WHERE type='1' ORDER BY item_id DESC LIMIT 8");
$endline_count=0;
while ($row = mysql_fetch_assoc($item1))
{
$item_id = stripslashes($row['item_id']);
$picture = stripslashes($row['picture']);
$price = stripslashes($row['price']);
$name = strlen($row['name']) > 21 ? substr(stripslashes($row['name']),0,18).'...' : stripslashes($row['name']);
if($picture == NULL)
$picture='images/no_image.jpg';
else
$picture="uploads/".$picture;
$endline_count++;
echo "
<div class='prod_box'>
<div class='top_prod_box'></div>
<div class='center_prod_box'>
<div class='product_title'><a title='{$row['name']}' href='item_page.php?id=".$item_id."'>".$name."</a></div>
<div class='product_img'><a href='item_page.php?id=".$item_id."'><img border='0' height='94' width='94' src='".$picture."'></a></div>
<div class='prod_price'><span class='price'>£".$price."</span></div>
</div>
<div class='bottom_prod_box'></div>
</div>
";
if($endline_count==2)
{
$endline_count=0;
echo "<br>";
}
}
?>
</div>
<!-- end column2 -->
</div>
<!-- End 2 column -->
</div>
<!-- Main body for page ends -->
<!-- Footer information -->
<?php include('footer.php'); ?>