Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Galeria PHP, Kod działa offline, ale nie działa online
simon111
post
Post #1





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 11.10.2006

Ostrzeżenie: (0%)
-----


Witam

Zrobiłem sobie galerię internetową (nie ukrywam, że na podstawie jakiegoś tam skryptu). Otóż offline, gdy testuje stronkę na swoim kompie wszystko elegancko chodzi, natomiast po wrzuceniu na stronkę nie działają mi przyciski "dalej" i "wstecz", czy ktoś mógłby rzucić okiem co jest nie tak na poniższy kod. Bardzo proszę o pomoc w tej sprawie i z góry dziękuję za wszelkie sugestie.

  1. <?php
  2.  
  3. $pic_info_file="/naw_galer/pics1.txt";
  4.  
  5.  
  6.  
  7.  
  8. print "<CENTER>";
  9.  
  10.  
  11.  
  12.  if ( !file_exists($pic_info_file))
  13.  {
  14.        $dh = opendir( "galeria/absolut" );
  15.        while( $file = readdir( $dh ) )
  16.        {
  17.                if (    ereg("jpg$",$file) || ereg("JPG$",$file) ||
  18.                        ereg("jpeg$",$file) || ereg("JPEG$",$file) ||
  19.                        ereg("Jpg$",$file) || ereg("Jpeg$",$file) )
  20.                {
  21.                        $pic_info[] = $file;
  22.                }
  23.        }
  24.  }
  25.  else $pic_info=file("/naw_galer/pics.txt");
  26.  
  27.  
  28.  $number_of_pics = count ($pic_info);
  29.  if (($picture > $number_of_pics) || ($picture == $number_of_pics) || !$picture)
  30.    $picture = '0';
  31.  $item = explode (";", $pic_info[$picture]);
  32.  
  33.  
  34.  print "<b>$item[1]</b>";
  35.  
  36.  
  37.  $next = $picture + 1;
  38.  if ($picture > 0 ) $back = $picture - 1;
  39.  else $picture = '0';
  40.  
  41.  
  42.  print "<a href=$PHP_SELF?picture=$back><u>Wstecz</u></a>";
  43.  print "          ";
  44.  print "<a href=$PHP_SELF?picture=$next><u>Dalej</u></a><br>";
  45.  
  46.  
  47.  print "<br><img src='galeria/absolut/$item[0]' border='3' width='610px' height='410px'><br> <br>";
  48.  
  49.  
  50.  
  51. print "</CENTER></BODY></HTML>";
  52. ?>


Ten post edytował simon111 11.03.2009, 20:46:12
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
simon111
post
Post #2





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 11.10.2006

Ostrzeżenie: (0%)
-----


Dziękuję bardzo "wookieb" twój post bardzo mi pomógł.
Wkońcu galeria działa tak jak mi chodziło, zrobiłem to wprawdzie dość niezgrabnie (mam na myśli postać skryptu) i na pewno dałoby się to jeszcze zoptymalizować, no ale w końcu cel uświęca środki. Ostatecznie mój skrypt wygląda tak:

  1. <?php
  2.  
  3. $pic_info_file="/naw_galer/pics1.txt";
  4.  
  5.  
  6.  
  7. print "<CENTER>";
  8.  
  9.  
  10.  
  11.  if ( !file_exists($pic_info_file))
  12.  {
  13.        $dh = opendir( "galeria/absolut" );
  14.        while( $file = readdir( $dh ) )
  15.        {
  16.                if (    ereg("jpg$",$file) || ereg("JPG$",$file) ||
  17.                        ereg("jpeg$",$file) || ereg("JPEG$",$file) ||
  18.                        ereg("Jpg$",$file) || ereg("Jpeg$",$file) )
  19.                {
  20.                        $pic_info[] = $file;
  21.                }
  22.        }
  23.  }
  24.  else $pic_info=file("/naw_galer/pics.txt");
  25.  
  26.  
  27.  $number_of_pics = count ($pic_info);
  28.  if (($picture > $number_of_pics) || ($picture == $number_of_pics) || !$picture)
  29.    $picture = '0';
  30.  $item = explode (";", $pic_info[$picture]);
  31.  
  32.  
  33. $picture=$_GET['picture'];
  34.  
  35.  
  36.  $next = $picture + 1;
  37.  if ($picture > 0 ) $back = $picture - 1;
  38.  else $picture = '0';
  39.  
  40.  
  41.  
  42.  
  43. $results=$picture.'.jpg';
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  print "<a href=?picture=$back><u>Wstecz</u></a>";
  50.  print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ";
  51.  print "<a href=?picture=$next><u>Dalej</u></a><br>";
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  print "<br><img src='galeria/absolut/$results' border='3' width='610px' height='410px'><br>&nbsp;<br>";
  58.  
  59.  
  60.  
  61.  
  62.  
  63. print "</CENTER></BODY></HTML>";
  64. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 2.10.2025 - 20:11