Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] PHP
RKP
post 30.09.2008, 18:27:12
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 30.09.2008

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


Błąd w linijkach 18 i 23. Pomóżcie...
  1. <?php
  2.    $dir   = $_GET["folder"];
  3.    $photo = $_GET["photo"];
  4.  
  5.    include("folderlib.php");
  6.    $files =  file_list("gallery/" .$dir ."/640x480/",false);
  7.    function cmp($a, $b)
  8.    {
  9.        preg_match("/([^d]+)([d]+)(.+)/", $a, $matches_a);
  10.        preg_match("/([^d]+)([d]+)(.+)/", $b, $matches_b);
  11.  
  12.        if(strcmp($matches_a[1], $matches_b[1])==0)
  13.        {
  14.            if($matches_a[2]!=$matches_b[2]) return $matches_a[2]-$matches_b[2];
  15.            return strcmp($matches_a[3], $matches_b[3]);
  16.        }
  17.        return strcmp($matches_a[1], $matches_b[1]);
  18.    }
  19.    usort($files,cmp);
  20.  
  21.    //print_r($files);
  22.    //print '<br />' .$photo;
  23.    $__length = count($files);
  24.    $__curent = array_search($photo,$files);
  25.  
  26.    if($__curent>0)
  27.    {
  28.        $prev = '<a href="?folder=' .$folder .'&photo=' .$files[($__curent-1)] .'">';
  29.        $prev .= '<img src="images/poprzednie.gif" alt="poprzedni" border="0">';
  30.        $prev .= '</a>';
  31.    }
  32.    if($__curent<$__length-1)
  33.    {
  34.        $next = '<a href="?folder=' .$folder .'&photo=' .$files[($__curent+1)] .'">';
  35.        $next .= '<img src="images/nastepne.gif" alt="">';
  36.        $prev .= '</a>';
  37.    }
  38.  
  39. ?>
  40. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "htt://www.w3.org/TR/html4/loose.dtd">
  41.  
  42. <html>
  43. <head>
  44.  
  45. <title>Galeria - Nutka</title>
  46.  
  47. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
  48. <meta name="Keywords" content="nutka zdjecia">
  49. <meta name="Description" content="Niebuliczne przedszkole Nutka">
  50. <meta name="Author" content="info@info-lab.waw.pl">
  51. <meta name="Robots" content="ALL">
  52. <link rel="stylesheet" type="text/css" href="style.css" />
  53.  
  54. </head>
  55. <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
  56.  
  57. <table border="0" class="tab_center" cellspacing="0" cellpadding="10">
  58. <tr>
  59.    <td>
  60.        <img src="images/slonko_gal.gif" alt=""></td>
  61.    <td>
  62.        <img src="images/hmurka1.gif" alt=""></td>
  63.    <td>
  64.        <img src="images/hmurka2.gif" alt=""></td>
  65. </tr>
  66.  
  67. <?php
  68.  
  69. print '<tr>
  70.    <td>';
  71. print $prev;
  72. print '</td><td>';
  73.        //<div class="center"><img src="images/zamknij_galerie.gif" alt=""></div>
  74. print '</td><td>';
  75. print $next;
  76. print '</td></tr>';
  77.  
  78. ?>
  79.  
  80. <tr>
  81.    <td>
  82.        &nbsp;</td>
  83.    <td>
  84.    <?php
  85.  
  86.  
  87.        print '<img src="gallery/' .$dir ."/640x480/" .$photo .'" alt="">';
  88.        //<img src="galeria/fotka.jpg" alt="">
  89.    ?>
  90.  
  91.    </td>
  92.  
  93.    <td>
  94.        &nbsp;</td>
  95. </tr>
  96.  
  97. </table>
  98.  
  99.  
  100. </BODY>
  101. </HTML>


Ten post edytował webdice 30.09.2008, 20:57:24
Go to the top of the page
+Quote Post
jareeny
post 30.09.2008, 18:31:38
Post #2





Grupa: Zarejestrowani
Postów: 226
Pomógł: 23
Dołączył: 2.10.2007
Skąd: Słupsk

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


Kod daj w odpowiednie znaczniki bbcode i podaj treść błędów.


--------------------
banan wszyscy.
Go to the top of the page
+Quote Post
RKP
post 30.09.2008, 18:49:10
Post #3





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 30.09.2008

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


Trochę cię nie rozumiem. Na górze dałem cały kod a błędy to są dwie pogrubione linijki...
Go to the top of the page
+Quote Post
marcin_sobota
post 30.09.2008, 18:53:17
Post #4





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 27.09.2008

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


chodzi im o to ze post musi byc wpisany zgodnie z regulaminem bo inaczej nie bedzie odpowiedzi poza tym na forum musi byc pozadek ;-)
Go to the top of the page
+Quote Post
jareeny
post 30.09.2008, 18:58:23
Post #5





Grupa: Zarejestrowani
Postów: 226
Pomógł: 23
Dołączył: 2.10.2007
Skąd: Słupsk

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


