-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecipes.php
More file actions
32 lines (32 loc) · 1.07 KB
/
Copy pathrecipes.php
File metadata and controls
32 lines (32 loc) · 1.07 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
<?php
if (isset ( $_GET ['command'] ) && $_GET ['command'] === "showAll") {
$recipesArray = glob ( 'rImages/*' );
echo json_encode ( $recipesArray );
}
if (isset($_GET['text'])){
$id = $_GET['text'];
$path = "rText/".$_GET['text']. '.txt';
$output = "<div class = 'onereview'> <img src = rImages/". $id . ".jpg>
<p class = 'thedetails' >";
$file = fopen($path,"r");
while(! feof($file)) {
$output .= fgets($file)."<br>";
}
$output .= "</p></div><button class='back' id='fav' onclick='addToFavorites(". $id ."); return false;'>Add to Favorites</button></br><button class = 'back' onclick='showAll()'>Back</button>";
fclose($file);
echo ( $output );
}
if (isset($_GET['pop'])){
$id = $_GET['pop'];
$path = "rText/".$_GET['pop']. '.txt';
$output = "<div class = 'onereview'> <img src = rImages/". $id . ".jpg>
<div class = 'thedetails' >";
$file = fopen($path,"r");
while(! feof($file)) {
$output .= fgets($file)."<br>";
}
fclose($file);
$output .= "</div></div>";
echo ( $output );
}
?>