-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathComputer.php
More file actions
219 lines (164 loc) · 6.02 KB
/
Computer.php
File metadata and controls
219 lines (164 loc) · 6.02 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
$Server="localhost";
$username="root";
$psrd="";
$dbname = "Bidding";
$connection= mysqli_connect($Server,$username,$psrd,$dbname);
$query = "SELECT * FROM Product WHERE ProductStatus = 'No' ";
$result=mysqli_query($connection,$query);
while ($row=mysqli_fetch_array($result))
{
$datenow = date("Y-m-d");
$duedate = $row['EndDate'];
$prodid = $row['ProductID'];
if($datenow >= $duedate){
$buyer=$row['Buyer'];
if($buyer=="Null")
{
$seller=$row['UserName'];
$ProductName=$row['ProductName'];
$message="Sorry Mr.".$seller.", Your Product ".$ProductName." Remain Unsold No one bid your product";
$query1="insert into Notification values('$seller','$message','No')";
mysqli_query($connection,$query1);
}
else
{
$qry="UPDATE Product SET ProductStatus = 'Yes' WHERE ProductID = '$prodid'";
mysqli_query($connection,$qry);
$seller=$row['UserName'];
$buyer=$row['Buyer'];
$ProductName=$row['ProductName'];
$qry1="select * from User where UserName='$seller'";
$result1=mysqli_query($connection,$qry1);
$row1=mysqli_fetch_array($result1);
$sname=$row1['Name'];
$semail=$row1['Email'];
$sphone=$row1['Phone'];
$qry2="select * from User where UserName='$buyer'";
$result2=mysqli_query($connection,$qry2);
$row2=mysqli_fetch_array($result2);
$bname=$row2['Name'];
$bemail=$row2['Email'];
$bphone=$row2['Phone'];
$message="Congratulation Mr.".$sname.", Your Product ".$ProductName." has been sold and Buyer is ".$bname." You can contact with Buyer by Email:".$bemail." or You can use phone:".$bphone.".";
$query1="insert into Notification values('$seller','$message','No')";
mysqli_query($connection,$query1);
$message="Congratulation Mr.".$bname.", Your are the final and highest bidder of Product ".$ProductName.". Now This is Your Product. Product Seller is ".$sname.", You can contact with Seller by Email:".$semail." or You can use phone: ".$sphone.".";
$query2="insert into Notification values('$buyer','$message','No')";
mysqli_query($connection,$query2);
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bidding System</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body {
font-family: Agency FB;
}
</style>
<script type="text/javascript">
function bid(id)
{
if(confirm('Sure Participate?'))
{
alert("Please Login in Your Account");
window.location='BidProduct.php?bid='+id
}
}
</script>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Kinbo.Com</a>
</div>
<ul class="nav navbar-nav">
<li><a href="Home.php"><b>    Home</b></a></li>
<li class="active" class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><b>  Computer</b><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="Car.php"><b>Car</b></a></li>
<li><a href="Mobile.php"><b>Mobile</b></a></li>
<li><a href="Computer.php"><b>Computer</b></a></li>
</ul>
</li>
<form class="navbar-form navbar-left" action="Search.php" method="POST">
<div class="input-group">
<input type="text" class="form-control" name="search" placeholder="Search" size="40">
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<i class="glyphicon glyphicon-search"></i>
</button>
</div>
</div>
</form>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="About Project.php"><b>About site</b></a></li>
<li><a href="Contact Us.php"><b>Contact Us</b></a></li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><b>Login</b><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="UserLogin.php"><b>User Login</b></a></li>
<li><a href="AdminLogin.php"><b>Admin Login</b></a></li>
</ul>
</li>
<li><a href="Registration.php"><span class="glyphicon glyphicon-user"></span> <b>Sign Up</b></a></li>
</ul>
</div>
</nav>
<table>
<?php
$Server="localhost";
$username="root";
$psrd="";
$dbname = "Bidding";
$connection= mysqli_connect($Server,$username,$psrd,$dbname);
$query="select * from product where CatagoryName='Computer' and ProductStatus='No' ";
$Result=mysqli_query($connection,$query);
$break=0;
while ($row=mysqli_fetch_array($Result)) {
if($break==2){
echo "<tr>";
$break=0;
}
$datenow = date("Y-m-d");
$sdate = $row['StartDate'];
if($sdate<=$datenow){
echo'<td>';
echo"<img src='".$row['Image']."' width='170px' height='220px'><br>";
echo'</td>';
echo'<td>';
echo "<h2> Description</h2>";
echo "<h4>";
echo "<b>";
$name=$row['ProductID'];
echo $row['ProductName'];
echo "</b>";
echo "</h4>";
echo $row['Description'];
echo "<br>";
echo "<b>";
echo "Price: ";
echo $row['Price'];
echo "</b>";
echo "<br>";
?>
<a href="javascript:bid(<?php echo $row[0]; ?>)"> <img src="Image/bidnow.png" width="50px" height="50px" alt="Bid" /> <span style="color: green;font-size: 20px"><b>Running</b></span> </a>
<?php
$break++;
echo "<hr>";
echo'</td>';
}
}
?>
</table>
</body>
</html>