paulo@0: ' . "\n";
paulo@0:
paulo@0: closedir($dh);
paulo@0: }
paulo@0: }
paulo@0:
paulo@0: function browse($browse_dir, $thumbs_dir) {
paulo@0: include('../../../login.php');
paulo@0:
paulo@0: $database = 'pauloang_pics';
paulo@0:
paulo@0: $link = mysql_connect('localhost', $username, $password);
paulo@0: if (!$link)
paulo@0: die('Could not connect to MySQL server: ' . mysql_error());
paulo@0:
paulo@0: $db_selected = mysql_select_db($database, $link);
paulo@0: if (!$db_selected)
paulo@0: die('Could not select database: ' . mysql_error());
paulo@0:
paulo@0:
paulo@0: foreach ($_GET as $getKey => $getValue) {
paulo@0: if ($getKey == "id" && !empty($_GET[$getKey])) {
paulo@0: $dh = opendir($browse_dir);
paulo@0: if ($dh) {
paulo@0: while (($file = readdir($dh)) !== false) {
paulo@0: if (strncmp($file, ".", 1) != 0)
paulo@0: $files[] = $file;
paulo@0: }
paulo@0: }
paulo@0: closedir($dh);
paulo@0:
paulo@0: sort($files, SORT_NUMERIC);
paulo@0: for ($i = 0, $size = sizeof($files); $i < $size; $i++) {
paulo@0: if ($files[$i] == $getValue) {
paulo@0: if ($i > 0) {
paulo@5: echo '';
paulo@5: echo '';
paulo@0: echo '' . "\n";
paulo@0: }
paulo@0: if ($i < $size - 1) {
paulo@5: echo '';
paulo@5: echo '';
paulo@0: echo '' . "\n";
paulo@0: }
paulo@0: echo '
' . "\n";
paulo@5: echo '';
paulo@0: echo ' ';
paulo@0: echo '' . "\n";
paulo@0:
paulo@0: $query = 'SELECT * FROM '. basename(getcwd()) . ' WHERE id = "' . $getValue . '"';
paulo@0: $results = mysql_query($query);
paulo@0:
paulo@0: if ($results) {
paulo@0: $row = mysql_fetch_assoc($results);
paulo@0: $caption = $row['caption'];
paulo@0: echo '
' . $caption . '
' . "\n"; paulo@0: } paulo@0: paulo@0: break; paulo@0: } paulo@0: } paulo@0: break; paulo@0: } paulo@0: } paulo@0: } paulo@0: ?>