Mercurial > hg > index.fcgi > www > www-1
view pics/common.php @ 123:b2aebd4994ea
myrss2: update FEEDS again to remove The Browser
author | paulo |
---|---|
date | Thu, 25 Mar 2021 00:23:17 -0700 |
parents | 2ede1c948f35 |
children |
line source
1 <?php
2 $thumbs_dir = "thumbs/";
3 $browse_dir = "browse/";
5 function listThumbs($thumbs_dir) {
6 $dh = opendir($thumbs_dir);
7 if ($dh) {
8 while (($file = readdir($dh)) !== false) {
9 if (strncmp($file, ".", 1) != 0)
10 $files[] = $file;
11 }
13 sort($files, SORT_NUMERIC);
14 foreach ($files as $file)
15 echo '<A HREF="browse.php?id=' . $file . '" NAME="' . $file . '"><IMG SRC="' . $thumbs_dir . $file . '"></A> ' . "\n";
17 closedir($dh);
18 }
19 }
21 function browse($browse_dir, $thumbs_dir) {
22 include('../../../login.php');
24 $database = 'pauloang_pics';
26 $link = mysql_connect('localhost', $username, $password);
27 if (!$link)
28 die('Could not connect to MySQL server: ' . mysql_error());
30 $db_selected = mysql_select_db($database, $link);
31 if (!$db_selected)
32 die('Could not select database: ' . mysql_error());
35 foreach ($_GET as $getKey => $getValue) {
36 if ($getKey == "id" && !empty($_GET[$getKey])) {
37 $dh = opendir($browse_dir);
38 if ($dh) {
39 while (($file = readdir($dh)) !== false) {
40 if (strncmp($file, ".", 1) != 0)
41 $files[] = $file;
42 }
43 }
44 closedir($dh);
46 sort($files, SORT_NUMERIC);
47 for ($i = 0, $size = sizeof($files); $i < $size; $i++) {
48 if ($files[$i] == $getValue) {
49 if ($i > 0) {
50 echo '<A HREF="browse.php?id=' . $files[$i - 1] . '" ID="prev" accesskey="p">';
51 echo '<IMG SRC="' . $thumbs_dir . $files[$i - 1] . '">';
52 echo '</A>' . "\n";
53 }
54 if ($i < $size - 1) {
55 echo '<A HREF="browse.php?id=' . $files[$i + 1] . '" ID="next" accesskey="n">';
56 echo '<IMG SRC="' . $thumbs_dir . $files[$i + 1] . '">';
57 echo '</A>' . "\n";
58 }
59 echo '<br>' . "\n";
60 echo '<A HREF="./index.php#' . $files[$i] . '" ID="up" accesskey="u">';
61 echo '<IMG SRC="' . $browse_dir . $files[$i] . '"> ';
62 echo '</A>' . "\n";
64 $query = 'SELECT * FROM '. basename(getcwd()) . ' WHERE id = "' . $getValue . '"';
65 $results = mysql_query($query);
67 if ($results) {
68 $row = mysql_fetch_assoc($results);
69 $caption = $row['caption'];
70 echo '<P>' . $caption . '</P>' . "\n";
71 }
73 break;
74 }
75 }
76 break;
77 }
78 }
79 }
80 ?>