Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php] str_replace polskie litery
Forum PHP.pl > Forum > Przedszkole
e.Bobi
Witam!
Mam następujące 2 problemy odnoszące sie do tego kodu:
  1. <?
  2. //lacze sie z baza danych
  3. ?>
  4. <?php
  5. $rok = date("Y");
  6. $miesiac = date("F");
  7. $dzien = date("l");
  8. $datu = date ("d");
  9. $godzina = date ("H:m:s");
  10. $temat = trim($_POST['temat']);
  11. $tresc = trim($_POST['tresc']);
  12. $do_zas = array(" ", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "+", "-", "~", "`", ".", ",", "?", "[", "]");
  13. function bbcode($string){
  14. $string = str_replace($do_zas, "0", $string);
  15. $string = str_replace("a", "1", $string);
  16. $string = str_replace("ą", "1", $string);
  17. $string = str_replace("b", "2", $string);
  18. $string = str_replace("c", "3", $string);
  19. $string = str_replace("ć", "3", $string);
  20. $string = str_replace("d", "4", $string);
  21. $string = str_replace("e", "5", $string);
  22. $string = str_replace("ę", "5", $string);
  23. $string = str_replace("f", "6", $string);
  24. $string = str_replace("g", "7", $string);
  25. $string = str_replace("h", "8", $string);
  26. $string = str_replace("i", "9", $string);
  27. $string = str_replace("j", "a", $string);
  28. $string = str_replace("k", "b", $string);
  29. $string = str_replace("l", "c", $string);
  30. $string = str_replace("ł", "c", $string);
  31. $string = str_replace("m", "d", $string);
  32. $string = str_replace("n", "e", $string);
  33. $string = str_replace("ń", "e", $string);
  34. $string = str_replace("o", "f", $string);
  35. $string = str_replace("ó", "f", $string);
  36. $string = str_replace("p", "g", $string);
  37. $string = str_replace("q", "h", $string);
  38. $string = str_replace("r", "i", $string);
  39. $string = str_replace("s", "j", $string);
  40. $string = str_replace("ś", "j", $string);
  41. $string = str_replace("t", "k", $string);
  42. $string = str_replace("u", "l", $string);
  43. $string = str_replace("v", "m", $string);
  44. $string = str_replace("w", "n", $string);
  45. $string = str_replace("x", "o", $string);
  46. $string = str_replace("y", "p", $string);
  47. $string = str_replace("z", "q", $string);
  48. $string = str_replace("ż", "q", $string);
  49. $string = str_replace("ź", "q", $string);
  50. return $string;
  51. }
  52. if(empty($temat) and empty($tresc)) {
  53. echo 'Nie wysylaj pustego formularza!<br /><br /><form method="post" action="" enctype="multipart/form-data">
  54. Temat: <input type=text name=temat maxlength=255><br />
  55. Tresc: <textarea type=text name=tresc ></textarea><br />
  56. <input type=submit value=Wyslij>
  57. </form>';
  58. } else {
  59. $sql = mysql_query("INSERT INTO blog (rok, miesiac, dzien, datu, godzina, temat, tresc) VALUES ('$rok', '$miesiac', '$dzien', '$datu', '$godzina', '$temat', '$tresc')") or die (mysql_error());
  60. echo "Dane zostaly zapisane!<br />";
  61. echo "<a href=\"index.php\">Zobacz wpisane dane</a>";
  62. $dtemat = bbcode($temat);
  63. mkdir("blog/".$dtemat, 0700);
  64. }
  65. ?>

pytanie1: dlaczego nie nie zastępuje mi polskich literek? inne zastępuje tylko nie polskie...
pytanie2: dlaczego kalatog się nie tworzy? wyskakuje błąd "Warning: mkdir(blog/ĆĄść): Permission denied in /home/accounts_a/artbobi/public_html/blog/a_blog.php on line 65"
nickers
Jesli chodzi o literki to pewnie dostajesz dane w innym kodowaniu niz uzywasz w swoim edytorze. Podaj polskie literki jako 0xfa itp. albo zmien kodowanie danych, ktore dostales na kodowanie ktorego uzywasz w edytorze.
aj_rudy
Ad.1
no i pozatym str_replace chyba jest wrażliwe na wielkość liter..

co do pytania 2 to

1.rozumiem ze katalog BLOG jest juz utworzony - sprawdz czy masz nadane uprawnienia do tworzenia w nim podkatalogow.

a pozatym nie wiem czy dobrym pomyslem jest uzywanie nazw katalogu z polskimi znaczkami

pozdr.
Fipaj
aj_rudy: nie jest. str_ireplace jest.

chmod" title="Zobacz w manualu php" target="_manual
e.Bobi
w pliku mam tak
  1. <?php
  2. chmod("http://artbobi.boo.pl/blog", 0755);
  3. ?>


wywaliło taki błąd
"
Warning: chmod(): No such file or directory in /home/accounts_a/artbobi/public_html/blog/a_blog.php on line 4
"
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.