Guest User

Untitled

a guest
Jan 10th, 2011
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <?php
  2. //recupero i dati e li inserisco in tre variabili di tipo stringa
  3. $utente=$_POST['utente'];
  4. $messaggio=$_POST['messaggio'];
  5. $email=$_POST['email'];
  6.  
  7. //ricavo l'ora e la data odierna
  8. $data_ora = date("d/m/Y H:i:s");
  9.  
  10.  
  11. //Ora viene controllato che i dati inseriti
  12. //dall'utente siano corretti
  13.  
  14. if($utente==""){
  15. echo "Il nickname inserito non è corretto.";
  16. }elseif($messaggio==""){
  17. echo "Devi inserire una testimonianza.(Anche se breve...)";
  18. }elseif($email==""){
  19. echo "Indirizzo email non valido.";
  20. }else{
  21. //se tutto è corretto procedo a scrivere le
  22. //informazioni sul database di testo
  23. <? fopen("styles/prosilver/template/database.html", "a");
  24. $txt='<tr><td>Testimonianza scritta da: <strong><a href="mailto:'.$email.'">'.$utente.'</a></strong><br/><br/>';
  25. $txt .= $messaggio . "<br/>";
  26. $txt .= "<i>Scritta il: " . $data_ora . "</i></td></tr>\r\n";
  27. fwrite($guestbook, $txt);
  28. fclose($guestbook);
  29. echo '<a href="index.php">Grazie mille per la tua testimonianza! Clicca qui per tornare alle testimonianze!</a>';
  30. }
Advertisement
Add Comment
Please, Sign In to add comment