-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmywebapp.php
More file actions
40 lines (31 loc) · 1 KB
/
Copy pathmywebapp.php
File metadata and controls
40 lines (31 loc) · 1 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
<html>
<form action='mywebapp.php' method='get'>
<p> Disease: <input type='text' name='disease' /> </p>
<p><input type='submit' /> </p>
</form>
<p>Abstracts about the disease <?php echo htmlspecialchars($_GET['disease']); ?>:</p>
<?php
$filename = $_GET['disease']."Links.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
$links = explode("\n",$contents);
fclose($handle);
$filename = $_GET['disease']."Titles.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
$titles = explode("\n",$contents);
fclose($handle);
$c=array_combine($links,$titles);
foreach ($c as $key => $value) {
echo '<a href="' . $key . '">' . $value . '</a></br>';
}
$filename = $_GET['disease']."Photos.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
$photos = explode("\n",$contents);
fclose($handle);
foreach ($photos as $p) {
echo '<a href="'. $p .'"><img src="'. $p .'" /></a></br>';
}
?>
</html>