-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstore.php
More file actions
93 lines (66 loc) · 2.06 KB
/
store.php
File metadata and controls
93 lines (66 loc) · 2.06 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
<a href="index.html">Make a Listing</a>
<form action="search.php" method="post" enctype="multipart/form-data">
Find Things Faster<input type="text" maxlength="200" name="search"><br>
<input type="submit" name="submit" value="search">
</form>
<?php
$dir = "listings/";
// Open a directory, and read its contents
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
//echo "filename:" . $file . "<br>";
$link = $dir.$file;
$file = str_replace('.html', '', $file);
$dir2 = "listingimages/listings/".$file."/";
//echo "<br>".$dir2."</br>";
$title_file_name = $dir2."title.txt";
$price_file_name = $dir2."price.txt";
if($file != "."){
if($file != ".."){
$title_file = fopen($title_file_name , "r") or die("Hmm thats messed up");
$title = fgets($title_file);
fclose($title_file);
$price_file = fopen($price_file_name , "r") or die("Hmm thats messed up");
$price = fgets($price_file);
fclose($price_file);
}
}
if($file != "."){
if($file != ".."){
// Open a directory, and read its contents
if (is_dir($dir2)){
if ($dh2 = opendir($dir2)){
while (($file2 = readdir($dh2)) !== false){
if($file2 != "title.txt"){
if($file2 != "price.txt"){
if($file2 != "."){
if($file2 != ".."){
$image_dir = $dir2.$file2;
}
}
}
}
}
closedir($dh2);
}
}
}
}
if($file != "."){
if($file != ".."){
$html_contents =
<<<HTML
<h1><a href="$link">$title</a></h1>
<p>$$price</p>
<img src="$image_dir" width="120" height="80">
<hr>
HTML;
echo $html_contents;
}
}
}
closedir($dh);
}
}
?>