-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreview.php
173 lines (151 loc) · 6.67 KB
/
review.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
<?php
$con = mysqli_connect("localhost", "root", "", "minor2");
session_start();
$userprofile = $_SESSION['username'];
if($userprofile)
{
}
else
{
header("location:login.php");
}
// for profile pic
$Query = "select * from users where user_name = '$userprofile'";
$runQuery = mysqli_query($con, $Query);
$data = mysqli_fetch_assoc($runQuery);
$profile_pic = $data['user_profile_picture'];
$username = $data['user_name'];
$userID = $data['user_id'];
if(isset($_POST['submit_review']))
{
$review_body = $_POST['user_review'];
$review_date = date('d-m-y');
$review_owner_id = $userID;
$insert_query = "insert into reviews (review_body, review_date, review_owner_id) values ('$review_body', '$review_date', '$review_owner_id')";
$run_insert_query = mysqli_query($con, $insert_query);
if($run_insert_query)
{
echo "<script>alert('review added successfully');</script>";
}
else{
echo "<script>alert('Unable to add Review');</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto ml-5">
<li class="nav-item active ml-5">
<a class="btn btn-danger" role="button" href="logout.php">Logout <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active ml-5">
<a class="nav-link" href="index.php">Home<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active ml-3">
<a class="nav-link" href="contact.php">Contact Us <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active ml-3">
<a class="nav-link" href="dashboard.php">Back<span class="sr-only">(current)</span></a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0 mr-5" action="" method="POST">
<input class="form-control mr-sm-2 " type="search" name='search_area' placeholder="Search" aria-label="Search">
<button class="btn btn-success my-2 my-sm-0 mr-5" name='search_btn' type="submit">Search</button>
</form>
<input id="mode" type="button" class="btn btn-light" value="Dark-Mode" onclick="change()">
</div>
</nav>
<?php
if(isset($_POST['search_btn']))
{
$search_result = $_POST['search_area'];
header("location:search.php?search_result=".$search_result);
}
?>
<br><br><br>
<div class="container-fluid">
<div class="row ">
<div class="col-sm-4 text-center" >
<?php echo"<img width='230' height='230' src='user_images/$profile_pic' alt='profile_pic' style='border-radius: 130px;'>" ?>
<h3 class="mt-5 mb-5" style="font-family:Stencil;"><?php echo $userprofile;?></h3>
<a href="view_account_details.php" class="nav-link"><h5>View Account Details</h5></a>
<a href="edit_Account_details.php" class="nav-link mt-1"><H5>Edit Account Details</h5></a>
<a href="insert_product.php" class="nav-link mt-1"><H5>Share a product</h5></a>
<a href="dashboard.php" class="nav-link mt-1"><H5>Back</h5></a>
</div>
<div class="col-sm-8 text-center">
<div class="container review text-center">
<h2>Ratings & Reviews</h2>
<img src="images/rnr.jfif" alt="rating&review" height=150>
<p>We like to welcome your reviews and opinions Here.<br>Rate Us on the Basis of your experience with Us</p>
</div>
<br>
<form action="" method="POST" class="text-center">
<div class="form-group" class="fixed-middle">
<input type="text" class="form-control text-center" placeholder="Write your Review" name="user_review" style="border:3px solid #ddd;" autocomplete="off" required>
<button class="btn btn-primary mt-3" name="submit_review">Submit Review</button>
</div>
</form>
<br>
<div class="container user_reviews mt-4">
<?php
$con = mysqli_connect("localhost", "root", "", "minor2");
$review_query = "select * from reviews order by review_id desc";
$run_review_query = mysqli_query($con, $review_query);
while($show_data = mysqli_fetch_array($run_review_query))
{
$show_review_owner_id = $show_data['review_owner_id'];
$user_query = "select * from users where user_id = '$show_review_owner_id'";
$run_user_query = mysqli_query($con, $user_query);
$user_data = mysqli_fetch_array($run_user_query);
$show_profile_pic = $user_data['user_profile_picture'];
$show_username = $user_data['user_name'];
$show_review_body = $show_data['review_body'];
$show_review_date = $show_data['review_date'];
echo "
<div class='card user_review' style='margin-right:20%;'>
<div class='row mb-5'>
<div class='col-sm-4'>
<img src='user_images/$show_profile_pic' alt='' height=100 style='border-radius:500px;margin-left:3%;'>
</div>
<div class='col-sm-8'>
<h4><B>$show_username</B></h4>
<p style='font-family:comic sans MS;'>$show_review_body</p>
<small style='font-family:verdana;'> added on $show_review_date</small>
</div>
</div>
<br>
</div>
";
}
?>
</div>
<br><br><br>
</div>
</div>
<a href="chat_page.php"><img src="images/chat.png" class="fixed-bottom mb-3 ml-3" alt="chat-icon" width=100></a>
<script src="js/dark-mode.js"></script>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function()
{
$("body").animate({opacity:'1'}, 2000);
});
</script>
</body>
</html>