No dobra, jeżeli nie chcesz podać treści błędów to chociaż wstaw ten kod strony między znaczniki [*php] [*/php] (gwiazdki usuń) żeby można go było jakoś przeczytać i Ci pomóc winksmiley.jpg


--------------------
banan wszyscy.
Go to the top of the page
+Quote Post
RKP
post 30.09.2008, 19:05:36
Post #6





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 30.09.2008

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


Zrobione pomożesz?
Go to the top of the page
+Quote Post
jareeny
post 30.09.2008, 19:18:25
Post #7





Grupa: Zarejestrowani
Postów: 226
Pomógł: 23
Dołączył: 2.10.2007
Skąd: Słupsk

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


No i gdzie masz ten kod? było wyraźnie napisane, usuń gwiazdki... najlepiej przeczytaj regulamin forum.


--------------------
banan wszyscy.
Go to the top of the page
+Quote Post
RKP
post 30.09.2008, 20:26:51
Post #8





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 30.09.2008

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


Poprawiłem. Źle edytowałem wcześniej sorki.
Go to the top of the page
+Quote Post
jareeny
post 30.09.2008, 20:36:27
Post #9





Grupa: Zarejestrowani
Postów: 226
Pomógł: 23
Dołączył: 2.10.2007
Skąd: Słupsk

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


Co to za funkcja file_list(); w manualu jej nie ma. Na prawdę przydałyby się te treści błędów, tzn. to, co wypisuje Ci na ekranie, kiedy próbujesz odpalić stronke


--------------------
banan wszyscy.
Go to the top of the page
+Quote Post
RKP
post 30.09.2008, 20:52:41
Post #10





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 30.09.2008

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


oto treść błędów:

Warning: usort() [function.usort]: The argument should be an array in /home/nutka/ftp/show_photo.php on line 19

Warning: array_search() [function.array-search]: Wrong datatype for second argument in /home/nutka/ftp/show_photo.php on line 24


Poniżej dodaję jeszcze jeden plik php być może oto chodzi (folderlib.php)

  1. <?php
  2.  
  3. if(!function_exists("getSuffix")){
  4.    function getSuffix($f)
  5.    {
  6.        $n = strrpos($f,".")+1;
  7.        return substr($f,$n,strlen($f)-$n);
  8.    }}
  9.  
  10. if(!function_exists("checkDir")){
  11.    function checkDir($dir)
  12.    {
  13.        global $filemask,$curr_dir;
  14.        if ($handle = opendir($curr_dir."/".$dir)) {
  15.        while (false !== ($file = readdir($handle))) {
  16.            if ($file != "." && $file != "..") {
  17.                if(@ filetype($file) != "dir")    {
  18.                    if(isset($filemask)) {
  19.                        foreach($filemask as $sufix) if(getSuffix($file)==$sufix) { return true; break; }
  20.                    }
  21.                    else return true;;
  22.                }
  23.            }
  24.        }
  25.   closedir($handle);
  26.     }
  27.     return false;
  28.    }}
  29.  
  30. if(!function_exists("file_list")){
  31. function file_list($folder, $filemask)
  32. {
  33.    unset($ret);
  34.    if(is_dir($folder))    {
  35.        if ($handle = opendir($folder)) {
  36.        while (false !== ($file = readdir($handle))) {
  37.            if ($file != "." && $file != "..") {
  38.                if(@ filetype($file) != "dir")    {
  39.                    if($filemask!==false) {
  40.                        foreach($filemask as $sufix) if(strtolower(getSuffix($file))==strtolower($sufix)) { $ret[] = $file; break; print "OK";}
  41.                    }
  42.                    else $ret[] = $file;
  43.                }
  44.            }
  45.        }
  46.   closedir($handle);
  47.     }
  48.    }
  49.    return $ret;
  50. }}
  51.  
  52. if(!function_exists("file_size_KB")){
  53. function file_size_KB($size, $floor="", $prefix="")
  54. {
  55.    $prefixy[""] = "k";
  56.    $prefixy["k"] = "M";
  57.    $prefixy["M"] = "G";
  58.  
  59.    if($size > 1024)
  60.        return file_size_KB(floor($size/1024), ".".$size%1024, $prefixy[$prefix]);
  61.    else
  62.        return $size . $floor . " ". $prefix."B";
  63. }}
  64.  
  65. if(!function_exists("file_size")){
  66. function file_size($file)
  67. {
  68.    $size = @filesize($file);
  69.    return file_size_KB($size,"","");
  70. }
  71. }
  72.  
  73.  
  74. ?>



Ten post edytował RKP 30.09.2008, 20:55:58
Go to the top of the page
+Quote Post
webdice
post 30.09.2008, 20:56:50
Post #11


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Nie wiem co wraca Twoja funkcja file_list, ale zapewne nie jest to tablica. Co do drugiego błędu to zapraszam do manual'a.

P.S. Proszę poprawić tytuł tematu, tytuł ma opisywać problem. Poza tym przenoszę na Przedszkole oraz dodaje tag.
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 8.07.2025 - 05:56