| 
| 
   
      | 
            
               |  | SWiSH Forum Forum użytkowników programów SWiSH
 
 
 |  
 
	
			| pomocy z zapisaniem tekstu do pliku txt |  
      | Autor | Wiadomość |  
      | Kamil1624 Bywalec
 
  
 Dołączył: 01 Paź 2006
 Posty: 10
 
 | 
            
               |  Wysłany: Wto 03 Paź, 2006 15:11   pomocy z zapisaniem tekstu do pliku txt |   
 |  
               | 
 |  
               | Pisałem juz raz o tym lecz nie dostałem odpowiedzi ale moze teraz dostane  Jeśli jest juz taki temat to przepraszam ale  zalezy mi natym a nie znam sie na tyle na php mianowicie chodzi mi o cos takiego jak podałem ponizej.   
 
  	  | Cytat: |  	  | Witam mam taki mały problemik był bym wdzieczny gdyby mi ktos pomógł. Mam script który zapisuje dane do pliku text. I chciałbym by script ten w pierwszym wierszu pliku text wstawiał taki napis &tekst= a dopiero potem reszte. Poniżej zamieszczam kod i tresć pliku tekstowego
 
  	  | Kod: |  	  | ##### Original PHP Script by Jeffrey Hill of http://www.Flash-DB.com ##### Modifications doqs (to work with sprites in SWiSH)
 ##### Contact : doqs@wp.pl
 // If you are using an old version of php, remove the next set of lines.
 // or use $HTTP_POST_VARS["..."] instead.
 $Submit    = $_POST["Submit"];
 $Name      = $_POST["Name"];
 $Comments    = $_POST["Comments"];
 $NumLow    = $_REQUEST["NumLow"];
 $NumHigh    = $_REQUEST["NumHigh"];
 
 // Replace special characters - you can remove the next 5 lines if wanted.
 $Name      = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
 $Comments  = ereg_replace("[^A-Za-z0-9 ążśźćęńłó\@&\./\']", "", $Comments);
 // Remove slashes.
 $Name      = stripslashes($Name);
 $Comments    = stripslashes($Comments);
 
 // ###################################################################################
 // ########## Reading and Writing the new data to the GuestBook Database #############
 
 if ($Submit == "Yes") {
 // Next line tells the script which Text file to open.
 $filename    = "GuestBook.txt";
 
 // Opens up the file declared above for reading
 
 $fp      = fopen( $filename,"r");
 $OldData    = fread($fp, 80000);
 fclose( $fp );
 
 // Gets the current Date of when the entry was submitted
 $Today      = (date ("l dS of F Y"));
 
 // Puts the recently added data into html format that can be read into the Flash Movie.
 // You can change this up and add additional html formating to this area.  For a complete listing of all html tags
 // you can use in flash - visit: www.macromedia.com/suppor...ts/htmltext.htm
 
 $Input = "Name: <b>$Name</b>
 Comments: <b>$Comments</b><br>
 <i><font size=\"-1\">Date: $Today</font>
 
 .:::.";
 
 /* This Line adds the '&GuestBook=' part to the front of the data that is stored in the text file.  This is important because without this the Flash movie would not be able to assign the variable 'GuestBook' to the value that is located in this text file  */
 
 $New = "$Input$OldData";
 
 // Opens and writes the file.
 
 $fp = fopen( $filename,"r+");
 fwrite($fp, $New, 800000);
 fclose( $fp );
 echo '&load=loaded&';
 }
 
 // ###################################################################################
 // ######### Formatting and Printing the Data from the Guestbook to the Flash Movie ##
 
 
 
 // Next line tells the script which Text file to open.
 $filename = "GuestBook.txt";
 
 // Opens up the file declared above for reading
 
 $fp    = fopen( $filename,"r");
 $Data    = fread($fp, 800000);
 fclose( $fp );
 
 // Splits the Old data into an array anytime it finds the pattern .:::.
 $DataArray = split (".:::.", $Data);
 
 // Counts the Number of entries in the GuestBook
 $NumEntries = count($DataArray) - 1;
 
 print "&load=loaded&&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
 for ($n = $NumLow; $n < $NumHigh; $n++) {
 print $DataArray[$n];
 if (!$DataArray[$n]) {
 Print "<br><br><br><b>No More entries</b>";
 
 exit;
 }
 }
 ##### Original PHP Script by Jeffrey Hill of http://www.Flash-DB.com
 ##### Modifications by www.Swish-Tutorials.com (to work with sprites in SWiSH)
 ##### Contact : Brian Ayers at admin@swish-tutorials.com
 ?>
 | 
 
 treśc pliku textowego
 
  	  | Kod: |  	  | Name: <b>kamil </b> Comments: <b>text</b><br>
 <i><font size="-1">Date: Monday 02nd of October 2006</font>
 
 .:::.Name: <b>kamil </b>
 Comments: <b>bla bala </b><br>
 <i><font size="-1">Date: Monday 02nd of October 2006</font>
 
 .:::.
 | 
 A chciałbym by plik tekstowy wyglądał tak
 
 Myśle że  wiecie oco mi chodzi 	  | Kod: |  	  | 
 &tekst=Name: <b>kamil </b>
 Comments: <b>text</b><br>
 <i><font size="-1">Date: Monday 02nd of October 2006</font>
 
 .:::.Name: <b>kamil </b>
 Comments: <b>bla bala </b><br>
 <i><font size="-1">Date: Monday 02nd of October 2006</font>
 
 .:::.&
 
 | 
  z góry dziekuje za pomoc .   | 
 |  |  
		|   |  |  
		|  |  
      | budzyk Bywalec
 
  
 Pomógł: 1 raz
 Wiek: 38
 Dołączył: 30 Wrz 2006
 Posty: 13
 
 | 
            
               |  Wysłany: Wto 03 Paź, 2006 15:58 |   
 |  
               | 
 |  
               | tak na logike czysta 
 
 // Puts the recently added data into html format that can be read into the Flash Movie.
 // You can change this up and add additional html formating to this area.  For a complete listing of all html tags
 // you can use in flash - visit: www.macromedia.com/suppor...ts/htmltext.htm
 
 $Input = '$tekst=Name: <b>' .$Name .'</b>
 Comments: <b>$Comments</b><br>
 <i><font size=\"-1\">Date: $Today</font>
 
 musisz zmienna input dać w ' a nie w ", bo wtedy traktuje $ jako string a nie jako zminna, oprocz tego przed każda zmienna w stringu Input musisz zrobić to, co przed $name, czyli zroibć ' .$nazwazmiennej .', żeby je czytało jako zmienna a nie jako string. mama nadzieje, ze jasno napisałem:].
 
 [ Dodano: Wto 03 Paź, 2006 19:22 ]
 $Input = '$tekst=Name: <b>' .$Name .'</b>Comments: <b>' .$Comments .'</b><br>
 <i><font size="-1">Date: ' .$Today .'</font> .:::.';
 
 
 czyli tak to bedzie wygladało, mialem troszke czasu to napisałem.
 |  |  
		|   |  |  
		|  |  
      | Kamil1624 Bywalec
 
  
 Dołączył: 01 Paź 2006
 Posty: 10
 
 | 
            
               |  Wysłany: Wto 03 Paź, 2006 19:40   newsy |   
 |  
               | 
 |  
               | Niestety nie do końca pomogło wyszło na to samo co mi wcześniej. Ten napis &tekst= moze byc tylko raz powtuzony w całym tekscie  i to w dodatku musi znajdowac sie w pierwszej lini.
 Tak jak  podałeś wyzej tekst ten poljawia sie przed kazda zmiena "$Name"
 |  |  
		|   |  |  
		|  |  
      |  |  
    
      | Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach
 Nie możesz zmieniać swoich postów
 Nie możesz usuwać swoich postów
 Nie możesz głosować w ankietach
 Nie możesz załączać plików na tym forum
 Możesz ściągać załączniki na tym forum
 
 | Dodaj temat do Ulubionych Wersja do druku
 
 
 |  
 
        
          Nowe zasady dotyczące cookies.  Wykorzystujemy pliki cookies, aby nasz serwis lepiej spełniał Państwa oczekiwania. Można zablokować zapisywanie cookies, zmieniając ustawienia przeglądarki.|  |  |  |  |  |  |  | Strona wygenerowana w 0.14 sekundy. Zapytań do SQL: 14 | 
 |  |