-
Notifications
You must be signed in to change notification settings - Fork 0
/
kart.php
470 lines (416 loc) · 15.1 KB
/
kart.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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
<?php
session_start();
$_SESSION['proid']=null;
if(!isset($_SESSION['cusid']))
{
$_SESSION['err'] = 4;
header("Location:cus_login.html");
}
$host = 'host=127.0.0.1';
$port = 'port=5432';
$dbname = 'dbname=ServiceKart';
$credential = 'user=postgres password=###alpha@@@123';
$session = pg_connect("$host $port $dbname $credential");
if($session)
{
}else
{
echo "<div class='alert alert-warning alert-dismissible' role='alert'>
<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button>
<strong>Database Error!</strong>
</div>";
}
$cus = $_SESSION['cusid'];
if(!empty($_REQUEST['prod']) && $_REQUEST['prod']!="")
{
$proid = $_REQUEST['prod'];
$testsql="select kart_pro_id from kart where kart_id=$cus";
$testexecute = pg_query($session,$testsql);
$testresult = pg_fetch_row($testexecute);
if($testresult[0] != $proid)
{
$sql = "insert into kart (kart_id,kart_pro_id) values ($cus,$proid)";
$result = pg_query($session,$sql);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Service Kart - Hire Expert On The GO!</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<style>
body {
padding-top: 70px;
/* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
}
.navbar-brand {
padding-top:10px;
padding-bottom: 0px;
padding-left: 1px;
padding-right: 0px;
}
.navbar-inverse .navbar-nav > li > a {
color: #ffffff;
}
.navbar-inverse {
background-color: #009688;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26);
border-color:#009688;
}
.h3, h3 {
font-size: 29px;
font-family: "Comic Sans MS";
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function showresult(str) {
if (str.length<2) {
document.getElementById("livesearch").innerHTML="";
return;
}
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
document.getElementById("livesearch").innerHTML=this.responseText;
}
}
xmlhttp.open("GET","livesearch.php?q="+str,true);
xmlhttp.send();
}
</script>
<style>
#livesearch
{
position: absolute;
width: auto;
background: white;
max-height: 200px;
overflow-y: auto;
border: 1px solid gray;
padding-left: 10px;
/*This is relative to the navbar now*/
left: 0;
right: 0;
top: 33px;
}
.form-control{
font-size: 16px;
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<a class="navbar-brand" href="#">
<img alt="Brand" src="favicon.ico">
<!-- for search bar-->
<li class="dropdown dropdown-lg">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Services <b class="caret"></b></a>
<ul class="dropdown-menu dropdown-menu-lg row">
<li class="col-sm-4">
<ul>
<li class="dropdown-header">Health & Fitness</li>
<li><a href="display_cat_pro.php?catid=1">Yoga Trainer At Home</a></li>
<li><a href="display_cat_pro.php?catid=2">Salon At Home</a></li>
<li><a href="display_cat_pro.php?catid=3">Fitness Trainer At Home</a></li>
<li><a href="#">Dietician</a></li>
<li><a href="display_cat_pro.php?catid=4">Physiotheraphy At Home</a></li>
<li><a href="display_cat_pro.php?catid=1">Yoga Classes At Studio</a></li>
<li class="divider"></li>
<li class="dropdown-header">Maintenance</li>
<li><a href="display_cat_pro.php?catid=5">AC Service And Repair</a></li>
<li><a href="display_cat_pro.php?catid=6">Laptop Repair</a></li>
<li><a href="display_cat_pro.php?catid=7">Mobile Repair</a></li>
<li><a href="display_cat_pro.php?catid=8">Doorstep Laundry</a></li>
<li><a href="display_cat_pro.php?catid=9">TV Repair</a></li>
<li><a href="display_cat_pro.php?catid=10">Water Purifier Repair</a></li>
</ul>
</li>
<li class="col-sm-4">
<ul>
<li class="dropdown-header">Wedding & Events</li>
<li><a href="display_cat_pro.php?catid=11">Wedding Photographer</a></li>
<li><a href="display_cat_pro.php?catid=12">Birthday Party planner</a></li>
<li><a href="display_cat_pro.php?catid=13">Bride Makeup Artist</a></li>
<li><a href="display_cat_pro.php?catid=14">Birthday Party Decorator</a></li>
<li><a href="display_cat_pro.php?catid=15">DJ</a></li>
<li><a href="display_cat_pro.php?catid=16">Bartender</a></li>
<li class="divider"></li>
<li class="dropdown-header">Home Care</li>
<li><a href="display_cat_pro.php?catid=17">Interior Designer</a></li>
<li><a href="display_cat_pro.php?catid=18">Carpenter</a></li>
<li><a href="display_cat_pro.php?catid=19">Plumber</a></li>
<li><a href="display_cat_pro.php?catid=20">Electrician</a></li>
<li><a href="display_cat_pro.php?catid=21">Pest Control</a></li>
<li><a href="display_cat_pro.php?catid=22">Construction & Renovation</a></li>
</ul>
</li>
<li class="col-sm-4">
<ul>
<li class="dropdown-header">Academic tutor</li>
<li><a href="display_cat_pro.php?catid=23">Class I-V</a></li>
<li><a href="display_cat_pro.php?catid=23">Class VI-VIII</a></li>
<li><a href="display_cat_pro.php?catid=23">Class IX-X</a></li>
<li class="divider"></li>
<li class="dropdown-header">Hobbies & Interest</li>
<li><a href="display_cat_pro.php?catid=24">Guitar Lesson at Home</a></li>
<li><a href="display_cat_pro.php?catid=25">Zumba Fitness Dance</a></li>
<li><a href="display_cat_pro.php?catid=26">Bollywood Dance Class</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="col-sm-6 col-md-6">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" onkeyup="showresult(this.value)" name="q" autocomplete='off'>
<ul id="livesearch"></ul>
<div class="input-group-btn"><button class="btn btn-default"><i class="glyphicon glyphicon-search"></i></button>
</div></div></form></div>
<ul class="nav navbar-nav navbar-right">
<?php
if(!isset($_SESSION['proid']))
{
echo "<li><a href='pro_login.html'><span class='glyphicon glyphicon-user'></span> Become a Professional</a></li>";
}
else
{
$proid = $_SESSION['proid'];
$sql = "select first_name,last_name from professional_signup where proID = $proid" ;
$result = pg_query($session,$sql);
if($row=pg_fetch_row($result))
{
echo "<li> <div class='dropdown nav navbar-nav'>
<button class='btn btn-default navbar-btn' type='button' id='dropdownMenu1' data-toggle='dropdown' ><span class='glyphicon glyphicon-user'></span> ".$row[0]." ".$row[1]."</a>
<span class='caret'> </span>
</button>
<ul class='dropdown-menu' aria-labelledby='dropdownMenu1'>
<li><a href='profile_professional.php'><span class='glyphicon glyphicon-user'></span> Profile</a></li>
<li><a href='edit_profile_professionals.php'><span class='glyphicon glyphicon-edit'></span> Edit Profile</a></li>
<li role='separator' class='divider'></li>
<li><a href='logout.php'><span class='glyphicon glyphicon-log-out'></span> Logout</a></li>
</ul>
</div></li>";
}
}
?>
<?php
if(!isset($_SESSION['cusid']))
{
echo "<li><a href='cus_login.html'><span class='glyphicon glyphicon-log-in'></span> Login/signup</a></li>";
}
else
{
$cusid = $_SESSION['cusid'];
$sql = "select first_name,last_name from customer_signup where custID = $cusid" ;
$result = pg_query($session,$sql);
if($row=pg_fetch_row($result))
{
echo "<li> <div class='dropdown nav navbar-nav'>
<button class='btn btn-default navbar-btn' type='button' id='dropdownMenu1' data-toggle='dropdown' ><span class='glyphicon glyphicon-user'></span> ".$row[0]." ".$row[1]."</a>
<span class='caret'> </span>
</button>
<ul class='dropdown-menu' aria-labelledby='dropdownMenu1'>
<li><a href='profile_customer.php'><span class='glyphicon glyphicon-user'></span> Profile</a></li>
<li><a href='edit_profile_customer.php'><span class='glyphicon glyphicon-edit'></span> Edit Profile</a></li>
<li role='separator' class='divider'></li>
<li><a href='logout.php'><span class='glyphicon glyphicon-log-out'></span> Logout</a></li>
</ul>
</div></li>";
}
}
?>
<li><a href="kart.php"> <span class="glyphicon glyphicon-shopping-cart"></span> Shopping Cart</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<?php include("errorlogic.php"); ?>
<!-- Page Content -->
<div class="container">
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-10 col-md-offset-1">
<table class="table table-hover">
<thead>
<tr>
<th>Service</th>
<th class="text-center">Fees</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php
$sql = "select kart_pro_id from kart where kart_id=$cus";
$result1 = pg_query($session,$sql);
$temp = 0;
$count = 0;
$service = "";
$proids =array();
while($kartroll = pg_fetch_row($result1))
{
$sql2 = "select first_name,last_name from professional_signup where proID = $kartroll[0]" ;
$sql3 = "select category,fee from professional_profile where proID=$kartroll[0]";
$result2 = pg_query($session,$sql2);
$result3 =pg_query($session,$sql3);
if($roller = pg_fetch_row($result2)){}
if($roller2 = pg_fetch_row($result3)){}
$sqlcat = "select category from categories where catID=$roller2[0]";
$ret=pg_query($session,$sqlcat);
if($rowcat=pg_fetch_row($ret))
{}
echo" <tr>
<td class='col-sm-8 col-md-6'>
<div class='media'>
<div class='media-body'>
<h4 class='media-heading'>".$rowcat[0]."</h4>
<h5 class='media-heading'> by ".$roller[0]." ".$roller[1]."</h5>
</div>
</div></td>
<td class='col-sm-1 col-md-1 text-center'><strong>".$roller2[1]."</strong></td>
<td class='col-sm-1 col-md-1'>
<a href='remove.php?prod=".$kartroll[0]."' class='btn btn-danger'>
<span class='glyphicon glyphicon-remove'></span> Remove
</a></td>
</tr>";
$temp+=$roller2[1];
$service = $service." ".$rowcat[0];
$proids[$count]=$kartroll[0];
$count +=1;
}
echo "<tr>
<td> </td>
<td><h3>Total</h3></td>
<td class='text-right'><h3><strong>Rs ".$temp."</strong></h3></td>
</tr>";
$_SESSION['kart_total']=$temp;
$_SESSION['kart_count'] = $count;
$_SESSION['kart_service'] = $service;
$_SESSION['proids'] = $proids;
?>
<tr>
<td> </td>
<td>
<a href="homepage.php" class="btn btn-default">
<span class="glyphicon glyphicon-shopping-cart"></span> Continue Shopping
</a></td>
<td>
<a href="checkout.php" class="btn btn-success">
Checkout <span class="glyphicon glyphicon-play"></span>
</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">Payment Note</div>
<div class="panel-body">
All the payment are made with cash. Make the payment to the professionals when they come to deliver the services.
</div>
</div>
</div>
<!-- /.container -->
<!-- jQuery Version 1.11.1 -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<style>
.dropdown-menu-lg {
width: 600px;
padding: 20px 0px;
}
.dropdown-menu-lg > li > ul {
padding: 0;
margin: 0;
}
.dropdown-menu-lg > li > ul > li {
list-style: none;
}
.dropdown-menu-lg > li > ul > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
color: #333333;
white-space: normal;
}
.dropdown-menu-lg > li ul > li > a:hover,
.dropdown-menu-lg > li ul > li > a:focus {
text-decoration: none;
color: #262626;
background-color: #f5f5f5;
}
.dropdown-menu-lg .disabled > a,
.dropdown-menu-lg .disabled > a:hover,
.dropdown-menu-lg .disabled > a:focus {
color: #999999;
}
.dropdown-menu-lg .disabled > a:hover,
.dropdown-menu-lg .disabled > a:focus {
text-decoration: none;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
cursor: not-allowed;
}
.dropdown-menu-lg .dropdown-header {
color: #428bca;
font-size: 18px;
}
@media (max-width: 768px) {
.dropdown-menu-lg {
margin-left: 0 ;
margin-right: 0 ;
}
.dropdown-menu-lg > li {
margin-bottom: 30px;
}
.dropdown-menu-lg > li:last-child {
margin-bottom: 0;
}
.dropdown-menu-lg .dropdown-header {
padding: 3px 15px !important;
}
}
.navbar-form .input-group .input-group-btn {
width:1%;}
</style>
</body>
</html>