Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]Odświerzanie strony i formularz
Radek79
post
Post #1





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 24.08.2007

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


Szukam sposobu na zabezpieczenie danych z formularza przed ponownym zapisaniem do data.txt przy odświerzeniu stony.
Chyba powinienem użyć sesji jednak trochę mi to nie idzie może ktoś mi wskarze jakiegoś tutoriala lub przedatne informacje do tego tematu ?

Fragment pierwszego formularza
  1. <?php
  2. if (!isset($_SESSION['count'])) {
  3. $_SESSION['count'] = 0;
  4. } else {
  5. $_SESSION['count']++;
  6. }
  7.  
  8.  
  9. ?>


Fragment drugiego (validate.php)
Czy można używając
  1. <?php
  2. header(&#092;"Location: summary.php\");
  3. ?>

przesłać zmienne metodą POST do summary.php?
  1. <?php
  2. if (!isset($_SESSION['count'])) {
  3. $_SESSION['count'] = 0;
  4. } else {
  5. $_SESSION['count']++;
  6. }
  7. $blad_txt='';
  8. $blad=false; 
  9. //walidacja...
  10. if(!$blad)
  11. {
  12. include 'summary.php';
  13. //header(\"Location: summary.php\");
  14. }
  15. else
  16. {
  17. echo '
  18. ';
  19. echo $blad_txt;
  20. }
  21. ?>
  22. ?>

summary.php

  1. <?php
  2. echo '<br/>';
  3.  
  4. $id = $_POST['$id'];
  5.  
  6. $imie = trim($_POST['imie']);
  7.  
  8. $dane = $data."\n";
  9. $file = "baza.txt";
  10. $fp = fopen($file, "a");
  11. flock($fp, 2);
  12. fwrite($fp, $dane);
  13. flock($fp, 3);
  14. fclose($fp);
  15. echo '<h1>'.$id.'</h1>';
  16.  
  17. var_dump($_POST)
  18. ?>
  19.  </br >


Ten post edytował Radek79 25.08.2007, 15:58:34
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Cysiaczek
post
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Popraw proszę tytuł topiku na zgodny z zasadami forum Przedszkole


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
nospor
post
Post #3





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




http://forum.php.pl/index.php?showtopic=44383
http://forum.php.pl/index.php?showtopic=36933&hl=1062


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

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: 20.08.2025 - 03:02