-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow.php
286 lines (264 loc) · 10.2 KB
/
show.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
<head>
<meta charset="utf-8">
<title>Recipe Hunt</title>
<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.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link href='https://fonts.googleapis.com/css?family=Bellefair ' rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Kite one ' rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Fresca ' rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Salsa ' rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Acme ' rel="stylesheet">
</head>
<body>
<?php
include('conn.php');
if (isset($_REQUEST['submit'])) {
?><style>
.hello {
visibility: hidden;
}
</style><?php
$hob = $_REQUEST['ch'];
if (sizeof($hob) == 0) {
} else {
?>
<script type="text/javascript">
function valthis() {
var checkBoxes = document.getElementsByClassName('ch');
var isChecked = false;
for (var i = 0; i < checkBoxes.length; i++) {
if (checkBoxes[i].checked) {
isChecked = true;
};
};
if (isChecked) {} else {
alert('Please, check at least one checkbox!');
}
}
alert("You have selected <?php echo sizeof($hob) ?> items");
</script>
<?php
$j = "";
for ($x = 0; $x < sizeof($hob); $x++) {
$j .= "$hob[$x]";
if ($x != sizeof($hob) - 1) {
$j .= ",";
}
}
$k = sizeof($hob);
$q = "select * from receipe r inner join connection i on i.r_id = r.r_id where i.i_id IN ($j) group by r.r_name HAVING COUNT(*) = $k";
$res = $conn->query($q);
if ($res) {
$chk = $res->num_rows;
if ($chk > 0) {
?>
<h2 align="center" style="color:blue;font-size: 60px;font-family:Perpetua;">Possible Recipes</h2>
<form action="" method="POST">
<p align="center" style="color:black;font-size: 20px;font-family:Perpetua">Select the recipe from the short listed ones to look upon.<br>Then click selected button.</p>
<div align="center">
<input type="submit" name="done" value="SELECTED" class="btn btn-success">
</div>
<?php
while ($fe = $res->fetch_object()) {
?>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-12" align="center">
<br>
<img class="img-rounded" src="<?php echo $fe->imagesrc; ?>" height="30%" width="30%">
<br>
</div>
</div>
<div class="row">
<div class="col-md-12" align="center">
<br>
<p style="color: red;font-size: 30px;font-weight:bold;font-family:Perpetua">
<input type="radio" name="recipe" value="<?php echo $fe->r_name; ?>">
<?php echo $fe->r_name; ?>
</p>
<br>
</div>
</div>
<div class="row">
<div class="col-md-12" align="center">
<br>
<p style="color: black;font-size: 20px;font-family:Perpetua">
<?php echo "INGREDIENTS: ";
echo $fe->ing; ?>
</p>
<br>
</div>
</div>
</div>
<?php if ($fe = $res->fetch_object()) { ?>
<div class="col-md-6">
<div class="row">
<div class="col-md-12" align="center">
<br>
<img class="img-rounded" src="<?php echo $fe->imagesrc; ?>" height="30%" width="30%">
<br>
</div>
</div>
<div class="row">
<div class="col-md-12" align="center">
<br>
<p style="color: red;font-size: 30px;font-weight:bold;width: 80%;margin-left:10%;font-family:Perpetua;background-image:url('https://wallpaperaccess.com/full/1526003.png');">
<input type="radio" name="recipe" value="<?php echo $fe->r_name; ?>">
<?php echo $fe->r_name; ?>
</p><br>
</div>
</div>
<div class="row" align="center">
<div class="col-md-12">
<br>
<p style="color: black;font-size: 20px;font-family:Perpetua">
<?php echo "INGREDIENTS: ";
echo $fe->ing; ?>
</p>
<br>
</div>
</div>
</div>
<?php } else {
break 1;
} ?>
</div>
</div>
</div>
<?php
}
?>
</form><?php
} else {
?><p align="center" style="color: black;font-size: 20px;font-family:Perpetua"><?php
echo "Sorry no recipe found.";
echo "<br />";
echo "Would you like to contribute your recipe to the site.";
?><a href='add.php'>Click here</a></p><?php
}
}
}
}
?>
<?php
include('conn.php');
if (isset($_REQUEST['done'])) {
?><style>
.hello {
visibility: hidden;
}
</style><?php
$has = $_REQUEST['recipe'];
$sq = "select * from receipe where r_name='$has'";
$rest = $conn->query($sq);
if ($rest) {
?><h2 align="center" style="color:blue;font-size:60px;font-family:Perpetua">Recipe Details</h2>
<p style="color:black;font-size:20px;font-family:Perpetua" align="center">Here are the details of recipe you wanted to know about.</p>
<?php
$fe = $rest->fetch_object();
?><center><img align="center" src="<?php echo $fe->imagesrc; ?>" style="border:10px solid;" class="img-rounded" height="40%" width="40%">
<br>
<figcaption align="center">
<h2 style="color:red;font-weight:bold;font-family:Perpetua"><?php echo $fe->r_name; ?></h2>
</figcaption><br><br><br>
<h3 style="color:blue;font-family:Perpetua"><?php
echo "INGREDIENTS REQUIRED";
echo "<br \>";
$tr = $fe->ing;
?></h3>
<h4 style="color:black;font-family:Salsa;"> <?php echo wordwrap($tr, 100, "<br>\n");
?></h4><br><br><br>
<h3 style="color:blue;font-family:Fresca;"> <?php
echo "INSTRUCTIONS TO FOLLOW";
echo "<br \>";
$str = $fe->STEPS; ?></h3>
<h4 style="color:black;font-family:Perpetua">
<?php
echo wordwrap($str, 100, "<br>\n");
?></h4><br><br><br>
<h3 style="color:blue;font-family:Perpetua"> <?php
echo "SOURCE OF RECEIPE";
echo "<br \>";
$wet = "select * from restaurant where res_id=$fe->res_id";
$team = $conn->query($wet);
if ($team) {
$tag = $team->fetch_object();
$rt = $tag->res_name;
?></h3>
<h4 style="color:black;font-family:Salsa;">
<?php
echo wordwrap($rt, 100, "<br>\n");
}
}
}
?>
<div class="hello">
<div>
<h2 align="center" style="font-family: 'Rufina';
font-style: normal;
font-weight: 400;
font-size: 68px;
line-height: 84px;
color: #DE448D;">Choose your ingredients</h2>
<p style="font-family: 'Verdana';
font-style: normal;
font-weight: 400;
font-size: 20px;
line-height: 32px;
text-align: center;
color: #000000;
">Need a recipe!<br>
Check off your ingredients below.<br>
Add a recipe if it's not here.<br><br></p>
</div>
<form action="" method="POST">
<?php
include('conn.php');
$sql = "select * from ingredient";
$re = $conn->query($sql);
if ($re) {
?><table align="center" class="table" style="width: 80%;margin-left:10%;"><?php
while ($fes = $re->fetch_object()) {
?>
<tr>
<td width="20%" style="color:#ffffff;font-family:Perpetua;font-size: 18px;font-weight:bold;background-image:url('https://wallpaperaccess.com/full/1526003.png') "><input type="checkbox" name="ch[]" value="<?php echo $fes->i_id; ?> ">
<?php
echo $fes->i_name;
?></td>
<?php if ($fes = $re->fetch_object()) { ?>
<td width="20%" style="color:#ffffff;font-family:Perpetua;font-size: 18px;font-weight:bold;background-image:url('https://wallpaperaccess.com/full/1526003.png')"><input type="checkbox" name="ch[]" value="<?php echo $fes->i_id; ?> ">
<?php
echo $fes->i_name;
} else {
break;
} ?></td>
<?php if ($fes = $re->fetch_object()) { ?>
<td width="20%" style="color:#ffffff;font-family:Perpetua;font-size: 18px;font-weight:bold;background-image:url('https://wallpaperaccess.com/full/1526003.png')"><input type="checkbox" name="ch[]" value="<?php echo $fes->i_id; ?> ">
<?php
echo $fes->i_name;
} else {
break;
}
}
} ?></td>
</tr>
<tr>
<td colspan="3" align="center" style="font-family: salsa;font-size: 18px;">
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</td>
</tr>
</table>
</form>
</div>
</body>