-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreview.php
More file actions
148 lines (134 loc) · 4.96 KB
/
Copy pathreview.php
File metadata and controls
148 lines (134 loc) · 4.96 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
<?php
session_start();
require 'db.php';
$pid = $_GET['pid'];
?>
<!DOCTYPE html>
<html>
<head>
<title>AgriLink: Product</title>
<meta lang="eng">
<meta charset="UTF-8">
<title>AgriLink</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="bootstrap\css\bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="bootstrap\js\bootstrap.min.js"></script>
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-layers.min.js"></script>
<script src="js/init.js"></script>
<link rel="stylesheet" href="Blog/commentBox.css" />
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-xlarge.css" />
</noscript>
</head>
<body>
<?php
require 'menu.php';
$sql="SELECT * FROM fproduct WHERE pid = '$pid'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$fid = $row['fid'];
$sql = "SELECT * FROM farmer WHERE fid = '$fid'";
$result = mysqli_query($conn, $sql);
$frow = mysqli_fetch_assoc($result);
$picDestination = "images/productImages/".$row['pimage'];
// Check if current user is the product owner
$isProductOwner = isset($_SESSION['id']) && $_SESSION['Category'] == 1 && $_SESSION['id'] == $fid;
?>
<section id="main" class="wrapper style1 align-center">
<div class="container">
<div class="row">
<div class="col-sm-4">
<img class="image fit" src="<?php echo $picDestination.'';?>" alt="" />
</div><!-- Image of farmer-->
<div class="col-12 col-sm-6">
<p style="font: 50px Times new roman;"><?= $row['product']; ?></p>
<p style="font: 30px Times new roman;">Product Owner : <?= $frow['fname']; ?></p>
<p style="font: 30px Times new roman;">Price : <?= $row['price'].' /-'; ?></p>
<p style="font: 30px Times new roman;">Available Quantity : <?= $row['quantity'].' units'; ?></p>
</div>
</div><br />
<div class="row">
<div class="col-12 col-sm-12" style="font: 25px Times new roman;">
<?= $row['pinfo']; ?>
</div>
</div>
</div>
<br /><br />
<div class="12u$">
<center>
<div class="row uniform">
<?php if (!$isProductOwner): ?>
<div class="12u$">
<a href="addToCart.php?pid=<?= $pid; ?>" class="btn btn-primary" style="text-decoration: none;"><span class="glyphicon glyphicon-shopping-cart"> AddToCart</a>
</div>
<?php else: ?>
<div class="12u$">
<p style="color: red;">You cannot buy or rate your own product</p>
</div>
<?php endif; ?>
</div>
</center>
</div>
<div class="container">
<h1>Product Reviews</h1>
<div class="row">
<?php
$sql = "SELECT * FROM review WHERE pid='$pid'";
$result = mysqli_query($conn, $sql);
?>
<div class="col-0 col-sm-3"></div>
<div class="col-12 col-sm-6">
<?php
if($result) :
while($row1 = $result->fetch_array()) :
?>
<div class="con">
<div class="row">
<div class="col-sm-4">
<em style="color: black;"><?= $row1['comment']; ?></em>
</div>
<div class="col-sm-4">
<em style="color: black;"><?php echo "Rating : ".$row1['rating'].' out of 10';?></em>
</div>
</div>
<span class="time-right" style="color: black;"><?php echo "From: ".$row1['name']; ?></span>
<br /><br />
</div>
<?php endwhile; endif;?>
</div>
</div>
</div>
<?php
?>
<div class="container">
<?php if (!$isProductOwner): ?>
<p style="font: 20px Times new roman; align: left;">Rate this product</p>
<form method="POST" action="reviewInput.php?pid=<?= $pid; ?>">
<div class="row">
<div class="col-sm-7">
<textarea style="background-color:white;color: black;" cols="5" name="comment" placeholder="Write a review"></textarea>
</div>
<div class="col-sm-5">
<br />
Rating: <input type="number" min="0" max="10" name="rating" value="0"/>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<br />
<input type="submit" />
</div>
</div>
</form>
<?php endif; ?>
</div>
</body>
</html>