Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: kasowanie...
Forum PHP.pl > Forum > Przedszkole
bronx
witam

od razu zapodaje skrypcik:

  1. <?php
  2. if ( $_POST ) {
  3.  
  4. $arrPlik = file( 'rotator/banery.php' );
  5. unset( $arrPlik[ $intN -] );
  6. $strPlik = implode(&#092;"\", $arrPlik);
  7. $resFile = fopen( 'rotator/banery.php', 'w' );
  8. fwrite( $resFile, $strPlik );
  9. fclose( $resFile );
  10.  
  11. echo &#092;"<center>baner został usunięty</center>\";
  12.  
  13. }
  14.  
  15. else
  16.  
  17. {
  18.  
  19.  
  20. $base=&#092;"rotator/banery.php\"; 
  21. $table=array_reverse(file($base)); 
  22. $max=count($table); 
  23.  
  24. echo &#092;"<center><form method=post name=form>\";
  25.  
  26. for ($i=0; $i<$max; $i++) { 
  27. $data=explode (&#092;"*|*\", $table[$i]); 
  28.  
  29. echo &#092;"<b>$data[1]</b><br><img src=\"rotator/gfx/$data[2]\" border=1 vspace=5><br><a href=\"$data[0]\">$data[0]</a><br><br>
  30.  
  31. <INPUT TYPE=hidden NAME=intN value=$i><INPUT TYPE=submit VALUE=Usun name=wyslij><br><br>&#092;"; 
  32.  
  33. } 
  34.  
  35. }
  36. ?>


ma on słuzyć do kasowania wybranej tablicy z pliku, jednak nie wiem czemu nie kasuje wybranej tylko pierwszą
dr_bonzo
A jaka wartosc ma $intN w tym miejscu?
unset( $arrPlik[ $intN -1 ] );
moze jest niezdefiniowana ?
dr_bonzo
Cytat
array file ( string filename [, int use_include_path [, resource context]])

Identical to readfile(), except that file() returns the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.