Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> 2 Opcje Wstawiania Danych Do Bazy., Która wersja jest lepsza... ?
tomek0077
post
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 6.01.2004

Ostrzeżenie: (0%)
-----


Który z poniżej pokazanych opcji wstawiania z formularzy danych do bazy mysql jest bardziej prawidłowa... ?
Dane z bazy wyciagam przez: stripslashes()


1 Opcja:
  1. <?php
  2.  
  3. function FixQuotes ($what = &#092;"\") {
  4.     $what = ereg_replace(&#092;"'\",\"''\",$what);
  5.     while (eregi(&#092;"'\", $what)) {
  6.     $what = ereg_replace(&#092;"'\",\"'\",$what);
  7.     }
  8.     return $what;
  9. }
  10.  
  11. $autor = stripslashes(FixQuotes($autor));
  12. $wstawil = stripslashes(FixQuotes($wstawil));
  13. $tytul = stripslashes(FixQuotes($tytul));
  14. $image = stripslashes(FixQuotes($image));
  15. $opis = stripslashes(FixQuotes($opis));
  16. $notes = stripslashes(FixQuotes($notes));
  17. ?>


2 Opcja:
  1. <?php
  2. $autor = addslashes($autor);
  3. $wstawil = addslashes($wstawil);
  4. $tytul = addslashes($tytul);
  5. $image = addslashes($image);
  6. $opis = addslashes($opis);
  7. $notes = addslashes($notes);
  8. ?>


Ten post edytował tomek0077 17.08.2004, 13:22:57
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
tomek0077
post
Post #2





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 6.01.2004

Ostrzeżenie: (0%)
-----


to którego z tych 2 użyć:

addslashes()
czy
(htmlspecialchars() lub htmlentities() )

Która metoda jest lepsza i dlaczego ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 19:27