phpbar.de logo

Mailinglisten-Archive

[php] php leerzeichen in readfile

[php] php leerzeichen in readfile

Listor, Listornet listor_(at)_listornet.de
Tue, 7 Dec 1999 23:17:08 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_0179_01BF4109.2EBFB510
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi liste

also ich hab mal ein php geschrieben. wenn ich es ausf=FChre und er =
alles gemacht hat lie=DFt er mit ner for schleife einen array von einer =
datei aus. in dem array stehen dateinamen. in jeder zeile eine. diese =
dateinamen sollen mit readfile("text.txt"); ausgelesen werden. das php =
macht mir sobald in dem array txtfile eine neue zeile ist in den =
readfile befehl am ende ein leerzeichen readfile("text.txt ");=20
so kann er die datei nicht lesen vielleicht kann mir jemand sagen wie =
ich das mache oder mir schnell helfen w=E4re nett thx

<?php

  $abc =3D =
array("1"=3D>"a","2"=3D>"b","3"=3D>"c","4"=3D>"d","5"=3D>"e","6"=3D>"f","=
7"=3D>"g","8"=3D>"h","9"=3D>"i",
  =
"10"=3D>"j","11"=3D>"k","12"=3D>"l","13"=3D>"m","14"=3D>"n","15"=3D>"o","=
16"=3D>"p","17"=3D>"q","18"=3D>"r",
  =
"19"=3D>"s","20"=3D>"t","21"=3D>"u","22"=3D>"v","23"=3D>"w","24"=3D>"x","=
25"=3D>"y","26"=3D>"z"); =20
  srand((double)time()*10);
  $i  =3D rand(1,8);
  $i1 =3D rand($i,9);
  $i2 =3D rand(10,99);
  $i3 =3D rand(10,99);
  $t  =3D rand(1,26);
  $t1 =3D rand(1,26);
  $t2 =3D rand(1,26);
  $tfn =3D $i1 . "$abc[$t]" . $i2 . "$abc[$t1]" . $i3 . "$abc[$t2]" . $i =
. $lngn . ".txt";
  $zeilenarray =3D file("../public/mf/mfdb.ldb");

  echo "<form method=3D'post'>\n";
  echo "<textarea cols=3D'30' rows=3D'5' name=3D'ttext' ></textarea>\n";
  echo "<br><br>\n";
  echo "</td>\n\n";
  echo "</tr><tr>\n\n";
  echo "<td width=3D'20%' >\n</td>\n";
  echo "<td align=3D'center' valign=3D'top'>\n";
  echo "<input style=3D'font:8pt;' type=3D'submit' =
value=3D'Eintragen'>\n";
  echo "</td>\n"; =20
  echo "<td align=3D'center' valign=3D'top'>\n";
  echo "<input style=3D'font:8pt;' type=3D'reset' =
value=3D'Zur&uuml;cksetzen'>\n";
  echo "<input type=3D'hidden' value=3D'$lngn'>\n"; =20
  echo "<td width=3D'20%' >\n</td>\n";
  echo "</form>\n";  =09

  if (isset($ttext))
   {
    if ($ttext =3D=3D "")
     {}
    else
     {
      $rem =3D fopen("../public/mf/$tfn","w+");
       while (!feof($rem))
        {
         $zeile =3D fgets($rem,4096);
        }
       fwrite($rem, $ttext); =20
       fclose($rem);

      $mfdb =3D fopen("../public/mf/mfdb.ldb","r+");
       while (!feof($mfdb))
        {
         $zeile =3D fgets($mfdb,1024);
         echo $zeile;
        }
       fwrite($mfdb, $tfn);
       fwrite($mfdb, "\n");     =20
       fclose($mfdb);     =09

      =20
     }
   } =09


  for ($r=3D0; $r<sizeof($zeilenarray); $r++)
       {
   # ereg("",$zeilenarray[$r]);
   =20
    readfile("../public/mf/$zeilenarray[$r]");=20
    echo "<br><br>";                     =20
        }

  $file =3D fopen("../public/mf/mfdb.ldb", "r");
    if (!$file) {
      echo "<p>Unable to open remote file.\n";
      exit;
    }
    while (!feof($file)) {
      $line =3D fgets($file, 1024);
      echo $line;       =20
      }
 =20
  fclose($file);

?>


mfg,
cu_(at)_listor

------=_NextPart_000_0179_01BF4109.2EBFB510
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">






hi=20 liste
 
also ich hab mal ein php = geschrieben. wenn ich=20 es ausführe und er alles gemacht hat ließt er mit ner for = schleife=20 einen array von einer datei aus. in dem array stehen dateinamen. in = jeder zeile=20 eine. diese dateinamen sollen mit readfile("text.txt"); = ausgelesen=20 werden. das php macht mir sobald in dem array txtfile eine neue zeile = ist in den=20 readfile befehl am ende ein leerzeichen readfile("text.txt "); =
so kann er die datei nicht lesen = vielleicht kann=20 mir jemand sagen wie ich das mache oder mir schnell helfen wäre = nett=20 thx
 
<?php
 
  $abc =3D=20 array("1"=3D>"a","2"=3D>"b"= ,"3"=3D>"c","4"=3D>"d",&quo= t;5"=3D>"e","6"=3D>"f","7&q= uot;=3D>"g","8"=3D>"h","9"=3D= >"i",
 =20 "10"=3D>"j","11"=3D>"k",&qu= ot;12"=3D>"l","13"=3D>"m","= 14"=3D>"n","15"=3D>"o","16&= quot;=3D>"p","17"=3D>"q","18&quo= t;=3D>"r",
 =20 "19"=3D>"s","20"=3D>"t",&qu= ot;21"=3D>"u","22"=3D>"v","= 23"=3D>"w","24"=3D>"x","25&= quot;=3D>"y","26"=3D>"z"); =20
  srand((double)time()*10);
  $i  =3D = rand(1,8);
 =20 $i1 =3D rand($i,9);
  $i2 =3D rand(10,99);
  $i3 =3D=20 rand(10,99);
  $t  =3D rand(1,26);
  $t1 =3D=20 rand(1,26);
  $t2 =3D rand(1,26);
  $tfn =3D $i1 .=20 "$abc[$t]" . $i2 . "$abc[$t1]" . $i3 . = "$abc[$t2]"=20 . $i . $lngn . ".txt";
  $zeilenarray =3D=20 file("../public/mf/mfdb.ldb");
 
  echo "<form=20 method=3D'post'>\n";
  echo "<textarea = cols=3D'30' rows=3D'5'=20 name=3D'ttext' ></textarea>\n";
  echo=20 "<br><br>\n";
  echo=20 "</td>\n\n";
  echo=20 "</tr><tr>\n\n";
  echo "<td = width=3D'20%'=20 >\n</td>\n";
  echo "<td align=3D'center'=20 valign=3D'top'>\n";
  echo "<input = style=3D'font:8pt;'=20 type=3D'submit' value=3D'Eintragen'>\n";
  echo=20 "</td>\n"; 
  echo "<td = align=3D'center'=20 valign=3D'top'>\n";
  echo "<input = style=3D'font:8pt;'=20 type=3D'reset' value=3D'Zur&uuml;cksetzen'>\n";
  = echo=20 "<input type=3D'hidden' value=3D'$lngn'>\n";  =
  echo=20 "<td width=3D'20%' >\n</td>\n";
  echo=20 "</form>\n";  
 
  if = (isset($ttext))
  =20 {
    if ($ttext =3D=3D = "")
    =20 {}
    else
    =20 {
      $rem =3D=20 fopen("../public/mf/$tfn","w+");
   = ;   =20 while (!feof($rem))
       =20 {
         $zeile =3D=20 fgets($rem,4096);
       =20 }
       fwrite($rem, $ttext); =20
       = fclose($rem);
 
      = $mfdb =3D=20 fopen("../public/mf/mfdb.ldb","r+");
  &= nbsp;   =20 while (!feof($mfdb))
       =20 {
         $zeile =3D=20 fgets($mfdb,1024);
         = echo=20 $zeile;
       =20 }
       fwrite($mfdb,=20 $tfn);
       fwrite($mfdb,=20 "\n");     =20
      =20 fclose($mfdb);     
 
      =20
     }
   }  =
 

  for ($r=3D0;=20 $r<sizeof($zeilenarray); = $r++)
      =20 {
   # = ereg("",$zeilenarray[$r]);
   =20
    = readfile("../public/mf/$zeilenarray[$r]");=20
    echo=20 "<br><br>";      &nbs= p;            = ;  =20
        }
 
  $file =3D=20 fopen("../public/mf/mfdb.ldb", = "r");
   =20 if (!$file) {
      echo = "<p>Unable to=20 open remote file.\n";
     =20 exit;
    }
    while (!feof($file)) = {
      $line =3D fgets($file,=20 1024);
      echo=20 $line;       =20
      }
 
 =20 fclose($file);
 
?>
 
 
mfg,
cu_(at)_listor
------=_NextPart_000_0179_01BF4109.2EBFB510--

php::bar PHP Wiki   -   Listenarchive