Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: Ksiêga go¶ci i polskie znaki
Forum PHP.pl > Forum > Przedszkole
zjedzony_przez_psa
mam tutaj taki skrypcik ksiege gosci tylko nie wiem jak zrobic tak zeby mozna bylo wpisywac polskie znaki jak ¶æñ±ê¼¿³ó oraz znaki specjalne prosze o modyfikacje tego pliku z gory dziekuje

  1. <?
  2. ############### .::Comments are indicated by the # symbol - you can erase all of these if needed.
  3. ############### .::Author: Jeffrey F. Hill
  4. ############### .::Website: www.Flash-dB.com
  5.  
  6. ############### Begin GuestBook Script #####################################
  7.  
  8. ##The first 3 lines use a regular expression to match a pattern then replace it 
    with nothing. The only reason for this is so we only allow necessary characters to be entered 
    into the guestbook. This also takes out slashes which are sometimes added in the 
    post headers to make the string friendly. You can erase or take these lines out if you want.
  9.  
  10. $Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
  11. $Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/']", "", $Email);
  12. $Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/']", "", $Comments);
  13.  
  14. $Website = eregi_replace("http://", "", $Website);
  15. $Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/'\~\:]", "", $Website);
  16.  
  17. $Name = stripslashes($Name);
  18. $Email = stripslashes($Email);
  19. $Website = stripslashes($Website);
  20. $Comments = stripslashes($Comments);
  21.  
  22. ################################################################################
    ####
  23. ########### Reading and Writing the new data to the GuestBook Database #########
    ####
  24.  
  25. if ($Submit == "Yes") {
  26. #Next line tells the script which Text file to open.
  27. $filename = "GuestBook.txt";
  28.  
  29. #Opens up the file declared above for reading 
  30.  
  31. $fp = fopen( $filename,"r"); 
  32. $OldData = fread($fp, 80000); 
  33. fclose( $fp ); 
  34.  
  35. #Gets the current Date of when the entry was submitted
  36. $Today = (date ("l dS of F Y ( h:i:s A )",time()));
  37.  
  38. #Puts the recently added data into html format that can be read into the Flash M
    ovie.
  39.  
  40. $Input = "Imie: $Name<br>Email: <u><a href=\"mailto:$Email\">$Email</a></u><br>Strona: <u><a href=\"http://$Website\" target=\"_blank\">$Website</a></u><br>Komentarz: $Comments<br><i><font size=\"-1\">Data wpisu: $Today</font><br><br>.:::.";
  41.  
  42. #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 assi
    gn the variable 'GuestBook' to the value that is located in this text file 
  43.  
  44. $New = "$Input$OldData";
  45.  
  46. #Opens and writes the file.
  47.  
  48. $fp = fopen( $filename,"w+"); 
  49. fwrite($fp, $New, 80000); 
  50. fclose( $fp ); 
  51. }
  52. ################################################################################
    ####
  53. ########## Formatting and Printing the Data from the Guestbook to the Flash Movi
    e ##
  54.  
  55. #Next line tells the script which Text file to open.
  56. $filename = "GuestBook.txt";
  57.  
  58. #Opens up the file declared above for reading 
  59.  
  60. $fp = fopen( $filename,"r"); 
  61. $Data = fread($fp, 80000); 
  62. fclose( $fp );
  63.  
  64. #Splits the Old data into an array anytime it finds the pattern .:::.
  65. $DataArray = split (".:::.", $Data);
  66.  
  67. #Counts the Number of entries in the GuestBook
  68. $NumEntries = count($DataArray) - 1;
  69.  
  70. print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
  71. for ($n = $NumLow; $n < $NumHigh; $n++) {
  72. print $DataArray[$n];
  73. if (!$DataArray[$n]) {
  74. Print "<br><br>No More entries";
  75. }
  76. }
  77.  
  78.  
  79.  
  80. ################################################################################
    ####
  81. ############### End GuestBook Script
  82. ?>
lenczewski
do wszystkich [^A-Za-z pododawaj ¶æñ±ê¼¿³ó, czyli np. [^A-Za-z¶æñ±ê¼¿³ó]
zjedzony_przez_psa
niestety to nie dziala wyskakuje blad na serwerze php Parse error: parse error, unexpected T_VAR in .....adres...styony...GuestBook.php on line 17
Guest
a ja sprobowale,m rozwiazec problem i jak uruchamiam strypt to wyswietla sie tylko &TotalEntries=0&NumLow=&NumHigh=&GuestBook=

plik GuestBook.txt utworzylem w tym samym katalogu

z polskimi znakami to uzyj: eregi_replace kodowane ± na ±
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.